Revision
14247
Author
anthm
Date
2009-07-14 12:19:14 -0500 (Tue, 14 Jul 2009)

Log Message

group_confirm_cancel_timeout=true to stop timers once a group_confirm is triggered LIST-001 RAY-007 IRC-1234

Modified Paths

Diff

Modified: freeswitch/trunk/src/switch_ivr_originate.c (14246 => 14247)


--- freeswitch/trunk/src/switch_ivr_originate.c	2009-07-14 16:15:50 UTC (rev 14246)
+++ freeswitch/trunk/src/switch_ivr_originate.c	2009-07-14 17:19:14 UTC (rev 14247)
@@ -109,6 +109,7 @@
 	uint8_t ignore_ring_ready;
 	int monitor_early_media_ring_count;
 	int monitor_early_media_ring_total;
+	int cancel_timeout;
 } originate_global_t;
 
 
@@ -228,6 +229,10 @@
 	int x = 0,i;
 	time_t elapsed = switch_epoch_time_now(NULL) - start;
 
+	if (oglobals->cancel_timeout > 0) {
+		return 0;
+	}
+
 	for (i = 0; i < max; i++) {
 		if (originate_status[i].peer_channel && originate_status[i].per_channel_delay_start && elapsed > originate_status[i].per_channel_delay_start) {
 			switch_channel_clear_flag(originate_status[i].peer_channel, CF_BLOCK_STATE);
@@ -508,6 +513,10 @@
 			if (!switch_strlen_zero(oglobals->key)) {
 				struct key_collect *collect;
 
+				if (oglobals->cancel_timeout < 0) {
+					oglobals->cancel_timeout = 1;
+				}
+
 				if ((collect = switch_core_session_alloc(originate_status[i].peer_session, sizeof(*collect)))) {
 					switch_channel_set_flag(originate_status[i].peer_channel, CF_TAGGED);
 					if (!switch_strlen_zero(oglobals->key)) {
@@ -1047,6 +1056,8 @@
 					ok = 1;
 				} else if (!strcasecmp((char *) hi->name, "group_confirm_file")) {
 					ok = 1;
+				} else if (!strcasecmp((char *) hi->name, "group_confirm_clear_timeout")) {
+					ok = 1;
 				} else if (!strcasecmp((char *) hi->name, "forked_dial")) {
 					ok = 1;
 				} else if (!strcasecmp((char *) hi->name, "fail_on_single_reject")) {
@@ -1123,6 +1134,10 @@
 		oglobals.early_ok = 0;
 	}
 
+	if (switch_true(switch_event_get_header(var_event, "group_confirm_cancel_timeout"))) {
+		oglobals.cancel_timeout = -1;
+	}
+
 	if ((var = switch_event_get_header(var_event, "group_confirm_key"))) {
 		switch_copy_string(oglobals.key, var, sizeof(oglobals.key));
 		if ((var = switch_event_get_header(var_event, "group_confirm_file"))) {