\param value the value of the variable
*/
SWITCH_DECLARE(void) switch_core_set_variable(_In_z_ const char *varname, _In_opt_z_ const char *value);
+SWITCH_DECLARE(switch_status_t) switch_core_get_variables(switch_event_t **event);
/*!
\brief Conditionally add a global variable to the core
char *app;
app = switch_core_session_strdup(channel->session, variable);
-
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "EXEC %s\n", app);
for(p = app; p && *p; p++) {
if (*p == ' ' || (*p == ':' && (*(p+1) != ':'))) {
*p++ = '\0';
SWITCH_DECLARE(switch_status_t) switch_channel_execute_on(switch_channel_t *channel, const char *variable_prefix)
{
switch_event_header_t *hp;
- switch_event_t *event;
+ switch_event_t *event, *cevent;
int x = 0;
- switch_channel_get_variables(channel, &event);
+ switch_core_get_variables(&event);
+ switch_channel_get_variables(channel, &cevent);
+ switch_event_merge(event, cevent);
for (hp = event->headers; hp; hp = hp->next) {
char *var = hp->name;
}
switch_event_destroy(&event);
+ switch_event_destroy(&cevent);
return x ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
}
}
+SWITCH_DECLARE(switch_status_t) switch_core_get_variables(switch_event_t **event)
+{
+ switch_status_t status;
+ switch_thread_rwlock_rdlock(runtime.global_var_rwlock);
+ status = switch_event_dup(event, runtime.global_vars);
+ switch_thread_rwlock_unlock(runtime.global_var_rwlock);
+ return status;
+}
+
SWITCH_DECLARE(char *) switch_core_get_variable(const char *varname)
{
char *val;
}
#endif
- if (read_frame_count > DEFAULT_LEAD_FRAMES && switch_channel_media_ack(chan_a)) {
-
+ if (read_frame_count == DEFAULT_LEAD_FRAMES && switch_channel_media_ack(chan_a)) {
switch_channel_execute_on(chan_a, SWITCH_CHANNEL_EXECUTE_ON_PRE_BRIDGE_VARIABLE);
if (!inner_bridge) {
switch_core_session_execute_application_async(session_a, exec_app, exec_data);
exec_app = exec_data = NULL;
}
+ }
-
+ if (read_frame_count >= DEFAULT_LEAD_FRAMES && switch_channel_media_ack(chan_a)) {
if ((bypass_media_after_bridge || switch_channel_test_flag(chan_b, CF_BYPASS_MEDIA_AFTER_BRIDGE)) && switch_channel_test_flag(chan_a, CF_ANSWERED)
&& switch_channel_test_flag(chan_b, CF_ANSWERED)) {
switch_ivr_nomedia(switch_core_session_get_uuid(session_a), SMF_REBRIDGE);