Modifying the behaviour of the dialplan engine

the 'data' field in action tags may now refer to variables and api functions
to be expanded at runtime.

Syntax:

$varname
${varname}
&func_name(func args)


Exception:
variables that are numeric are still expanded at dialplan compile time based on the regex eg $1 $2 etc

Example:

<extension name="1000">
  <condition field="destination_number" expression="^(1000)$">
    <action appplication="my_route_app" data="$1"/>
    <action appplication="bridge" data="$destination"/>
  </condition>
</extension>

Here the $1 is ecaluated before the call begins setting it to 1000 based on the regex ^(1000)$
$destination is evaluated on the fly in execution once the my_route_app has run and has had a 
chance to set the variable 'destination' to the correct value.



git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2994 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2006-10-07 19:54:04 +00:00
parent 4ede7f7593
commit 741b8329b9
6 changed files with 150 additions and 8 deletions
+8
View File
@@ -400,6 +400,14 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_name_state(char *name);
*/
SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel_t *channel, switch_event_t *event);
/*!
\brief Expand varaibles in a string based on the variables in a paticular channel
\param channel channel to expand the variables from
\param in the original string
\return the original string if no expansion takes place otherwise a new string that must be freed
\note it's necessary to test if the return val is the same as the input and free the string if it is not.
*/
SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel, char *in);
// These may go away
SWITCH_DECLARE(switch_status_t) switch_channel_set_raw_mode (switch_channel_t *channel, int freq, int bits, int channels, int ms, int kbps);