diff --git a/src/modules/usrloc/dlist.c b/src/modules/usrloc/dlist.c
index 252bb8bde07..c0c7cb0009f 100644
--- a/src/modules/usrloc/dlist.c
+++ b/src/modules/usrloc/dlist.c
@@ -114,6 +114,7 @@ int ul_ka_db_records(int partidx)
keys2[5] = &ul_ruid_col;
keys2[6] = &ul_user_col;
keys2[7] = &ul_domain_col;
+ keys2[8] = &ul_con_id_col;
/* where fields */
keys1[0] = &ul_expires_col;
@@ -256,6 +257,9 @@ int ul_ka_db_records(int partidx)
ur.aorhash = ul_get_aorhash(&ur.aor);
ur.contacts = &uc;
+ /* tcpconn_id */
+ uc.tcpconn_id = VAL_INT(ROW_VALUES(row)+8);
+
ul_ka_urecord(&ur);
} /* row cycle */
diff --git a/src/modules/usrloc/doc/usrloc_admin.xml b/src/modules/usrloc/doc/usrloc_admin.xml
index 66dae449130..f2d2001689c 100644
--- a/src/modules/usrloc/doc/usrloc_admin.xml
+++ b/src/modules/usrloc/doc/usrloc_admin.xml
@@ -1317,11 +1317,17 @@ modparam("usrloc", "version_table", 0)
contact records stored in memory.
- Note: it is recommeder to set 'timer_procs' parameter in order to have
+ Note: it is recommended to set 'timer_procs' parameter in order to have
dedicated timer processes for usrloc module and off-load the keepalive
sending process from the core timers.
+ Note: Keepalives will be sent to the IP and port using the transport
+ defined in the “received” column. If not set, then keepalives will be sent
+ to the AOR using UDP as a default transport. If available, the TCP
+ connection will be re-used for WS, TCP and TLS.
+
+
Default value is 0 (keepalive disabled)
.
@@ -1780,4 +1786,3 @@ modparam("usrloc", "db_clean_tcp", 1)
-
diff --git a/src/modules/usrloc/ul_keepalive.c b/src/modules/usrloc/ul_keepalive.c
index 8808725849f..ffe37fdc738 100644
--- a/src/modules/usrloc/ul_keepalive.c
+++ b/src/modules/usrloc/ul_keepalive.c
@@ -200,6 +200,7 @@ int ul_ka_urecord(urecord_t *ur)
}
idst.proto = dproto;
idst.send_sock = ssock;
+ idst.id = uc->tcpconn_id;
if(ssock->useinfo.name.len > 0) {
if (ssock->useinfo.address.af == AF_INET6) {
@@ -270,19 +271,16 @@ static int ul_ka_send(str *kamsg, dest_info_t *kadst)
#ifdef USE_TCP
else if(kadst->proto == PROTO_WS || kadst->proto == PROTO_WSS) {
/*ws-wss*/
- kadst->id=0;
return wss_send(kadst, kamsg->s, kamsg->len);
}
else if(kadst->proto == PROTO_TCP) {
/*tcp*/
- kadst->id=0;
return tcp_send(kadst, 0, kamsg->s, kamsg->len);
}
#endif
#ifdef USE_TLS
else if(kadst->proto == PROTO_TLS) {
/*tls*/
- kadst->id=0;
return tcp_send(kadst, 0, kamsg->s, kamsg->len);
}
#endif