Module: kamailio
Branch: master
Commit: dbdf843cbdaf61dfadd2c10bf6ae5134a51f76ef
URL:
https://github.com/kamailio/kamailio/commit/dbdf843cbdaf61dfadd2c10bf6ae513…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-03-07T23:18:58+01:00
Merge pull request #106 from kamailio/coudot/registrar_ulc_conid
registrar: make connection id available in $ulc()
---
Modified: modules/registrar/README
Modified: modules/registrar/doc/registrar_admin.xml
Modified: modules/registrar/regpv.c
---
Diff:
https://github.com/kamailio/kamailio/commit/dbdf843cbdaf61dfadd2c10bf6ae513…
Patch:
https://github.com/kamailio/kamailio/commit/dbdf843cbdaf61dfadd2c10bf6ae513…
---
diff --git a/modules/registrar/README b/modules/registrar/README
index a35aa62..f305a69 100644
--- a/modules/registrar/README
+++ b/modules/registrar/README
@@ -1068,6 +1068,7 @@ event_route[usrloc:contact-expired] {
* ruid - record unique ID
* reg-id - reg-id value
* instance - instance value
+ * conid - TCP socket internal connection ID ($null if UDP)
The pseudo-variable accepts positive index value to access a specific
contact record.
diff --git a/modules/registrar/doc/registrar_admin.xml
b/modules/registrar/doc/registrar_admin.xml
index f1c9dc5..53693ef 100644
--- a/modules/registrar/doc/registrar_admin.xml
+++ b/modules/registrar/doc/registrar_admin.xml
@@ -1455,6 +1455,10 @@ event_route[usrloc:contact-expired] {
<para><emphasis>instance</emphasis> - instance value
</para>
</listitem>
+ <listitem>
+ <para><emphasis>conid</emphasis> - TCP socket internal connection
ID ($null if UDP)
+ </para>
+ </listitem>
</itemizedlist>
<para>
The pseudo-variable accepts positive index value to access
diff --git a/modules/registrar/regpv.c b/modules/registrar/regpv.c
index 719bec3..d891b4d 100644
--- a/modules/registrar/regpv.c
+++ b/modules/registrar/regpv.c
@@ -269,6 +269,10 @@ int pv_get_ulc(struct sip_msg *msg, pv_param_t *param,
if(c->instance.len>0)
return pv_get_strval(msg, param, res, &c->instance);
break;
+ case 21: /* conid */
+ if (c->sock && (c->sock->proto == PROTO_TCP || c->sock->proto
== PROTO_TLS || c->sock->proto == PROTO_WS || c->sock->proto == PROTO_WSS))
+ return pv_get_sintval(msg, param, res, c->tcpconn_id);
+ break;
}
return pv_get_null(msg, param, res);
@@ -363,6 +367,8 @@ int pv_parse_ulc_name(pv_spec_p sp, str *in)
rp->attr = 17;
else if(strncmp(pa.s, "regid", 5)==0)
rp->attr = 19;
+ else if(strncmp(pa.s, "conid", 5)==0)
+ rp->attr = 21;
else goto error;
break;
case 6:
@@ -538,6 +544,10 @@ int pv_fetch_contacts(struct sip_msg* msg, char* table, char* uri,
c0->instance.len = ptr->instance.len;
p += c0->instance.len;
}
+ if (ptr->sock->proto == PROTO_TCP || ptr->sock->proto == PROTO_TLS ||
ptr->sock->proto == PROTO_WS || ptr->sock->proto == PROTO_WSS)
+ {
+ c0->tcpconn_id = ptr->tcpconn_id;
+ }
if(ptr0==NULL)
{