|
@@ -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 } }
|
|
|
};
|
|
|
|