Module: kamailio
Branch: master
Commit: ea30efdbae2b33988e6157ba5e17aba16db156d4
URL:
https://github.com/kamailio/kamailio/commit/ea30efdbae2b33988e6157ba5e17aba…
Author: Muhammad Shahzad Shafi <muhammad.shafi(a)1und1.de>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-03-30T21:07:19+02:00
tcpops: added tcp_get_conid() for kemi
---
Modified: src/modules/tcpops/tcpops_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/ea30efdbae2b33988e6157ba5e17aba…
Patch:
https://github.com/kamailio/kamailio/commit/ea30efdbae2b33988e6157ba5e17aba…
---
diff --git a/src/modules/tcpops/tcpops_mod.c b/src/modules/tcpops/tcpops_mod.c
index 8590e4b6b65..d5dac245024 100644
--- a/src/modules/tcpops/tcpops_mod.c
+++ b/src/modules/tcpops/tcpops_mod.c
@@ -601,6 +601,26 @@ static int ki_tcp_get_conid_helper(sip_msg_t* msg, str *saddr,
pv_spec_t *pvs)
return 1;
}
+/**
+ *
+ */
+static int ki_tcp_get_conid(sip_msg_t* msg, str *saddr, str *pvs)
+{
+ pv_spec_t *dst;
+ dst = pv_cache_get(pvs);
+
+ if(dst==NULL) {
+ LM_ERR("failed to get pv spec for: %.*s\n", pvs->len, pvs->s);
+ return -1;
+ }
+ if(dst->setf==NULL) {
+ LM_ERR("target pv is not writable: %.*s\n", pvs->len, pvs->s);
+ return -1;
+ }
+
+ return ki_tcp_get_conid_helper(msg, saddr, dst);
+}
+
/**
*
*/
@@ -855,6 +875,11 @@ static sr_kemi_t sr_kemi_tcpops_exports[] = {
{ SR_KEMIP_INT, SR_KEMIP_NONE, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
+ { str_init("tcpops"), str_init("tcp_get_conid"),
+ SR_KEMIP_INT, ki_tcp_get_conid,
+ { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
{ str_init("tcpops"), str_init("tcp_set_otcpid"),
SR_KEMIP_INT, ki_tcp_set_otcpid,
{ SR_KEMIP_INT, SR_KEMIP_NONE, SR_KEMIP_NONE,