Module: kamailio
Branch: master
Commit: 8ba747b8af8068f0ee8e3d440ac9f094d7dec28a
URL:
https://github.com/kamailio/kamailio/commit/8ba747b8af8068f0ee8e3d440ac9f09…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-04-02T14:18:30+02:00
rr: new param sockname_mode
- if set to 1, socket name is added to Path URI in 'sn' param
---
Modified: src/modules/rr/record.c
Modified: src/modules/rr/rr_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/8ba747b8af8068f0ee8e3d440ac9f09…
Patch:
https://github.com/kamailio/kamailio/commit/8ba747b8af8068f0ee8e3d440ac9f09…
---
diff --git a/src/modules/rr/record.c b/src/modules/rr/record.c
index 936a348b22..54da64cf99 100644
--- a/src/modules/rr/record.c
+++ b/src/modules/rr/record.c
@@ -70,6 +70,7 @@
#define RR_PARAM_BUF_SIZE 512 /*!< buffer for RR parameter */
extern int rr_ignore_sips;
+extern int rr_sockname_mode;
/*!
* \brief RR param buffer
@@ -207,6 +208,7 @@ static inline int build_rr(struct lump* _l, struct lump* _l2, str*
user,
char *p;
char *rr_prefix;
int rr_prefix_len;
+ int rr_lump_type;
if(_sips==0) {
rr_prefix = RR_PREFIX_SIP;
@@ -281,7 +283,10 @@ static inline int build_rr(struct lump* _l, struct lump* _l2, str*
user,
if (!(_l = insert_new_lump_after(_l, prefix, prefix_len, 0)))
goto lump_err;
prefix = 0;
- _l = insert_subst_lump_after(_l, _inbound?SUBST_RCV_ALL:SUBST_SND_ALL, 0);
+ rr_lump_type = (_inbound)?
+ (rr_sockname_mode?SUBST_RCV_ALL_EX:SUBST_RCV_ALL)
+ :(rr_sockname_mode?SUBST_SND_ALL_EX:SUBST_SND_ALL);
+ _l = insert_subst_lump_after(_l, rr_lump_type, 0);
if (_l ==0 )
goto lump_err;
if (enable_double_rr) {
diff --git a/src/modules/rr/rr_mod.c b/src/modules/rr/rr_mod.c
index f61c693cb0..6643239fcb 100644
--- a/src/modules/rr/rr_mod.c
+++ b/src/modules/rr/rr_mod.c
@@ -62,6 +62,7 @@ int enable_socket_mismatch_warning = 1; /*!< enable socket mismatch
warning */
static str custom_user_spec = {NULL, 0};
pv_spec_t custom_user_avp;
int rr_ignore_sips = 0; /*!< ignore sips schema when building record-route */
+int rr_sockname_mode = 0; /*!< add socket name to R-R header */
ob_api_t rr_obb;
@@ -136,6 +137,7 @@ static param_export_t params[] ={
{"custom_user_avp", PARAM_STR, &custom_user_spec},
{"force_send_socket", PARAM_INT, &rr_force_send_socket},
{"ignore_sips", PARAM_INT, &rr_ignore_sips},
+ {"sockname_mode", PARAM_INT, &rr_sockname_mode},
{0, 0, 0 }
};