Module: kamailio
Branch: 5.4
Commit: b864dcf0eaf984c83b4e7b5c4d1c70f7a3b32ac5
URL:
https://github.com/kamailio/kamailio/commit/b864dcf0eaf984c83b4e7b5c4d1c70f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-03-29T10:45:03+02:00
kemix: exported function get_rcvadvip() and get_rcvadvport()
- return advertised address and port of the receiving socket
- forward porting from 5.3
(cherry picked from commit 070a9c042a1caf19162d3d97b26f8d7548747cbb)
(cherry picked from commit a76f06eb010765216450bd78bcc1040aa9902280)
---
Modified: src/modules/kemix/kemix_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/b864dcf0eaf984c83b4e7b5c4d1c70f…
Patch:
https://github.com/kamailio/kamailio/commit/b864dcf0eaf984c83b4e7b5c4d1c70f…
---
diff --git a/src/modules/kemix/kemix_mod.c b/src/modules/kemix/kemix_mod.c
index 4bd6f839d1..66cdcf1bc1 100644
--- a/src/modules/kemix/kemix_mod.c
+++ b/src/modules/kemix/kemix_mod.c
@@ -520,6 +520,38 @@ static sr_kemi_xval_t* ki_kx_get_rcvport(sip_msg_t *msg)
return &_sr_kemi_kx_xval;
}
+/**
+ *
+ */
+static sr_kemi_xval_t* ki_kx_get_rcvadvip(sip_msg_t *msg)
+{
+ memset(&_sr_kemi_kx_xval, 0, sizeof(sr_kemi_xval_t));
+ if(msg->rcv.bind_address!=NULL
+ && msg->rcv.bind_address->useinfo.address_str.len > 0) {
+ _sr_kemi_kx_xval.vtype = SR_KEMIP_STR;
+ _sr_kemi_kx_xval.v.s = msg->rcv.bind_address->useinfo.address_str;
+ return &_sr_kemi_kx_xval;
+ }
+
+ return ki_kx_get_rcvip(msg);
+}
+
+/**
+ *
+ */
+static sr_kemi_xval_t* ki_kx_get_rcvadvport(sip_msg_t *msg)
+{
+ memset(&_sr_kemi_kx_xval, 0, sizeof(sr_kemi_xval_t));
+ if(msg->rcv.bind_address!=NULL
+ && msg->rcv.bind_address->useinfo.port_no_str.len > 0) {
+ _sr_kemi_kx_xval.vtype = SR_KEMIP_INT;
+ _sr_kemi_kx_xval.v.n = (int)msg->rcv.bind_address->useinfo.port_no;
+ return &_sr_kemi_kx_xval;
+ }
+
+ return ki_kx_get_rcvport(msg);
+}
+
/**
*
*/
@@ -1085,6 +1117,16 @@ 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_rcvadvip"),
+ SR_KEMIP_XVAL, ki_kx_get_rcvadvip,
+ { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("kx"), str_init("get_rcvadvport"),
+ SR_KEMIP_XVAL, ki_kx_get_rcvadvport,
+ { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
{ str_init("kx"), str_init("get_proto"),
SR_KEMIP_XVAL, ki_kx_get_proto,
{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,