Hi,
I'm currently working on a new module, that allows setting the TCP
keepalive options by socket, on demand, through the kamailio cfg:
https://github.com/kamailio/kamailio/tree/coudot/tcp_keepalive/modules/tcp_…
This allows turning this mechanism on only when needed during the
whole lifetime of a SIP/TCP connection. In our case, this would be only
during a media session, to efficiently detect a disconnection (clients
are smartphones on mobile network). Then, disabling keepalive when the
session ends allows to save on network traffic, and battery for the
client.
Setting the options on the socket is straightforward when the TCP
worker owns the file descriptor, but it's more tricky when it does not.
In the latter case, I've been re-using the core functions from
pass_fd.c.
Are the functions from pass_fd safe to use from modules? Apart from
close()ing the fd after setting the sock options, is there anything to
take care of in term of resource locking or releasing?
Any feedback is appreciated.
Cheers,
--
Camille
Hi,
I would just like to remind everybody that new features should be
documented in the wiki [0]
I've just added the tcpops new module.
Cheers,
Victor
[0] https://www.kamailio.org/wiki/features/new-in-devel
Hi All,
Can anyone confirm, is this safe? Primary use case is replication of
REGISTER after local save().
diff --git a/modules/dmq/dmq_funcs.c b/modules/dmq/dmq_funcs.c
index b31deba..a3611e8 100644
--- a/modules/dmq/dmq_funcs.c
+++ b/modules/dmq/dmq_funcs.c
@@ -24,6 +24,7 @@
#include "dmq_funcs.h"
#include "notification_peer.h"
+#include "../../dset.h"
/**
* @brief register a DMQ peer
@@ -385,6 +386,7 @@ int cfg_dmq_t_replicate(struct sip_msg* msg, char* s)
dmq_node_t* node;
struct socket_info* sock;
int i = 0;
+ int first = 1;
/* avoid loops - do not replicate if message has come from another
node
* (override if optional parameter is set)
@@ -413,10 +415,22 @@ int cfg_dmq_t_replicate(struct sip_msg* msg, char* s)
node = node->next;
continue;
}
+
+ if (!first) {
+ if (append_branch(msg, 0, 0, 0, Q_UNSPECIFIED, 0,
sock, 0, 0, 0, 0) == -1) {
+ LM_ERR("failed to append a branch\n");
+ node = node->next;
+ continue;
+ }
+ } else {
+ first = 0;
+ }
+
if(tmb.t_replicate(msg, &node->orig_uri) < 0) {
LM_ERR("error calling t_replicate\n");
goto error;
}
+
node = node->next;
}
lock_release(&node_list->lock);
Many thanks,
Charles
--
www.sipcentric.com
Follow us on twitter @sipcentric <http://twitter.com/sipcentric>
Sipcentric Ltd. Company registered in England & Wales no. 7365592. Registered
office: Faraday Wharf, Innovation Birmingham Campus, Holt Street,
Birmingham Science Park, Birmingham B7 4BB.