From e48bfcaaa31fb3984705517fb8eceaf327df96ed Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 22 Feb 2008 14:06:13 +0000 Subject: [PATCH] update git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7722 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/mod_sofia.c | 8 ++++++-- src/mod/endpoints/mod_sofia/sofia_glue.c | 18 +++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 7d6dc384a2..b0fb1d38b4 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -960,10 +960,14 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi TAG_IF(!switch_strlen_zero(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)), TAG_END()); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Responding with %d %s\n", code, reason); - + if (!switch_strlen_zero(((char *)msg->pointer_arg))) { + tech_pvt->local_sdp_str = switch_core_session_strdup(tech_pvt->session, (char *)msg->pointer_arg); + if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) { + sofia_glue_tech_patch_sdp(tech_pvt); + } nua_respond(tech_pvt->nh, code, reason, SIPTAG_CONTACT_STR(tech_pvt->reply_contact), - SOATAG_USER_SDP_STR(msg->pointer_arg), + SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END()); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index eb3c69d926..95348ef3e6 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -753,11 +753,18 @@ void sofia_glue_tech_patch_sdp(private_object_t *tech_pvt) } if (!(ip_ptr && port_ptr)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s SDP Error! [%s]\n", switch_channel_get_name(tech_pvt->channel), tech_pvt->local_sdp_str); return; } - if (sofia_glue_tech_choose_port(tech_pvt, 1) != SWITCH_STATUS_SUCCESS) { - return; + if (switch_strlen_zero(tech_pvt->adv_sdp_audio_ip) || !tech_pvt->adv_sdp_audio_port) { + if (sofia_glue_tech_choose_port(tech_pvt, 1) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s I/O Error\n", switch_channel_get_name(tech_pvt->channel)); + return; + } + tech_pvt->iananame = switch_core_session_strdup(tech_pvt->session, "NO-NAME"); + tech_pvt->rm_rate = 8000; + tech_pvt->codec_ms = 20; } tech_pvt->orig_local_sdp_str = tech_pvt->local_sdp_str; @@ -790,11 +797,8 @@ void sofia_glue_tech_patch_sdp(private_object_t *tech_pvt) *q++ = *p++; } - tech_pvt->iananame = switch_core_session_strdup(tech_pvt->session, "NO-NAME"); - - tech_pvt->rm_rate = 8000; - tech_pvt->codec_ms = 20; - + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Patched SDP\n%s\n%s\n", + switch_channel_get_name(tech_pvt->channel), tech_pvt->orig_local_sdp_str, tech_pvt->local_sdp_str); }