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

Freeswitch SVN mikej at freeswitch.org
Tue Feb 5 10:50:50 EST 2008


Author: mikej
Date: Tue Feb  5 10:50:49 2008
New Revision: 7522

Modified:
   freeswitch/trunk/src/switch_ivr_async.c

Log:
pre-answer first!

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 10:50:49 2008
@@ -970,7 +970,15 @@
 	switch_status_t status;
 	switch_inband_dtmf_generate_t *pvt;
 
-	switch_assert(read_codec != NULL);
+	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;
+	}
+
+	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 (!(pvt = switch_core_session_alloc(session, sizeof(*pvt)))) {
 		return SWITCH_STATUS_MEMERR;
@@ -978,7 +986,6 @@
 
 	pvt->session = session;
 	pvt->read = !!read_stream;
-	switch_channel_pre_answer(channel);
 
 	if ((status = switch_core_media_bug_add(session, inband_dtmf_generate_callback, pvt, 0, 
 											pvt->read ? SMBF_READ_REPLACE : SMBF_WRITE_REPLACE, &bug)) != SWITCH_STATUS_SUCCESS) {



More information about the Freeswitch-svn mailing list