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

Freeswitch SVN brian at freeswitch.org
Sat Sep 27 04:52:14 EDT 2008


Author: brian
Date: Sat Sep 27 04:52:13 2008
New Revision: 9677

Modified:
   freeswitch/trunk/src/switch_ivr_async.c

Log:
round one from FSCORE-193, we need to revisit this for improvement

Modified: freeswitch/trunk/src/switch_ivr_async.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_async.c	(original)
+++ freeswitch/trunk/src/switch_ivr_async.c	Sat Sep 27 04:52:13 2008
@@ -340,6 +340,13 @@
 	switch_status_t status;
 	time_t to = 0;
 	displace_helper_t *dh;
+	
+	status = switch_channel_pre_answer(channel);
+
+	if (!switch_channel_media_ready(channel) || !switch_core_session_get_read_codec(session)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can not displace session.  Media not enabled on channel\n");
+		return status;
+	}
 
 	if ((bug = switch_channel_get_private(channel, file))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Only 1 of the same file per channel please!\n");
@@ -803,7 +810,16 @@
 	switch_status_t status;
 	time_t to = 0;
 	switch_media_bug_flag_t flags = SMBF_READ_STREAM | SMBF_WRITE_STREAM;
-	uint8_t channels = read_codec->implementation->number_of_channels;
+	uint8_t channels;
+
+	status = switch_channel_pre_answer(channel);
+
+	if (!switch_channel_media_ready(channel) || !switch_core_session_get_read_codec(session)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can not record session.  Media not enabled on channel\n");
+		return status;
+	}
+
+	channels = read_codec->implementation->number_of_channels;
 
 	if ((bug = switch_channel_get_private(channel, file))) {
 		return switch_ivr_stop_record_session(session, file);
@@ -838,8 +854,6 @@
 		return SWITCH_STATUS_GENERR;
 	}
 
-	switch_channel_pre_answer(channel);
-
 	if ((p = switch_channel_get_variable(channel, "RECORD_TITLE"))) {
 		vval = (const char *) switch_core_session_strdup(session, p);
 		switch_core_file_set_string(fh, SWITCH_AUDIO_COL_STR_TITLE, vval);



More information about the Freeswitch-svn mailing list