]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix last commit typos and return hangup cause on failure in funky pri boost early...
authorMichael Jerris <mike@jerris.com>
Thu, 21 Jan 2010 05:35:53 +0000 (05:35 +0000)
committerMichael Jerris <mike@jerris.com>
Thu, 21 Jan 2010 05:35:53 +0000 (05:35 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@994 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/openzap/mod_openzap/mod_openzap.c
libs/openzap/src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c

index ff5a564d51739001aade8d76c3dc6815dfeadfd5..a3539d755eedc9c47abb4d72b609414205d661fe 100644 (file)
@@ -1160,7 +1160,12 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
        
        if (status != ZAP_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No channels available\n");
-               return SWITCH_CAUSE_NORMAL_CIRCUIT_CONGESTION;
+
+               if (caller_data.hangup_cause == SWITCH_CAUSE_NONE) {
+                       caller_data.hangup_cause = SWITCH_CAUSE_NORMAL_CIRCUIT_CONGESTION;
+               }
+
+               return caller_data.hangup_cause;
        }
 
        if ((var = switch_event_get_header(var_event, "openzap_pre_buffer_size"))) {
index a863c68d6762b04b6f9f9f390de6c309eee172c9..afb9e97fd57a6d55c7fdce1334c96f636e5eacbd 100644 (file)
@@ -71,6 +71,7 @@ typedef struct {
        sangomabc_short_event_t event;
        zap_span_t *span;
        zap_channel_t *zchan;
+       int hangup_cause;
 } sangoma_boost_request_t;
 
 //#define MAX_REQ_ID ZAP_MAX_PHYSICAL_SPANS_PER_LOGICAL_SPAN * ZAP_MAX_CHANNELS_PHYSICAL_SPAN
@@ -395,18 +396,26 @@ static ZIO_CHANNEL_REQUEST_FUNCTION(sangoma_boost_channel_request)
        if (OUTBOUND_REQUESTS[r].zchan && OUTBOUND_REQUESTS[r].status != BST_READY && zap_test_flag((OUTBOUND_REQUESTS[r].zchan), ZAP_CHANNEL_INUSE)) {
                status = ZAP_FAIL;
                *zchan = NULL;
-               OUTBOUND_REQUESTS[event->call_setup_id].zchan = NULL;
-               if (zchan->extra_id) {                                                                                                                              
-                       zchan->extra_id = 0;                                                                                                                            
+               if (OUTBOUND_REQUESTS[r].zchan->extra_id) {
+                       OUTBOUND_REQUESTS[r].zchan->extra_id = 0;
                }
-               zchan->sflags = 0;                                                                                                                                  
-               zchan->call_data = NULL;                                                                                                                            
-               zap_channel_done(zchan);
-       } 
+               (OUTBOUND_REQUESTS[r].zchan)->sflags = 0;
+               (OUTBOUND_REQUESTS[r].zchan)->call_data = NULL;
+               zap_channel_done((OUTBOUND_REQUESTS[r].zchan));
+               OUTBOUND_REQUESTS[r].zchan = NULL;
+       }
 
        st = OUTBOUND_REQUESTS[r].status;
        OUTBOUND_REQUESTS[r].status = BST_FREE; 
-       
+
+       if (status == ZAP_FAIL) {
+               if (st == BST_FAIL) {
+                       caller_data->hangup_cause = OUTBOUND_REQUESTS[r].hangup_cause;
+               } else {
+                       caller_data->hangup_cause = ZAP_CAUSE_RECOVERY_ON_TIMER_EXPIRE;
+               }
+       }
+
        if (st == BST_FAIL) {
                release_request_id(r);
        } else if (st != BST_READY) {
@@ -495,7 +504,8 @@ static void handle_call_progress(sangomabc_connection_t *mcon, sangomabc_short_e
                                           event->call_setup_id,
                                           SIGBOOST_EVENT_CALL_STOPPED,
                                           ZAP_CAUSE_DESTINATION_OUT_OF_ORDER);
-       OUTBOUND_REQUESTS[event->call_setup_id].status = BST_FAIL;      
+       OUTBOUND_REQUESTS[event->call_setup_id].status = BST_FAIL;
+       OUTBOUND_REQUESTS[event->call_setup_id].hangup_cause = ZAP_CAUSE_DESTINATION_OUT_OF_ORDER;
 }
 
 /**
@@ -543,6 +553,7 @@ static void handle_call_start_ack(sangomabc_connection_t *mcon, sangomabc_short_
                                           SIGBOOST_EVENT_CALL_STOPPED,
                                           ZAP_CAUSE_DESTINATION_OUT_OF_ORDER);
        OUTBOUND_REQUESTS[event->call_setup_id].status = BST_FAIL;
+       OUTBOUND_REQUESTS[event->call_setup_id].hangup_cause = ZAP_CAUSE_DESTINATION_OUT_OF_ORDER;
        
 }
 
@@ -633,6 +644,7 @@ static void handle_call_start_nack(zap_span_t *span, sangomabc_connection_t *mco
 
                OUTBOUND_REQUESTS[event->call_setup_id].event = *event;
                OUTBOUND_REQUESTS[event->call_setup_id].status = BST_FAIL;
+               OUTBOUND_REQUESTS[event->call_setup_id].hangup_cause = event->release_cause;
                return;
        } else {
                if ((zchan = find_zchan(span, event, 1))) {