Revision
15902
Author
anthm
Date
2009-12-10 22:18:10 -0600 (Thu, 10 Dec 2009)

Log Message

FSCORE-510

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (15901 => 15902)


--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	2009-12-11 04:05:27 UTC (rev 15901)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	2009-12-11 04:18:10 UTC (rev 15902)
@@ -2069,7 +2069,7 @@
 		}
 		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 @@
 
  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);
 	}

Modified: freeswitch/trunk/src/switch_ivr_async.c (15901 => 15902)


--- freeswitch/trunk/src/switch_ivr_async.c	2009-12-11 04:05:27 UTC (rev 15901)
+++ freeswitch/trunk/src/switch_ivr_async.c	2009-12-11 04:18:10 UTC (rev 15902)
@@ -1554,7 +1554,7 @@
 			}
 
 			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 @@
 					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 @@
 			} else {
 				switch_core_media_bug_set_write_replace_frame(bug, frame);
 			}
+
 			switch_mutex_unlock(pvt->mutex);
 		}
 		break;