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

FreeSWITCH SVN anthm at freeswitch.org
Tue Jan 20 07:39:32 PST 2009


Author: anthm
Date: Tue Jan 20 09:39:32 2009
New Revision: 11309

Log:
add ignore_ring_ready tone_detect_sleep and tone_detect_expires

Modified:
   freeswitch/trunk/src/switch_ivr_async.c
   freeswitch/trunk/src/switch_ivr_originate.c

Modified: freeswitch/trunk/src/switch_ivr_async.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_async.c	(original)
+++ freeswitch/trunk/src/switch_ivr_async.c	Tue Jan 20 09:39:32 2009
@@ -1197,6 +1197,8 @@
 	int hits;
 	int sleep;
 	int expires;
+	int default_sleep;
+	int default_expires;
 	int once;
 	switch_tone_detect_callback_t callback;
 } switch_tone_detect_t;
@@ -1261,8 +1263,8 @@
 					
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "TONE %s HIT %d/%d\n", 
 									  cont->list[i].key, cont->list[i].hits, cont->list[i].total_hits);
-					cont->list[i].sleep = 50;
-					cont->list[i].expires = 250;
+					cont->list[i].sleep = cont->list[i].default_sleep;
+					cont->list[i].expires = cont->list[i].default_expires;
 					
 					if (cont->list[i].hits >= cont->list[i].total_hits) {
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "TONE %s DETECTED\n", cont->list[i].key);
@@ -1335,6 +1337,7 @@
 	char *p, *next;
 	int i = 0, ok = 0;
 	switch_media_bug_flag_t bflags = 0;
+	const char *var;
 
 	switch_assert(read_codec != NULL);
 
@@ -1419,6 +1422,24 @@
 
 	switch_channel_pre_answer(channel);
 
+	cont->list[cont->index].default_sleep = 25;
+	cont->list[cont->index].default_expires = 250;
+
+	if ((var = switch_channel_get_variable(channel, "tone_detect_sleep"))) {
+		int tmp = atoi(var);
+		if (tmp > 0) {
+			cont->list[cont->index].default_sleep = tmp;
+		}
+	}
+
+	if ((var = switch_channel_get_variable(channel, "tone_detect_expires"))) {
+		int tmp = atoi(var);
+		if (tmp > 0) {
+			cont->list[cont->index].default_expires = tmp;
+		}
+	}
+
+
 	if (switch_strlen_zero(flags)) {
 		bflags = SMBF_READ_REPLACE;
 	} else {

Modified: freeswitch/trunk/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_originate.c	(original)
+++ freeswitch/trunk/src/switch_ivr_originate.c	Tue Jan 20 09:39:32 2009
@@ -82,7 +82,6 @@
 	uint8_t ring_ready;
 	uint8_t early_media;
 	uint8_t answered;
-	uint8_t dead;
 	uint32_t per_channel_timelimit_sec;
 	uint32_t per_channel_progress_timelimit_sec;
 } originate_status_t;
@@ -101,6 +100,9 @@
 	uint8_t return_ring_ready;
 	uint8_t monitor_early_media_ring;
 	uint8_t monitor_early_media_fail;
+	uint8_t gen_ringback;
+	uint8_t ignore_early_media;
+	uint8_t ignore_ring_ready;
 } originate_global_t;
 
 
@@ -257,11 +259,13 @@
 					oglobals->progress = 1;
 				}
 			
-				if (!oglobals->ring_ready) {
+				if (!oglobals->ring_ready && !oglobals->ignore_ring_ready) {
 					oglobals->ring_ready = 1;
 				}
-
-				oglobals->early_ok = 1;
+				
+				if (!oglobals->ignore_early_media && !oglobals->early_ok) {
+					oglobals->early_ok = 1;
+				}
 			}
 		}
 	}
@@ -417,14 +421,14 @@
 					}
 				}
 			}
-
+			
 			if (!oglobals->monitor_early_media_ring) {
 
 				if (!oglobals->progress) {
 					oglobals->progress = 1;
 				}
 			
-				if (!oglobals->ring_ready) {
+				if (!oglobals->ring_ready && !oglobals->ignore_ring_ready) {
 					oglobals->ring_ready = 1;
 				}
 			}
@@ -965,6 +969,8 @@
 					ok = 1;
 				} else if (!strcasecmp((char *) hi->name, "ignore_early_media")) {
 					ok = 1;
+				} else if (!strcasecmp((char *) hi->name, "ignore_ring_ready")) {
+					ok = 1;
 				} else if (!strcasecmp((char *) hi->name, "monitor_early_media_ring")) {
 					ok = 1;
 				} else if (!strcasecmp((char *) hi->name, "monitor_early_media_fail")) {
@@ -1079,6 +1085,11 @@
 
 	if ((var_val = switch_event_get_header(var_event, "ignore_early_media")) && switch_true(var_val)) {
 		oglobals.early_ok = 0;
+		oglobals.ignore_early_media = 1;
+	}
+
+	if ((var_val = switch_event_get_header(var_event, "ignore_ring_ready")) && switch_true(var_val)) {
+		oglobals.ignore_ring_ready = 1;
 	}
 
 	if ((var_val = switch_event_get_header(var_event, "monitor_early_media_ring"))) {
@@ -1553,7 +1564,8 @@
 						if (ringback_data) {
 							char *tmp_data = NULL;
 
-							
+							oglobals.gen_ringback = 1;
+
 							if (switch_is_file_path(ringback_data)) {
 								char *ext;
 



More information about the Freeswitch-svn mailing list