[Freeswitch-trunk] [commit] r13842 - freeswitch/trunk/src

FreeSWITCH SVN anthm at freeswitch.org
Thu Jun 18 09:35:41 PDT 2009


Author: anthm
Date: Thu Jun 18 11:35:41 2009
New Revision: 13842

Log:
add local_var_clobber variable for {} to set if [] vars should clobber {} vars (default false)

Modified:
   freeswitch/trunk/src/switch_ivr_originate.c

Modified: freeswitch/trunk/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_originate.c	(original)
+++ freeswitch/trunk/src/switch_ivr_originate.c	Thu Jun 18 11:35:41 2009
@@ -916,10 +916,11 @@
 	char *fail_on_single_reject_var = NULL;
 	char *loop_data = NULL;
 	uint32_t progress_timelimit_sec = 0;
-	const char *cid_tmp;
+	const char *cid_tmp, *lc;
 	originate_global_t oglobals = { 0 };
 	int cdr_total = 0;
-
+	int local_clobber = 0;
+	
 	oglobals.idx = IDX_NADA;
 	oglobals.early_ok = 1;
 	oglobals.session = session;
@@ -1511,6 +1512,25 @@
 				originate_status[i].peer_channel = switch_core_session_get_channel(new_session);
 				switch_channel_set_flag(originate_status[i].peer_channel, CF_ORIGINATING);
 
+				if ((lc = switch_event_get_header(var_event, "local_var_clobber"))) {
+					local_clobber = switch_true(lc);
+				}
+
+				if (!local_clobber) {
+					if (var_event) {
+						switch_event_t *event;
+						switch_event_header_t *header;
+						/* install the vars from the {} params */
+						for (header = var_event->headers; header; header = header->next) {
+							switch_channel_set_variable(originate_status[i].peer_channel, header->name, header->value);
+						}
+						switch_event_create(&event, SWITCH_EVENT_CHANNEL_ORIGINATE);
+						switch_assert(event);
+						switch_channel_event_set_data(originate_status[i].peer_channel, event);
+						switch_event_fire(&event);
+					}
+				}
+
 				if (vdata) {
 					char *var_array[1024] = { 0 };
 					int var_count = 0;
@@ -1529,17 +1549,19 @@
 					}
 				}
 
-				if (var_event) {
-					switch_event_t *event;
-					switch_event_header_t *header;
-					/* install the vars from the {} params */
-					for (header = var_event->headers; header; header = header->next) {
-						switch_channel_set_variable(originate_status[i].peer_channel, header->name, header->value);
-					}
-					switch_event_create(&event, SWITCH_EVENT_CHANNEL_ORIGINATE);
-					switch_assert(event);
-					switch_channel_event_set_data(originate_status[i].peer_channel, event);
-					switch_event_fire(&event);
+				if (local_clobber) {
+					if (var_event) {
+						switch_event_t *event;
+						switch_event_header_t *header;
+						/* install the vars from the {} params */
+						for (header = var_event->headers; header; header = header->next) {
+							switch_channel_set_variable(originate_status[i].peer_channel, header->name, header->value);
+						}
+						switch_event_create(&event, SWITCH_EVENT_CHANNEL_ORIGINATE);
+						switch_assert(event);
+						switch_channel_event_set_data(originate_status[i].peer_channel, event);
+						switch_event_fire(&event);
+					}
 				}
 
 				if (originate_status[i].peer_channel) {



More information about the Freeswitch-trunk mailing list