[Freeswitch-svn] [commit] r7528 - freeswitch/trunk/src

Freeswitch SVN mikej at freeswitch.org
Tue Feb 5 12:33:34 EST 2008


Author: mikej
Date: Tue Feb  5 12:33:34 2008
New Revision: 7528

Modified:
   freeswitch/trunk/src/switch_ivr_async.c

Log:
tweak error checking.

Modified: freeswitch/trunk/src/switch_ivr_async.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_async.c	(original)
+++ freeswitch/trunk/src/switch_ivr_async.c	Tue Feb  5 12:33:34 2008
@@ -965,21 +965,15 @@
 SWITCH_DECLARE(switch_status_t) switch_ivr_inband_dtmf_generate_session(switch_core_session_t *session, switch_bool_t read_stream)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	switch_codec_t *read_codec;
 	switch_media_bug_t *bug;
 	switch_status_t status;
 	switch_inband_dtmf_generate_t *pvt;
 
-	if ((status = switch_channel_pre_answer(channel)) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can not install inband dtmf generate.  Failed to pre_answer session!\n");
-		return status;
-	}
-
-	read_codec = switch_core_session_get_read_codec(session);
+	status = switch_channel_pre_answer(channel);
 
-	if (!read_codec) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can not install inband dtmf generate.  No read codec.!\n");
-		return SWITCH_STATUS_FALSE;
+	if (!switch_channel_media_ready(channel) || !switch_core_session_get_read_codec(session)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can not install inband dtmf generate.  Media not enabled on channel\n");
+		return status;
 	}
 
 	if (!(pvt = switch_core_session_alloc(session, sizeof(*pvt)))) {



More information about the Freeswitch-svn mailing list