]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FSCORE-510
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 11 Dec 2009 04:18:10 +0000 (04:18 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 11 Dec 2009 04:18:10 +0000 (04:18 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15902 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/sofia_glue.c
src/switch_ivr_async.c

index 2c5fd2a88b0ede550356a436559e13f489a1b6e9..5c6ec817f105cb4b8afaeb90f1df0e20d3f173ea 100644 (file)
@@ -2069,7 +2069,7 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force)
                }
                if (strcasecmp(tech_pvt->read_impl.iananame, tech_pvt->iananame) ||
                        tech_pvt->read_impl.samples_per_second != tech_pvt->rm_rate ||
-                       tech_pvt->codec_ms != tech_pvt->read_impl.microseconds_per_packet) {
+                       tech_pvt->codec_ms != tech_pvt->read_impl.microseconds_per_packet / 1000) {
                        
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Changing Codec from %s@%dms to %s@%dms\n",
                                                          tech_pvt->read_impl.iananame, tech_pvt->read_impl.microseconds_per_packet / 1000, 
@@ -2161,6 +2161,8 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force)
 
  end:
        if (resetting) {
+               switch_core_session_set_read_codec(tech_pvt->session, &tech_pvt->read_codec);
+               switch_core_session_set_write_codec(tech_pvt->session, &tech_pvt->write_codec);
                switch_core_session_unlock_codec_write(tech_pvt->session);
                switch_core_session_unlock_codec_read(tech_pvt->session);
        }
index 5b5e49fc43bd0b8819b896aceae9bbe71a298000..955cd1193efd691bd4b5bb21f1f22e0da430877a 100644 (file)
@@ -1554,7 +1554,7 @@ static switch_bool_t inband_dtmf_generate_callback(switch_media_bug_t *bug, void
                        }
 
                        if (!switch_buffer_inuse(pvt->audio_buffer)) {
-                               while (switch_queue_trypop(pvt->digit_queue, &pop) == SWITCH_STATUS_SUCCESS) {
+                               if (switch_queue_trypop(pvt->digit_queue, &pop) == SWITCH_STATUS_SUCCESS) {
                                        switch_dtmf_t *dtmf = (switch_dtmf_t *) pop;
                                        char buf[2] = "";
                                        int duration = dtmf->duration;
@@ -1562,14 +1562,17 @@ static switch_bool_t inband_dtmf_generate_callback(switch_media_bug_t *bug, void
                                        buf[0] = dtmf->digit;
                                        if (duration > 8000) {
                                                duration = 4000;
-                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_WARNING, "%s Truncating ridiculous DTMF duration %d ms to 1/2 second.\n",
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), 
+                                                                                 SWITCH_LOG_WARNING, "%s Truncating ridiculous DTMF duration %d ms to 1/2 second.\n",
                                                                                  switch_channel_get_name(switch_core_session_get_channel(pvt->session)), dtmf->duration / 8);
                                        }
                                        pvt->ts.duration = duration;
                                        teletone_run(&pvt->ts, buf);
                                        free(pop);
                                }
-                       } else if (switch_buffer_inuse(pvt->audio_buffer) && (bytes = switch_buffer_read(pvt->audio_buffer, frame->data, frame->datalen))) {
+                       }
+
+                       if (switch_buffer_inuse(pvt->audio_buffer) && (bytes = switch_buffer_read(pvt->audio_buffer, frame->data, frame->datalen))) {
                                if (bytes < frame->datalen) {
                                        switch_byte_t *dp = frame->data;
                                        memset(dp + bytes, 0, frame->datalen - bytes);
@@ -1581,6 +1584,7 @@ static switch_bool_t inband_dtmf_generate_callback(switch_media_bug_t *bug, void
                        } else {
                                switch_core_media_bug_set_write_replace_frame(bug, frame);
                        }
+
                        switch_mutex_unlock(pvt->mutex);
                }
                break;