[Freeswitch-svn] [commit] r13241 - in freeswitch/trunk/src: . mod/applications/mod_dptools
FreeSWITCH SVN
anthm at freeswitch.org
Wed May 6 08:13:51 PDT 2009
Author: anthm
Date: Wed May 6 10:13:51 2009
New Revision: 13241
Log:
add group_recurse_variables and user_recurse_variables to {} vars (default is true, set to false to not pass vars down to user or group channels)
Modified:
freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
freeswitch/trunk/src/switch_ivr_originate.c
Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c Wed May 6 10:13:51 2009
@@ -2187,11 +2187,11 @@
switch_originate_flag_t myflags = SOF_NONE;
char *cid_name_override = NULL;
char *cid_num_override = NULL;
- const char *var;
+ const char *var, *skip = NULL;
unsigned int timelimit = 60;
char *domain = NULL;
switch_channel_t *new_channel = NULL;
-
+
group = strdup(outbound_profile->destination_number);
if (!group) goto done;
@@ -2206,17 +2206,35 @@
goto done;
}
+
+ if (var_event && (skip=switch_event_get_header(var_event, "group_recurse_variables")) && switch_false(skip)) {
+ if ((var = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) ||
+ (var = switch_event_get_header(var_event, "leg_timeout"))) {
+ timelimit = atoi(var);
+ }
+ var_event = NULL;
+ }
+
+
+
template = switch_mprintf("${group_call(%s@%s)}", group, domain);
if (session) {
switch_channel_t *channel = switch_core_session_get_channel(session);
dest = switch_channel_expand_variables(channel, template);
- if ((var = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE))) {
+ if ((var = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE)) ||
+ (var = switch_event_get_header(var_event, "leg_timeout"))) {
timelimit = atoi(var);
}
} else if (var_event) {
dest = switch_event_expand_headers(var_event, template);
+ } else {
+ switch_event_t *event = NULL;
+ switch_event_create(&event, SWITCH_EVENT_REQUEST_PARAMS);
+ dest = switch_event_expand_headers(event, template);
+ switch_event_destroy(&event);
}
+
if (!dest) {
goto done;
}
@@ -2224,7 +2242,8 @@
if (var_event) {
cid_name_override = switch_event_get_header(var_event, "origination_caller_id_name");
cid_num_override = switch_event_get_header(var_event, "origination_caller_id_number");
- if ((var = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE))) {
+ if ((var = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) ||
+ (var = switch_event_get_header(var_event, "leg_timeout"))) {
timelimit = atoi(var);
}
}
@@ -2290,6 +2309,7 @@
switch_channel_t *new_channel = NULL;
switch_event_t *params = NULL;
char stupid[128] = "";
+ const char *skip = NULL, *var = NULL;
if (switch_strlen_zero(outbound_profile->destination_number)) {
goto done;
@@ -2310,6 +2330,16 @@
}
+ if (var_event && (skip=switch_event_get_header(var_event, "user_recurse_variables")) && switch_false(skip)) {
+ if ((var = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) ||
+ (var = switch_event_get_header(var_event, "leg_timeout"))) {
+ timelimit = atoi(var);
+ }
+ var_event = NULL;
+ }
+
+
+
switch_event_create(¶ms, SWITCH_EVENT_REQUEST_PARAMS);
switch_assert(params);
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "as_channel", "true");
@@ -2374,7 +2404,8 @@
if (session) {
channel = switch_core_session_get_channel(session);
- if ((var = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE))) {
+ if ((var = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE))
+ || (var = switch_event_get_header(var_event, "leg_timeout"))) {
timelimit = atoi(var);
}
@@ -2388,22 +2419,20 @@
if (var_event) {
switch_event_dup(&event, var_event);
- switch_event_del_header(event, "dialer_user");
- switch_event_del_header(event, "dialer_domain");
- if ((var = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE))) {
+ switch_event_del_header(event, "dialed_user");
+ switch_event_del_header(event, "dialed_domain");
+ if ((var = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) ||
+ (var = switch_event_get_header(var_event, "leg_timeout"))) {
timelimit = atoi(var);
}
} else {
switch_event_create(&event, SWITCH_EVENT_REQUEST_PARAMS);
switch_assert(event);
- }
- switch_assert(var_event);
-
- switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialed_user", user);
- switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialed_domain", domain);
- d_dest = switch_event_expand_headers(event, dest);
-
- switch_event_destroy(&event);
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialed_user", user);
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialed_domain", domain);
+ d_dest = switch_event_expand_headers(event, dest);
+ switch_event_destroy(&event);
+ }
}
if ((flags & SOF_FORKED_DIAL)) {
Modified: freeswitch/trunk/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_originate.c (original)
+++ freeswitch/trunk/src/switch_ivr_originate.c Wed May 6 10:13:51 2009
@@ -1545,7 +1545,7 @@
if (originate_status[i].peer_channel) {
const char *vvar;
-
+
if ((vvar = switch_channel_get_variable(originate_status[i].peer_channel, "leg_timeout"))) {
int val = atoi(vvar);
if (val > 0) {
More information about the Freeswitch-svn
mailing list