]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
OPENZAP-99
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 18 Feb 2010 18:55:03 +0000 (18:55 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 18 Feb 2010 18:55:03 +0000 (18:55 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@1036 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/openzap/mod_openzap/mod_openzap.c
libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c
libs/openzap/src/zap_io.c

index 958d327365b8fadf783b50dfe2a3f5f6258f99b1..f542908f33fdff12d5d37f21751165beeb52a63b 100644 (file)
@@ -675,7 +675,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
                tech_pvt->read_frame.samples /= 2;
        }
 
-       if (zap_channel_dequeue_dtmf(tech_pvt->zchan, dtmf, sizeof(dtmf))) {
+       while (zap_channel_dequeue_dtmf(tech_pvt->zchan, dtmf, sizeof(dtmf))) {
                switch_dtmf_t _dtmf = { 0, SWITCH_DEFAULT_DTMF_DURATION };
                char *p;
                for (p = dtmf; p && *p; p++) {
@@ -737,10 +737,11 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
 
 
        wflags = ZAP_WRITE;     
-       status = zap_channel_wait(tech_pvt->zchan, &wflags, tech_pvt->zchan->effective_interval * 4);
+       status = zap_channel_wait(tech_pvt->zchan, &wflags, tech_pvt->zchan->effective_interval * 10);
        
        if (!(wflags & ZAP_WRITE)) {
-               goto fail;
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Dropping frame! (write not ready)\n");
+               return SWITCH_STATUS_SUCCESS;
        }
 
        len = frame->datalen;
index 0ef2e0228776a635f3148faca9a46f56cb9d3572..dcf55826c3b1a18aa752c241036b039c586b4e12 100644 (file)
@@ -486,6 +486,8 @@ static ZIO_OPEN_FUNCTION(wanpipe_open)
        wanpipe_tdm_api_t tdm_api;
 
        memset(&tdm_api,0,sizeof(tdm_api));
+       sangoma_flush_bufs(zchan->sockfd, &tdm_api);
+       sangoma_flush_event_bufs(zchan->sockfd, &tdm_api);
 
        if (zchan->type == ZAP_CHAN_TYPE_DQ921 || zchan->type == ZAP_CHAN_TYPE_DQ931) {
                zchan->native_codec = zchan->effective_codec = ZAP_CODEC_NONE;
@@ -1018,14 +1020,17 @@ ZIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_next_event)
                     char tmp_dtmf[2] = { tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_digit, 0 };
                                        event_id = ZAP_OOB_NOOP;
 
-                                       //zap_log(ZAP_LOG_DEBUG, "%d:%d queue hardware dtmf %s\n", zchan->span_id, zchan->chan_id, tmp_dtmf);
+                                       //zap_log(ZAP_LOG_WARNING, "%d:%d queue hardware dtmf %s %s\n", zchan->span_id, zchan->chan_id, tmp_dtmf, 
+                                                       //tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_PRESENT ? "on" : "off");
                     if (tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_PRESENT) {
                                                zap_set_flag_locked(zchan, ZAP_CHANNEL_MUTE);
                                        }
 
                     if (tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_STOP) {
                                                zap_clear_flag_locked(zchan, ZAP_CHANNEL_MUTE);
-                        zap_channel_queue_dtmf(zchan, tmp_dtmf);
+                                               if (zap_test_flag(zchan, ZAP_CHANNEL_INUSE)) {
+                                                       zap_channel_queue_dtmf(zchan, tmp_dtmf);
+                                               }
                     } 
                 }
                 break;
index 40446218252e2dd0adb746fd78cbf268b81f9616..92ec4419e89b3b88d35d10770b0e72bf16129010 100644 (file)
@@ -1225,9 +1225,7 @@ OZ_DECLARE(zap_status_t) zap_channel_done(zap_channel_t *zchan)
        zchan->pre_buffer_size = 0;
        zap_mutex_unlock(zchan->pre_buffer_mutex);
 
-       if (zchan->dtmf_buffer) {
-               zap_buffer_zero(zchan->dtmf_buffer);
-       }
+       zap_channel_flush_dtmf(zchan);
 
        zchan->init_state = ZAP_CHANNEL_STATE_DOWN;
        zchan->state = ZAP_CHANNEL_STATE_DOWN;