Skip to content

Commit

Permalink
module rr: KEMI expose record_route_preset
Browse files Browse the repository at this point in the history
(cherry picked from commit e1ab977)
  • Loading branch information
aalba6675 authored and miconda committed Sep 24, 2019
1 parent becc6bc commit dcdfc26
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion src/modules/rr/rr_mod.c
Expand Up @@ -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)
*/
Expand All @@ -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) {
Expand Down Expand Up @@ -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 } }
};

Expand Down

0 comments on commit dcdfc26

Please sign in to comment.