FS-10407: [mod_sofia] Set redirect variables when outbound_redirect_fatal is true
In case of outbound_redirect_fatal=true none of the redirect variables are set. This makes it impossible for ESL applications to extract any information related to the "302 Moved Temporarily" reply.
This commit is contained in:
parent
752f46ece9
commit
1d15e411f9
|
@ -6607,6 +6607,42 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
|
|||
const char *v;
|
||||
|
||||
if ((v = switch_channel_get_variable(channel, "outbound_redirect_fatal")) && switch_true(v)) {
|
||||
su_home_t *home = su_home_new(sizeof(*home));
|
||||
switch_assert(home != NULL);
|
||||
|
||||
for (p_contact = sip->sip_contact; p_contact; p_contact = p_contact->m_next) {
|
||||
full_contact = sip_header_as_string(home, (void *) p_contact);
|
||||
invite_contact = sofia_glue_strip_uri(full_contact);
|
||||
|
||||
switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_%d", i);
|
||||
switch_channel_set_variable(channel, var_name, full_contact);
|
||||
|
||||
if (i == 0) {
|
||||
switch_channel_set_variable(channel, "sip_redirected_to", full_contact);
|
||||
}
|
||||
|
||||
if (p_contact->m_url->url_user) {
|
||||
switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_user_%d", i);
|
||||
switch_channel_set_variable(channel, var_name, p_contact->m_url->url_user);
|
||||
}
|
||||
if (p_contact->m_url->url_host) {
|
||||
switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_host_%d", i);
|
||||
switch_channel_set_variable(channel, var_name, p_contact->m_url->url_host);
|
||||
}
|
||||
if (p_contact->m_url->url_params) {
|
||||
switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_params_%d", i);
|
||||
switch_channel_set_variable(channel, var_name, p_contact->m_url->url_params);
|
||||
}
|
||||
|
||||
free(invite_contact);
|
||||
i++;
|
||||
}
|
||||
if (home) {
|
||||
su_home_unref(home);
|
||||
home = NULL;
|
||||
}
|
||||
switch_snprintf(var_name, sizeof(var_name), "sip:%d", status);
|
||||
switch_channel_set_variable(channel, SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE, var_name);
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL);
|
||||
goto end;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue