only execute execute_on_[answer|media|ring] async when its expressed in app::arg form vs 'app arg form'

This commit is contained in:
Anthony Minessale 2011-02-01 13:39:36 -06:00
parent 2404dd295a
commit d72cde9b76

View File

@ -2595,14 +2595,15 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready_value(swi
if (var) { if (var) {
char *arg = NULL; char *arg = NULL;
app = switch_core_session_strdup(channel->session, var); app = switch_core_session_strdup(channel->session, var);
if ((arg = strchr(app, ' '))) {
*arg++ = '\0';
}
if (switch_core_session_in_thread(channel->session)) { if (strstr(app, "::")) {
switch_core_session_execute_application(channel->session, app, arg);
} else {
switch_core_session_execute_application_async(channel->session, app, arg); switch_core_session_execute_application_async(channel->session, app, arg);
} else {
if ((arg = strchr(app, ' '))) {
*arg++ = '\0';
}
switch_core_session_execute_application(channel->session, app, arg);
} }
} }
@ -2653,14 +2654,16 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_
(var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE))) && !zstr(var)) { (var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE))) && !zstr(var)) {
char *arg = NULL; char *arg = NULL;
app = switch_core_session_strdup(channel->session, var); app = switch_core_session_strdup(channel->session, var);
if ((arg = strchr(app, ' '))) {
*arg++ = '\0';
}
if (switch_core_session_in_thread(channel->session)) {
switch_core_session_execute_application(channel->session, app, arg); if (strstr(app, "::")) {
} else {
switch_core_session_execute_application_async(channel->session, app, arg); switch_core_session_execute_application_async(channel->session, app, arg);
} else {
if ((arg = strchr(app, ' '))) {
*arg++ = '\0';
}
switch_core_session_execute_application(channel->session, app, arg);
} }
} }
@ -2825,27 +2828,17 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan
(!switch_channel_test_flag(channel, CF_EARLY_MEDIA) && (var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE)))) (!switch_channel_test_flag(channel, CF_EARLY_MEDIA) && (var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE))))
&& !zstr(var)) { && !zstr(var)) {
char *arg = NULL; char *arg = NULL;
char *colon = NULL;
app = switch_core_session_strdup(channel->session, var); app = switch_core_session_strdup(channel->session, var);
arg = strchr(app, ' '); if (strstr(app, "::")) {
colon = strchr(app, ':'); switch_core_session_execute_application_async(channel->session, app, arg);
if (colon && (!arg || arg > colon) && *(colon + 1) == ':') {
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "%s execute on answer: %s (BROADCAST)\n", channel->name, app);
switch_ivr_broadcast(switch_core_session_get_uuid(channel->session), app, SMF_NONE);
} else { } else {
if (arg) { if ((arg = strchr(app, ' '))) {
*arg++ = '\0'; *arg++ = '\0';
} }
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "%s execute on answer: %s(%s)\n", channel->name, app,
switch_str_nil(arg));
if (switch_core_session_in_thread(channel->session)) { switch_core_session_execute_application(channel->session, app, arg);
switch_core_session_execute_application(channel->session, app, arg);
} else {
switch_core_session_execute_application_async(channel->session, app, arg);
}
} }
} }