extract contact header info into A channel when unhandled 3xx response is received (MODENDP-116)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8943 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2008-07-08 22:50:35 +00:00
parent ae5d9fbdbb
commit b8175a0c39
1 changed files with 23 additions and 0 deletions

View File

@ -1716,6 +1716,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
return;
}
if ((status == 180 || status == 183 || status == 200)) {
const char *astate = "early";
url_t *from = NULL, *to = NULL, *contact = NULL;
@ -1780,6 +1781,28 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
}
}
if (channel && sip && (status >= 300 || status < 399) && switch_channel_test_flag(channel, CF_OUTBOUND)) {
sip_contact_t * p_contact = sip->sip_contact;
int i = 0;
char var_name[80];
while (p_contact) {
if (p_contact->m_url) {
if (p_contact->m_url->url_user) {
switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_user_%d", i);
switch_channel_set_variable_partner(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_partner(channel, var_name, p_contact->m_url->url_host);
}
p_contact = p_contact->m_next;
i++;
}
}
}
}
}