Author: mikej Date: Tue Jul 8 18:50:35 2008 New Revision: 8943 Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Log: extract contact header info into A channel when unhandled 3xx response is received (MODENDP-116) Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Tue Jul 8 18:50:35 2008 @@ -1716,6 +1716,7 @@ return; } + if ((status == 180 || status == 183 || status == 200)) { const char *astate = "early"; url_t *from = NULL, *to = NULL, *contact = NULL; @@ -1780,6 +1781,28 @@ 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++; + } + } + } + } }