Module: kamailio
Branch: master
Commit: eca3bf7570290854561ecd4ef71dc093941e2d72
URL:
https://github.com/kamailio/kamailio/commit/eca3bf7570290854561ecd4ef71dc09…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-05-10T13:38:23+02:00
registrar: do not walk xavp list twice to get tcp connection id
---
Modified: src/modules/registrar/save.c
---
Diff:
https://github.com/kamailio/kamailio/commit/eca3bf7570290854561ecd4ef71dc09…
Patch:
https://github.com/kamailio/kamailio/commit/eca3bf7570290854561ecd4ef71dc09…
---
diff --git a/src/modules/registrar/save.c b/src/modules/registrar/save.c
index 878f22224b..15be2331b8 100644
--- a/src/modules/registrar/save.c
+++ b/src/modules/registrar/save.c
@@ -71,7 +71,11 @@ extern sruid_t _reg_sruid;
static int q_override_msg_id;
static qvalue_t q_override_value;
-int reg_get_cfg_tcpconnid(void)
+
+/**
+ *
+ */
+static int reg_get_cfg_tcpconnid(void)
{
int n;
sr_xavp_t *vavp=NULL;
@@ -254,6 +258,7 @@ static inline ucontact_info_t* pack_ci( struct sip_msg* _m, contact_t*
_c,
static struct sip_msg *m = 0;
static struct socket_info si = {0};
int_str val;
+ int tcid;
if (_m!=0) {
memset( &ci, 0, sizeof(ucontact_info_t));
@@ -298,9 +303,11 @@ static inline ucontact_info_t* pack_ci( struct sip_msg* _m,
contact_t* _c,
} else {
ci.tcpconn_id = -1;
}
- /* if a tcp connectionid is set, use it */
- if (reg_get_cfg_tcpconnid())
- ci.tcpconn_id = reg_get_cfg_tcpconnid();
+ /* if a tcp connectionid is set via xavp, use it */
+ tcid = reg_get_cfg_tcpconnid();
+ if(tcid > 0) {
+ ci.tcpconn_id = tcid;
+ }
/* additional info from message */
if (parse_headers(_m, HDR_USERAGENT_F, 0) != -1 && _m->user_agent
&&