[svn-commits] elguero: trunk r419252 - in /trunk: CHANGES main/bridge_channel.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jul 22 15:22:39 CDT 2014


Author: elguero
Date: Tue Jul 22 15:22:36 2014
New Revision: 419252

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=419252
Log:
core/bridge_channel: Substitute Variables In Features Application Map

Say you wanted to include variables in an application map and have those
variables substituted and passed along to the application being executed;
currently this does not happen.

This patch adds this ability to pass channel variable values to an
application before being executed.

ASTERISK-22608 #close
Reported by: Michael L. Young
patches:
  features_substitute_arguments_v2.diff
                                     uploaded by Michael L. Young (license 5026)

Review: https://reviewboard.asterisk.org/r/3819/

Modified:
    trunk/CHANGES
    trunk/main/bridge_channel.c

Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=419252&r1=419251&r2=419252
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Tue Jul 22 15:22:36 2014
@@ -136,6 +136,9 @@
    available to a channel when the channel is bridged. Previously, these
    features were provided exclusively by the caller of ast_bridge_join()
    outside of "basic" type bridges.
+
+ * Channel variables are now substituted in arguments passed to applications
+   run by using dynamic features.
 
 JACK_HOOK
 ------------------

Modified: trunk/main/bridge_channel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/bridge_channel.c?view=diff&rev=419252&r1=419251&r2=419252
==============================================================================
--- trunk/main/bridge_channel.c (original)
+++ trunk/main/bridge_channel.c Tue Jul 22 15:22:36 2014
@@ -1020,7 +1020,16 @@
 		if (!app) {
 			ast_log(LOG_WARNING, "Could not find application (%s)\n", app_name);
 		} else {
-			res = pbx_exec(chan, app, app_args);
+			struct ast_str *substituted_args = ast_str_create(16);
+
+			if (substituted_args) {
+				ast_str_substitute_variables(&substituted_args, 0, chan, app_args);
+				res = pbx_exec(chan, app, ast_str_buffer(substituted_args));
+				ast_free(substituted_args);
+			} else {
+				ast_log(LOG_WARNING, "Could not substitute application argument variables for %s\n", app_name);
+				res = pbx_exec(chan, app, app_args);
+			}
 		}
 	}
 	return res;




More information about the svn-commits mailing list