From b8175a0c39e828b3261090960e2057abcea10475 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Tue, 8 Jul 2008 22:50:35 +0000 Subject: [PATCH] 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 --- src/mod/endpoints/mod_sofia/sofia.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 462b4edfdf..82f37ade20 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -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++; + } + } + } + } }