append -1 .. -N postfix after any X-headers as vars that have the same name
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9703 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
bf487484c1
commit
98fefef56b
|
@ -3836,10 +3836,22 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
||||||
}
|
}
|
||||||
} else if (!strncasecmp(un->un_name, "X-", 2) || !strncasecmp(un->un_name, "P-", 2)) {
|
} else if (!strncasecmp(un->un_name, "X-", 2) || !strncasecmp(un->un_name, "P-", 2)) {
|
||||||
if (!switch_strlen_zero(un->un_value)) {
|
if (!switch_strlen_zero(un->un_value)) {
|
||||||
char *new_name;
|
char new_name[512] = "";
|
||||||
if ((new_name = switch_mprintf("%s%s", SOFIA_SIP_HEADER_PREFIX, un->un_name))) {
|
int reps = 0;
|
||||||
|
for(;;) {
|
||||||
|
char postfix[25] = "";
|
||||||
|
if (reps > 0) {
|
||||||
|
switch_snprintf(postfix, sizeof(postfix), "-%d", reps);
|
||||||
|
}
|
||||||
|
reps++;
|
||||||
|
switch_snprintf(new_name, sizeof(new_name), "%s%s%s", SOFIA_SIP_HEADER_PREFIX, un->un_name, postfix);
|
||||||
|
|
||||||
|
if (switch_channel_get_variable(channel, new_name)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
switch_channel_set_variable(channel, new_name, un->un_value);
|
switch_channel_set_variable(channel, new_name, un->un_value);
|
||||||
free(new_name);
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue