mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-29 14:44:17 +00:00
add arrays to event headers and chanvars
This commit is contained in:
1 parent
b978d39d48
commit
c1c759526d
16 files changed
+889
-252
No files matched your search
@@ -1033,7 +1033,7 @@ SWITCH_STANDARD_APP(sched_cancel_function)
|
||||
switch_scheduler_del_task_group(group);
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_APP(set_function)
|
||||
static void base_set (switch_core_session_t *session, const char *data, switch_stack_t stack)
|
||||
{
|
||||
char *var, *val = NULL;
|
||||
|
||||
@@ -1044,7 +1044,10 @@ SWITCH_STANDARD_APP(set_function)
|
||||
char *expanded = NULL;
|
||||
|
||||
var = switch_core_session_strdup(session, data);
|
||||
val = strchr(var, '=');
|
||||
|
||||
if (!(val = strchr(var, '='))) {
|
||||
val = strchr(var, ',');
|
||||
}
|
||||
|
||||
if (val) {
|
||||
*val++ = '\0';
|
||||
@@ -1059,7 +1062,7 @@ SWITCH_STANDARD_APP(set_function)
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SET [%s]=[%s]\n", switch_channel_get_name(channel), var,
|
||||
expanded ? expanded : "UNDEF");
|
||||
switch_channel_set_variable_var_check(channel, var, expanded, SWITCH_FALSE);
|
||||
switch_channel_add_variable_var_check(channel, var, expanded, SWITCH_FALSE, stack);
|
||||
|
||||
if (expanded && expanded != val) {
|
||||
switch_safe_free(expanded);
|
||||
@@ -1067,6 +1070,21 @@ SWITCH_STANDARD_APP(set_function)
|
||||
}
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_APP(set_function)
|
||||
{
|
||||
base_set(session, data, SWITCH_STACK_BOTTOM);
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_APP(push_function)
|
||||
{
|
||||
base_set(session, data, SWITCH_STACK_PUSH);
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_APP(unshift_function)
|
||||
{
|
||||
base_set(session, data, SWITCH_STACK_UNSHIFT);
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_APP(set_global_function)
|
||||
{
|
||||
char *var, *val = NULL;
|
||||
@@ -3769,6 +3787,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
|
||||
SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
|
||||
SWITCH_ADD_APP(app_interface, "set", "Set a channel variable", SET_LONG_DESC, set_function, "<varname>=<value>",
|
||||
SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
|
||||
|
||||
SWITCH_ADD_APP(app_interface, "push", "Set a channel variable", SET_LONG_DESC, push_function, "<varname>=<value>",
|
||||
SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
|
||||
|
||||
SWITCH_ADD_APP(app_interface, "unshift", "Set a channel variable", SET_LONG_DESC, unshift_function, "<varname>=<value>",
|
||||
SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
|
||||
|
||||
SWITCH_ADD_APP(app_interface, "set_global", "Set a global variable", SET_GLOBAL_LONG_DESC, set_global_function, "<varname>=<value>",
|
||||
SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
|
||||
SWITCH_ADD_APP(app_interface, "set_profile_var", "Set a caller profile variable", SET_PROFILE_VAR_LONG_DESC, set_profile_var_function,
|
||||
|
||||
@@ -79,6 +79,13 @@ static switch_status_t exec_app(switch_core_session_t *session, const char *app,
|
||||
return status;
|
||||
}
|
||||
|
||||
static void set_var_callback(const char *var, const char *val, void *user_data)
|
||||
{
|
||||
switch_core_session_t *session = (switch_core_session_t *) user_data;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
switch_channel_add_variable_var_check(channel, var, val, SWITCH_FALSE, SWITCH_STACK_PUSH);
|
||||
}
|
||||
|
||||
static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *caller_profile, switch_xml_t xexten, switch_caller_extension_t **extension)
|
||||
{
|
||||
switch_xml_t xcond, xaction, xexpression;
|
||||
@@ -222,6 +229,11 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
|
||||
proceed = 1;
|
||||
}
|
||||
} else {
|
||||
if (field && strchr(expression, '(')) {
|
||||
switch_channel_set_variable(channel, "DP_MATCH", NULL);
|
||||
switch_capture_regex(re, proceed, field_data, ovector, "DP_MATCH", set_var_callback, session);
|
||||
}
|
||||
|
||||
for (xaction = switch_xml_child(xcond, "action"); xaction; xaction = xaction->next) {
|
||||
char *application = (char *) switch_xml_attr_soft(xaction, "application");
|
||||
const char *loop = switch_xml_attr(xaction, "loop");
|
||||
|
||||
@@ -5332,11 +5332,11 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName
|
||||
|
||||
tech_pvt->dest = switch_core_session_sprintf(session, "sip:%s", switch_channel_get_variable(channel, "sip_from_uri"));
|
||||
|
||||
if (!switch_channel_get_variable_dup(channel, "sip_handle_full_from", SWITCH_FALSE)) {
|
||||
if (!switch_channel_get_variable_dup(channel, "sip_handle_full_from", SWITCH_FALSE, -1)) {
|
||||
switch_channel_set_variable(channel, "sip_handle_full_from", switch_channel_get_variable(channel, "sip_full_to"));
|
||||
}
|
||||
|
||||
if (!switch_channel_get_variable_dup(channel, "sip_handle_full_to", SWITCH_FALSE)) {
|
||||
if (!switch_channel_get_variable_dup(channel, "sip_handle_full_to", SWITCH_FALSE, -1)) {
|
||||
switch_channel_set_variable(channel, "sip_handle_full_to", switch_channel_get_variable(channel, "sip_full_from"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user