Module: kamailio
Branch: master
Commit: c556067bc3c0d99b7e81ee0bd1a97c1b416617d3
URL:
https://github.com/kamailio/kamailio/commit/c556067bc3c0d99b7e81ee0bd1a97c1…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: GitHub <noreply(a)github.com>
Date: 2019-09-04T00:21:16+02:00
Merge pull request #2051 from aalba6675/kemi-rr-preset
module rr: KEMI expose record_route_preset
---
Modified: src/modules/rr/rr_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/c556067bc3c0d99b7e81ee0bd1a97c1…
Patch:
https://github.com/kamailio/kamailio/commit/c556067bc3c0d99b7e81ee0bd1a97c1…
---
diff --git a/src/modules/rr/rr_mod.c b/src/modules/rr/rr_mod.c
index 6e9dda1318..31a6031a5f 100644
--- a/src/modules/rr/rr_mod.c
+++ b/src/modules/rr/rr_mod.c
@@ -291,6 +291,35 @@ static int ki_record_route(sip_msg_t *msg)
return ki_record_route_params( msg, 0 );
}
+/**
+ * wrapper for record_route_preset(msg, key1, key2)
+ */
+static int ki_record_route_preset(sip_msg_t *msg, str *key1, str *key2)
+{
+ if (msg->msg_flags & FL_RR_ADDED) {
+ LM_ERR("Double attempt to record-route\n");
+ return -1;
+ }
+ if (key2 && !enable_double_rr) {
+ LM_ERR("Attempt to double record-route while 'enable_double_rr' param is
disabled\n");
+ return -1;
+ }
+
+ if ( record_route_preset( msg, key1)<0 )
+ return -1;
+
+ if (!key2)
+ goto done;
+
+ if ( record_route_preset( msg, key2)<0 )
+ return -1;
+
+done:
+ msg->msg_flags |= FL_RR_ADDED;
+ return 1;
+
+}
+
/**
* config wrapper for record_route(msg, params)
*/
@@ -317,7 +346,7 @@ static int w_record_route_preset(struct sip_msg *msg, char *key, char
*key2)
str s;
if (msg->msg_flags & FL_RR_ADDED) {
- LM_ERR("Duble attempt to record-route\n");
+ LM_ERR("Double attempt to record-route\n");
return -1;
}
if (key2 && !enable_double_rr) {
@@ -747,6 +776,11 @@ static sr_kemi_t sr_kemi_rr_exports[] = {
{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
+ { str_init("rr"), str_init("record_route_preset"),
+ SR_KEMIP_INT, ki_record_route_preset,
+ { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
{ {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
};