mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-14 08:05:37 +00:00
Merge pull request #1306 in FS/freeswitch from ~HRISTO/freeswitch:FS-10407-set-some-redirect-channel-variables to master
* commit '1d15e411f9f5b6c8883cda47534cc1e9c3a77f95': FS-10407: [mod_sofia] Set redirect variables when outbound_redirect_fatal is true
This commit is contained in:
commit
719937ff8f
@ -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…
x
Reference in New Issue
Block a user