Merge pull request #1370 in FS/freeswitch from ~LAZEDO/freeswitch:feature/FS-10598 to master

* commit '2fa6afed6fcf422575d79bf6483b5697a32acf2a':
  FS-10598: [mod_sofia] add replaces header call_id and params to channel variables
This commit is contained in:
Mike Jerris 2019-02-12 15:53:00 +00:00
commit e961cf72df
1 changed files with 18 additions and 0 deletions

View File

@ -11016,6 +11016,24 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
}
}
if (sip && sip->sip_replaces) {
msg_common_t *rp_common = sip->sip_replaces->rp_common;
switch_channel_set_variable(channel, "sip_replaces_call_id", sip->sip_replaces->rp_call_id);
if (rp_common && rp_common->h_class->hc_params) {
int i, n;
msg_param_t const *params = * (msg_param_t const **) ((char *)rp_common + rp_common->h_class->hc_params);
for (i = 0; params[i]; i++) {
msg_param_t param = params[i];
if (strchr(param, '=')) {
n = strcspn(param, "=");
switch_channel_set_variable_name_printf(channel, param + n + 1, "sip_replaces_%.*s", n, param);
} else {
switch_channel_set_variable_name_printf(channel, "true", "sip_replaces_%s", param);
}
}
}
}
if (bnh) {
sofia_private_t *b_private = NULL;
if ((b_private = nua_handle_magic(bnh))) {