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,