]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
cleanup
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 21 Jan 2010 02:51:04 +0000 (02:51 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 21 Jan 2010 02:51:04 +0000 (02:51 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16430 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/sofia.c
src/switch_ivr.c
src/switch_ivr_bridge.c

index cdfebc4a90b16fc0f0a03e6b0337b4599897dee2..0b0571f77e1d829b9b6a5ea174bc267730cff6d7 100644 (file)
@@ -4964,10 +4964,11 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
 
                                                                nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
                                                                                   NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(etmp), TAG_END());
-
-                                                               if (b_tech_pvt) {
+                                                               
+                                                               if (b_tech_pvt && !sofia_test_flag(b_tech_pvt, TFLAG_BYE)) {
                                                                        char* q850 = NULL;
                                                                        const char* val = NULL;
+
                                                                        sofia_set_flag_locked(b_tech_pvt, TFLAG_BYE);
                                                                        val = switch_channel_get_variable(tech_pvt->channel, "disable_q850_reason");
                                                                        if (!val || switch_true(val)) {
@@ -4977,6 +4978,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
                                                                                        TAG_IF(!zstr(q850), SIPTAG_REASON_STR(q850)),
                                                                                        TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
                                                                                        TAG_END());
+                                                               
                                                                }
                                                        } else {
                                                                nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
@@ -5721,6 +5723,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
                from_user = sip->sip_from->a_url->url_user;
                from_host = sip->sip_from->a_url->url_host;
                channel_name = url_set_chanvars(session, sip->sip_from->a_url, sip_from);
+
                if (sip->sip_from->a_url->url_params && (tmp = sofia_glue_find_parameter(sip->sip_from->a_url->url_params, "isup-oli="))) {
                        aniii = switch_core_session_strdup(session, tmp + 9);
                        if ((tmp = strchr(aniii, ';'))) {
index da64244646117d933c4d06adeed0f23ed1e13b7d..ff124f07929b93c4e64a7b18924434472450e678 100644 (file)
@@ -736,7 +736,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session,
                        break;
                } else {
                        if (expires && switch_epoch_time_now(NULL) >= expires) {
-                               switch_channel_hangup(channel, SWITCH_CAUSE_RECOVERY_ON_TIMER_EXPIRE);
+                               switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
                                break;
                        }
 
index f4c0af221dcce83d3e8cc1ccace1cdb7be716160..a09055150303f95b9d58a9c12aec932c1c2f8d97 100644 (file)
@@ -625,7 +625,7 @@ static switch_status_t audio_bridge_on_exchange_media(switch_core_session_t *ses
        } else {
                if (!switch_channel_test_flag(channel, CF_TRANSFER) && !switch_channel_test_flag(channel, CF_REDIRECT) && 
                        !switch_channel_test_flag(channel, CF_XFER_ZOMBIE) && bd && !bd->clean_exit 
-                       && state != CS_PARK && state != CS_ROUTING && !switch_channel_test_flag(channel, CF_INNER_BRIDGE)) {
+                       && state != CS_PARK && state != CS_ROUTING && state != CS_EXCHANGE_MEDIA && !switch_channel_test_flag(channel, CF_INNER_BRIDGE)) {
                        switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
                }
        }
@@ -1165,37 +1165,26 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
        }
 
        state = switch_channel_get_state(caller_channel);
-       
-       if (!switch_channel_test_flag(caller_channel, CF_TRANSFER) && !switch_channel_test_flag(caller_channel, CF_REDIRECT) &&
-        !switch_channel_test_flag(caller_channel, CF_XFER_ZOMBIE) && !a_leg->clean_exit && !inner_bridge) {
-        int hup_ok = 0;
-        int x_ok = 0;
-
-        if ((state != CS_EXECUTE && state != CS_SOFT_EXECUTE && state != CS_PARK && state != CS_ROUTING)) {
-            hup_ok = 1;
-        }
 
-        if (switch_channel_test_flag(peer_channel, CF_ANSWERED) && state < CS_HANGUP) {
-            x_ok = 1;
-        }
 
-        if (x_ok) {
+    if (!switch_channel_test_flag(caller_channel, CF_TRANSFER) && !switch_channel_test_flag(caller_channel, CF_REDIRECT) &&
+        !switch_channel_test_flag(caller_channel, CF_XFER_ZOMBIE) && !a_leg->clean_exit && !inner_bridge) {
+        if ((state != CS_EXECUTE && state != CS_SOFT_EXECUTE && state != CS_PARK && state != CS_ROUTING) ||
+            (switch_channel_test_flag(peer_channel, CF_ANSWERED) && state < CS_HANGUP)) {
+                       
             if (switch_true(switch_channel_get_variable(caller_channel, SWITCH_PARK_AFTER_BRIDGE_VARIABLE))) {
                 switch_ivr_park_session(session);
-                hup_ok = 0;
             } else if ((var = switch_channel_get_variable(caller_channel, SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE))) {
                 transfer_after_bridge(session, var);
-                hup_ok = 0;
-            }
-        }
-
-        if (hup_ok) {
-            if (switch_channel_test_flag(peer_channel, CF_ANSWERED) &&
-                switch_true(switch_channel_get_variable(caller_channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE))) {
-                switch_channel_hangup(caller_channel, switch_channel_get_cause(peer_channel));
+            } else if (switch_channel_test_flag(peer_channel, CF_ANSWERED) &&
+                       switch_true(switch_channel_get_variable(caller_channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE))) {
+                               switch_call_cause_t cause = switch_channel_get_cause(peer_channel);
+                               if (cause == SWITCH_CAUSE_NONE) {
+                                       cause = SWITCH_CAUSE_NORMAL_CLEARING;
+                               }
+                switch_channel_hangup(caller_channel, cause);
             }
         }
-               
     }
 
        if (switch_channel_test_flag(caller_channel, CF_REDIRECT)) {