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

FreeSWITCH SVN anthm at freeswitch.org
Fri Jan 30 15:08:55 PST 2009


Author: anthm
Date: Fri Jan 30 17:08:55 2009
New Revision: 11569

Log:
move var expansion deeper into the core for executing app

Modified:
   freeswitch/trunk/src/switch_core_session.c

Modified: freeswitch/trunk/src/switch_core_session.c
==============================================================================
--- freeswitch/trunk/src/switch_core_session.c	(original)
+++ freeswitch/trunk/src/switch_core_session.c	Fri Jan 30 17:08:55 2009
@@ -1225,7 +1225,6 @@
 {
 	switch_application_interface_t *application_interface;
 	char *expanded = NULL;
-	const char *var;
 
 	if ((application_interface = switch_loadable_module_get_application_interface(app)) == 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Application %s\n", app);
@@ -1253,6 +1252,27 @@
 		}
 	}
 
+	switch_core_session_exec(session, application_interface, expanded);
+
+	UNPROTECT_INTERFACE(application_interface);
+	
+	return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t *session,
+														 const switch_application_interface_t *application_interface, const char *arg)
+{
+	switch_app_log_t *log, *lp;
+	switch_event_t *event;
+	const char *var;
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	char *expanded = NULL;
+	const char *app;
+
+	switch_assert(application_interface);
+
+	app = application_interface->interface_name;
+	
 	if (arg && (expanded = switch_channel_expand_variables(session->channel, arg)) != arg) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Expanded String %s(%s)\n", switch_channel_get_name(session->channel), app, expanded);
 	}
@@ -1272,25 +1292,6 @@
 		}
 	}
 
-	switch_core_session_exec(session, application_interface, expanded);
-
-	if (expanded != arg) {
-		switch_safe_free(expanded);
-	}
-
-	UNPROTECT_INTERFACE(application_interface);
-	
-	return SWITCH_STATUS_SUCCESS;
-}
-
-SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t *session,
-														 const switch_application_interface_t *application_interface, const char *arg)
-{
-	switch_app_log_t *log, *lp;
-	switch_event_t *event;
-	const char *var;
-	switch_channel_t *channel = switch_core_session_get_channel(session);
-
 	if (!arg) {
 		arg = "";
 	}
@@ -1327,7 +1328,7 @@
 
 	switch_channel_set_variable(session->channel, SWITCH_CURRENT_APPLICATION_VARIABLE, application_interface->interface_name);
 
-	application_interface->application_function(session, arg);
+	application_interface->application_function(session, expanded);
 	
 	if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE) == SWITCH_STATUS_SUCCESS) {
 		const char *resp = switch_channel_get_variable(session->channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE);
@@ -1338,6 +1339,10 @@
 		switch_event_fire(&event);
 	}
 
+	if (expanded != arg) {
+		switch_safe_free(expanded);
+	}
+	
 	return SWITCH_STATUS_SUCCESS;
 }
 



More information about the Freeswitch-svn mailing list