mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-29 14:44:17 +00:00
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:
1 parent
4ede7f7593
commit
741b8329b9
6 files changed
+150
-8
No files matched your search
@@ -174,17 +174,16 @@ static int parse_exten(switch_core_session_t *session, switch_xml_t xexten, swit
|
||||
char *cmd = switch_core_session_strdup(session, field + 1);
|
||||
char *arg;
|
||||
|
||||
SWITCH_STANDARD_STREAM(stream);
|
||||
|
||||
if (cmd) {
|
||||
if ((arg = strchr(cmd, ' '))) {
|
||||
*arg++ = '\0';
|
||||
}
|
||||
stream.data = retbuf;
|
||||
stream.end = stream.data;
|
||||
stream.data_size = sizeof(retbuf);
|
||||
stream.write_function = switch_console_stream_write;
|
||||
if (switch_api_execute(cmd, arg, session, &stream) == SWITCH_STATUS_SUCCESS) {
|
||||
field_data = retbuf;
|
||||
}
|
||||
free(stream.data);
|
||||
}
|
||||
} else {
|
||||
field_data = switch_caller_get_field_by_name(caller_profile, field);
|
||||
|
||||
@@ -128,7 +128,7 @@ static switch_status_t switch_console_logger(const switch_log_node_t *node, swit
|
||||
}
|
||||
|
||||
if (!log_hash || (((all_level > - 1) || lookup) && level >= node->level)) {
|
||||
fprintf(handle, node->data);
|
||||
fprintf(handle, "%s", node->data);
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "HELP I HAVE NO CONSOLE TO LOG TO!\n");
|
||||
|
||||
Reference in new issue
Block a user