]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
adj
authorAnthony Minessale <anthony.minessale@gmail.com>
Sat, 12 Jan 2008 06:11:48 +0000 (06:11 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Sat, 12 Jan 2008 06:11:48 +0000 (06:11 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@365 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/openzap/mod_openzap/mod_openzap.c
libs/openzap/src/include/openzap.h
libs/openzap/src/zap_analog.c
libs/openzap/src/zap_io.c

index 1797cfe55581058a3ab46806707d2916de9c8e55..dcbf8b3294912c9c33fd199d6f5af41e72f5c749 100644 (file)
@@ -578,7 +578,14 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
 
        if (zap_channel_dequeue_dtmf(tech_pvt->zchan, dtmf, sizeof(dtmf))) {
                switch_dtmf_t _dtmf = { 0, SWITCH_DEFAULT_DTMF_DURATION };
-               switch_channel_queue_dtmf(channel, &_dtmf);
+               char *p;
+               for (p = dtmf; p && *p; p++) {
+                       if (is_dtmf(*p)) {
+                               _dtmf.digit = *p;
+                               zap_log(ZAP_LOG_DEBUG, "queue DTMF [%c]\n", *p);
+                               switch_channel_queue_dtmf(channel, &_dtmf);
+                       }
+               }
        }
 
        return SWITCH_STATUS_SUCCESS;
@@ -1214,7 +1221,7 @@ static ZIO_SIGNAL_CB_FUNCTION(on_isdn_signal)
                }
                break;
     case ZAP_SIGEVENT_STOP:
-               {
+               {       
                        while((session = zap_channel_get_session(sigmsg->channel, 0))) {
                                channel = switch_core_session_get_channel(session);
                                switch_channel_hangup(channel, sigmsg->channel->caller_data.hangup_cause);
index 866c6652516821081733e904f9371d34e19ade7d..d03ded222e020ea51a145dbacc9de5ff5db7744a 100644 (file)
@@ -521,6 +521,7 @@ int zap_hash_equalkeys(void *k1, void *k2);
 uint32_t zap_hash_hashfromstring(void *ky);
 uint32_t zap_running(void);
 
+
 ZIO_CODEC_FUNCTION(zio_slin2ulaw);
 ZIO_CODEC_FUNCTION(zio_ulaw2slin);
 ZIO_CODEC_FUNCTION(zio_slin2alaw);
index c560eade9c3ac96d99744f0f7051beb92e4d85b1..a53d5ab7e646a31581d038bd57870804c166ce87 100644 (file)
@@ -38,7 +38,6 @@
 struct tm * localtime_r(const time_t *clock, struct tm *result);
 #endif
 
-
 static void *zap_analog_channel_run(zap_thread_t *me, void *obj);
 
 static ZIO_CHANNEL_OUTGOING_CALL_FUNCTION(analog_fxo_outgoing_call)
@@ -485,9 +484,10 @@ static void *zap_analog_channel_run(zap_thread_t *me, void *obj)
                        }
                }
 
-               if ((dlen = zap_channel_dequeue_dtmf(zchan, dtmf + dtmf_offset, sizeof(dtmf) - strlen(dtmf)))) {
-                       if (zchan->state == ZAP_CHANNEL_STATE_DIALTONE || zchan->state == ZAP_CHANNEL_STATE_COLLECT) {
-                               zap_log(ZAP_LOG_DEBUG, "DTMF %s\n", dtmf + dtmf_offset);
+
+               if (zchan->state == ZAP_CHANNEL_STATE_DIALTONE || zchan->state == ZAP_CHANNEL_STATE_COLLECT) {
+                       if ((dlen = zap_channel_dequeue_dtmf(zchan, dtmf + dtmf_offset, sizeof(dtmf) - strlen(dtmf)))) {
+
                                if (zchan->state == ZAP_CHANNEL_STATE_DIALTONE) {
                                        zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_COLLECT);
                                        collecting = 1;
@@ -786,7 +786,6 @@ static void *zap_analog_run(zap_thread_t *me, void *obj)
 }
 
 
-
 zap_status_t zap_analog_start(zap_span_t *span)
 {
        zap_analog_data_t *analog_data = span->signal_data;
index 8703db8994ca38c39a3645a1e26d426949877a33..4f18f971d7649ccc38a7da3f0275288af6c09b80 100644 (file)
@@ -1412,7 +1412,11 @@ zap_size_t zap_channel_dequeue_dtmf(zap_channel_t *zchan, char *dtmf, zap_size_t
 
        assert(zchan != NULL);
 
-       if (zap_buffer_inuse(zchan->digit_buffer)) {
+       if (!zap_test_flag(zchan, ZAP_CHANNEL_READY)) {
+               return ZAP_FAIL;
+       }
+
+       if (zchan->digit_buffer && zap_buffer_inuse(zchan->digit_buffer)) {
                zap_mutex_lock(zchan->mutex);
                if ((bytes = zap_buffer_read(zchan->digit_buffer, dtmf, len)) > 0) {
                        *(dtmf + bytes) = '\0';
@@ -1608,7 +1612,6 @@ zap_status_t zap_channel_read(zap_channel_t *zchan, void *data, zap_size_t *data
                }
 
                if (zap_test_flag(zchan, ZAP_CHANNEL_DTMF_DETECT)) {
-
                        teletone_dtmf_detect(&zchan->dtmf_detect, sln, (int)slen);
                        teletone_dtmf_get(&zchan->dtmf_detect, digit_str, sizeof(digit_str));
 
@@ -1987,7 +1990,7 @@ zap_status_t zap_global_destroy(void)
        
        zap_span_close_all();
        globals.running = 0;
-       zap_sleep(200);
+       zap_sleep(1000);
 
        for(i = 1; i <= globals.span_index; i++) {
                zap_span_t *cur_span = &globals.spans[i];