]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
another regression
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 20 Mar 2009 20:51:19 +0000 (20:51 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 20 Mar 2009 20:51:19 +0000 (20:51 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12693 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/mod_sofia.c

index 1e9855edb82ba90c2be58b9bd80245fad2af7f16..6b9dd742b5c6a1ca6c026847ae1f3bc5bcdaf62d 100644 (file)
@@ -309,8 +309,6 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
                switch_event_header_t *hi;
                char *bye_headers = NULL;
 
-               sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
-
                SWITCH_STANDARD_STREAM(stream);
                if ((hi = switch_channel_variable_first(channel))) {
                        for (; hi; hi = hi->next) {
@@ -342,22 +340,25 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
                                switch_channel_set_variable(channel, "sip_hangup_disposition", "send_bye");
                        }
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending BYE to %s\n", switch_channel_get_name(channel));
-                       nua_bye(tech_pvt->nh, 
-                                       SIPTAG_REASON_STR(reason),
-                                       TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
-                                       TAG_END());
+                       if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
+                               nua_bye(tech_pvt->nh, 
+                                               SIPTAG_REASON_STR(reason),
+                                               TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
+                                               TAG_END());
+                       }
                } else {
                        if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending CANCEL to %s\n", switch_channel_get_name(channel));
                                if (!tech_pvt->got_bye) {
                                        switch_channel_set_variable(channel, "sip_hangup_disposition", "send_cancel");
                                }
-
-                               nua_cancel(tech_pvt->nh, 
-                                                  SIPTAG_REASON_STR(reason), 
-                                                  TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
-                                                  TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
-                                                  TAG_END());
+                               if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
+                                       nua_cancel(tech_pvt->nh, 
+                                                          SIPTAG_REASON_STR(reason), 
+                                                          TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
+                                                          TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
+                                                          TAG_END());
+                               }
                        } else {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Responding to INVITE with: %d\n", sip_cause);
                                if (!tech_pvt->got_bye) {
@@ -372,7 +373,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
                        }
                }
 
-
+               sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
                switch_safe_free(stream.data);
        }