Revision
15386
Author
anthm
Date
2009-11-06 10:11:26 -0600 (Fri, 06 Nov 2009)

Log Message

get exported vars in originate thx moc

Modified Paths

Diff

Modified: freeswitch/trunk/src/switch_core_session.c (15385 => 15386)


--- freeswitch/trunk/src/switch_core_session.c	2009-11-06 16:00:56 UTC (rev 15385)
+++ freeswitch/trunk/src/switch_core_session.c	2009-11-06 16:11:26 UTC (rev 15386)
@@ -447,7 +447,7 @@
 		}
 		
 		if (channel) {
-			const char *export_vars, *val;
+			const char *val;
 			switch_codec_t *vid_read_codec = NULL, *read_codec = switch_core_session_get_read_codec(session);
 			const char *max_forwards = switch_core_session_sprintf(session, "%d", forwardval);
 
@@ -475,28 +475,6 @@
 			switch_channel_set_variable(peer_channel, SWITCH_SIGNAL_BOND_VARIABLE, switch_core_session_get_uuid(session));
 			switch_channel_set_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE, switch_core_session_get_uuid(*new_session));
 
-			/* A comma (,) separated list of variable names that should ne propagated from originator to originatee */
-			if ((export_vars = switch_channel_get_variable(channel, SWITCH_EXPORT_VARS_VARIABLE))) {
-				char *cptmp = switch_core_session_strdup(session, export_vars);
-				int argc;
-				char *argv[256];
-
-				if ((argc = switch_separate_string(cptmp, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
-					int x;
-
-					for (x = 0; x < argc; x++) {
-						const char *vval;
-						if ((vval = switch_channel_get_variable(channel, argv[x]))) {
-							char *vvar = argv[x];
-							if (!strncasecmp(vvar, "nolocal:", 8)) {
-								vvar += 8;
-							}
-							switch_channel_set_variable(peer_channel, vvar, vval);
-						}
-					}
-				}
-			}
-
 			if ((val = switch_channel_get_variable(channel, SWITCH_PROCESS_CDR_VARIABLE))) {
 				switch_channel_set_variable(peer_channel, SWITCH_PROCESS_CDR_VARIABLE, val);
 			}

Modified: freeswitch/trunk/src/switch_ivr_originate.c (15385 => 15386)


--- freeswitch/trunk/src/switch_ivr_originate.c	2009-11-06 16:00:56 UTC (rev 15385)
+++ freeswitch/trunk/src/switch_ivr_originate.c	2009-11-06 16:11:26 UTC (rev 15386)
@@ -1193,6 +1193,7 @@
 	int local_clobber = 0;
 	const char *cancel_key = NULL;
 	const char *holding = NULL;
+	const char *export_vars = NULL;
 
 	oglobals.ringback_ok = 1;
 
@@ -1322,6 +1323,29 @@
 		}
 	}
 
+	/* A comma (,) separated list of variable names that should ne propagated from originator to originatee */
+	if ((export_vars = switch_channel_get_variable(caller_channel, SWITCH_EXPORT_VARS_VARIABLE))) {
+		char *cptmp = switch_core_session_strdup(session, export_vars);
+		int argc;
+		char *argv[256];
+
+		if ((argc = switch_separate_string(cptmp, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+			int x;
+
+			for (x = 0; x < argc; x++) {
+				const char *vval;
+				if ((vval = switch_channel_get_variable(caller_channel, argv[x]))) {
+					char *vvar = argv[x];
+					if (!strncasecmp(vvar, "nolocal:", 8)) {
+						vvar += 8;
+					}
+					switch_event_del_header(var_event, vvar);
+					switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, vvar, vval);
+				}
+			}
+		}
+	}
+
 	if (vars) {					/* Parse parameters specified from the dialstring */
 		char *var_array[1024] = { 0 };
 		int var_count = 0;