From 181db2d18c588bab6674fd1e1b2fef7a5c51bcd4 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 9 Apr 2008 16:27:01 +0000 Subject: [PATCH] fix hung channels when using respond app with 1xx or 2xx responses or on re-invite in proxy/bypass media with 1xx and 2xx responses git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8062 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/mod_sofia.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 1008ce6294..a27d7189cf 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -948,12 +948,9 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi } if (!reason && code != 407) { - reason = "Call Refused"; - if (!reason) { - reason = sip_status_phrase(code); - if (switch_strlen_zero(reason)) { - reason = "Because"; - } + reason = sip_status_phrase(code); + if (switch_strlen_zero(reason)) { + reason = "Because"; } } @@ -985,7 +982,9 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi nua_respond(tech_pvt->nh, code, reason, TAG_IF(to_uri, SIPTAG_CONTACT_STR(to_uri)), SIPTAG_SUPPORTED_STR(NULL), SIPTAG_ACCEPT_STR(NULL), TAG_IF(!switch_strlen_zero(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)), TAG_END()); - switch_set_flag_locked(tech_pvt, TFLAG_BYE); + if (!switch_channel_test_flag(channel, CF_ANSWERED)) { + switch_set_flag_locked(tech_pvt, TFLAG_BYE); + } } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Responding with %d %s\n", code, reason); @@ -1005,7 +1004,9 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi } else { nua_respond(tech_pvt->nh, code, reason, SIPTAG_CONTACT_STR(tech_pvt->reply_contact), TAG_END()); } - switch_set_flag_locked(tech_pvt, TFLAG_BYE); + if (!switch_channel_test_flag(channel, CF_ANSWERED) && code >= 300) { + switch_set_flag_locked(tech_pvt, TFLAG_BYE); + } } }