Module: kamailio
Branch: master
Commit: aff06f6a9daeb053587658ca6cf8e6c267ee36fe
URL:
https://github.com/kamailio/kamailio/commit/aff06f6a9daeb053587658ca6cf8e6c…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-01-05T16:57:13+01:00
kemix: exported KSR.kx.get_send_sock_port()
- return send socket port if set, 0 otherwise
---
Modified: src/modules/kemix/kemix_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/aff06f6a9daeb053587658ca6cf8e6c…
Patch:
https://github.com/kamailio/kamailio/commit/aff06f6a9daeb053587658ca6cf8e6c…
---
diff --git a/src/modules/kemix/kemix_mod.c b/src/modules/kemix/kemix_mod.c
index fc4c6a2a69..5cb7b20e3f 100644
--- a/src/modules/kemix/kemix_mod.c
+++ b/src/modules/kemix/kemix_mod.c
@@ -522,6 +522,17 @@ static sr_kemi_xval_t* ki_kx_get_send_sock_name(sip_msg_t *msg)
return &_sr_kemi_kx_xval;
}
+/**
+ *
+ */
+static int ki_kx_get_send_sock_port(sip_msg_t *msg)
+{
+ if (msg==NULL || msg->force_send_socket==0) {
+ return 0;
+ }
+ return (int)msg->force_send_socket->port_no;
+}
+
/**
*
*/
@@ -1325,6 +1336,11 @@ static sr_kemi_t sr_kemi_kx_exports[] = {
{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
+ { str_init("kx"), str_init("get_send_sock_port"),
+ SR_KEMIP_INT, ki_kx_get_send_sock_port,
+ { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
{ str_init("kx"), str_init("get_rcvip"),
SR_KEMIP_XVAL, ki_kx_get_rcvip,
{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,