]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
sync
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 19 Mar 2008 00:26:27 +0000 (00:26 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 19 Mar 2008 00:26:27 +0000 (00:26 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@424 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/openzap/src/zap_io.c
libs/openzap/src/zap_ss7_boost.c
libs/openzap/src/zap_threadmutex.c

index 6ba6fec39d67abcba151d123f89db5297635d2a8..f5b4bc1b675dceaa6c2dc5702dad6f92aa7443be 100644 (file)
@@ -342,7 +342,7 @@ zap_status_t zap_span_close_all(void)
        for(i = 1; i <= globals.span_index; i++) {
                span = &globals.spans[i];
                if (zap_test_flag(span, ZAP_SPAN_CONFIGURED)) {
-                       for(j = 0; j < span->chan_count; j++) {
+                       for(j = 0; j <= span->chan_count; j++) {
                                zap_channel_destroy(&span->channels[j]);
                        }
                } 
@@ -940,6 +940,18 @@ zap_status_t zap_channel_done(zap_channel_t *zchan)
 
        zap_clear_flag_locked(zchan, ZAP_CHANNEL_INUSE);
        zap_clear_flag_locked(zchan, ZAP_CHANNEL_OUTBOUND);
+       zap_clear_flag_locked(zchan, ZAP_CHANNEL_WINK);
+       zap_clear_flag_locked(zchan, ZAP_CHANNEL_FLASH);
+       zap_clear_flag_locked(zchan, ZAP_CHANNEL_STATE_CHANGE);
+       zap_clear_flag_locked(zchan, ZAP_CHANNEL_HOLD);
+       zap_clear_flag_locked(zchan, ZAP_CHANNEL_OFFHOOK);
+       zap_clear_flag_locked(zchan, ZAP_CHANNEL_RINGING);
+       zap_clear_flag_locked(zchan, ZAP_CHANNEL_PROGRESS_DETECT);
+       zap_clear_flag_locked(zchan, ZAP_CHANNEL_CALLERID_DETECT);
+       zap_clear_flag_locked(zchan, ZAP_CHANNEL_3WAY);
+       zap_clear_flag_locked(zchan, ZAP_CHANNEL_PROGRESS);
+       zap_clear_flag_locked(zchan, ZAP_CHANNEL_MEDIA);
+       zap_clear_flag_locked(zchan, ZAP_CHANNEL_ANSWERED);
 
        return ZAP_SUCCESS;
 }
index 09b3c4d7a2698f6f6e40fab6a1a55655493a6cb3..a6f6ff273edabaef3e2398c4915feca77afe9690 100644 (file)
@@ -77,7 +77,7 @@ static zap_channel_t *find_zchan(zap_span_t *span, ss7bc_event_t *event)
        int i;
        zap_channel_t *zchan = NULL;
 
-       for(i = 0; i < span->chan_count; i++) {
+       for(i = 0; i <= span->chan_count; i++) {
                if (span->channels[i].physical_span_id == event->span+1 && span->channels[i].physical_chan_id == event->chan+1) {
                        zchan = &span->channels[i];
                        break;
@@ -171,6 +171,7 @@ static void handle_call_start_ack(ss7bc_connection_t *mcon, ss7bc_event_t *event
                }
        } 
 
+       zap_log(ZAP_LOG_CRIT, "START ACK CANT FIND A CHAN %d:%d\n", event->span+1,event->chan+1);
        ss7bc_exec_command(mcon,
                                           event->span,
                                           event->chan,
@@ -201,22 +202,17 @@ static void handle_call_stop(zap_span_t *span, ss7bc_connection_t *mcon, ss7bc_e
        if ((zchan = find_zchan(span, event))) {
                zchan->caller_data.hangup_cause = event->release_cause;
                zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_TERMINATING);
-
-               ss7bc_exec_command(mcon,
-                                                  event->span,
-                                                  event->chan,
-                                                  0,
-                                                  SIGBOOST_EVENT_CALL_STOPPED_ACK,
-                                                  0);
-
        } else {
-               ss7bc_exec_command(mcon,
-                                                  event->span,
-                                                  event->chan,
-                                                  0,
-                                                  SIGBOOST_EVENT_CALL_STOPPED,
-                                                  ZAP_CAUSE_DESTINATION_OUT_OF_ORDER);
+               zap_log(ZAP_LOG_CRIT, "STOP CANT FIND A CHAN %d:%d\n", event->span+1,event->chan+1);
        }
+
+       ss7bc_exec_command(mcon,
+                                          event->span,
+                                          event->chan,
+                                          0,
+                                          SIGBOOST_EVENT_CALL_STOPPED_ACK,
+                                          0);
+       
 }
 
 static void handle_call_answer(zap_span_t *span, ss7bc_connection_t *mcon, ss7bc_event_t *event)
@@ -226,12 +222,7 @@ static void handle_call_answer(zap_span_t *span, ss7bc_connection_t *mcon, ss7bc
        if ((zchan = find_zchan(span, event))) {
                zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_UP);
        } else {
-               ss7bc_exec_command(mcon,
-                                                  event->span,
-                                                  event->chan,
-                                                  0,
-                                                  SIGBOOST_EVENT_CALL_STOPPED,
-                                                  ZAP_CAUSE_DESTINATION_OUT_OF_ORDER);
+               zap_log(ZAP_LOG_CRIT, "ANSWER CANT FIND A CHAN %d:%d\n", event->span+1,event->chan+1);
        }
 }
 
@@ -542,7 +533,7 @@ static void *zap_ss7_boost_run(zap_thread_t *me, void *obj)
        mcon = &ss7_boost_data->mcon;
        pcon = &ss7_boost_data->pcon;
 
- top:
      top:
 
        init_outgoing_array();          
 
@@ -579,7 +570,7 @@ static void *zap_ss7_boost_run(zap_thread_t *me, void *obj)
 
                        if (FD_ISSET(pcon->socket, &rfds)) {
                                if ((event = ss7bc_connection_readp(pcon, i))) {
-                                       parse_ss7_event(span, pcon, event);
+                                       parse_ss7_event(span, mcon, event);
                                } else goto top;
                        }
 
index 7534d3c9654233fc426ce97a0c64926deef1e75a..abeaa1f9b52ddcf7d4cb5b6e8064ad921cb1d29f 100644 (file)
@@ -174,6 +174,9 @@ zap_status_t zap_mutex_destroy(zap_mutex_t **mutex)
 {
        zap_mutex_t *mp = *mutex;
        *mutex = NULL;
+       if (!mp) {
+               return ZAP_FAIL;
+       }
 #ifdef WIN32
        DeleteCriticalSection(&mp->mutex);
 #else