run execute_on_answer on_media _on_ring apps async
This commit is contained in:
parent
8b0421ff68
commit
ef4a4ed034
|
@ -882,6 +882,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(_In_ switch_core_sessio
|
|||
SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_get_flags(_In_ switch_core_session_t *session,
|
||||
_In_ const char *app, _In_opt_z_ const char *arg, _Out_opt_ int32_t *flags);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_async(switch_core_session_t *session, const char *app, const char *arg);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_get_app_flags(const char *app, int32_t *flags);
|
||||
|
||||
/*!
|
||||
|
|
|
@ -2518,7 +2518,12 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready_value(swi
|
|||
if ((arg = strchr(app, ' '))) {
|
||||
*arg++ = '\0';
|
||||
}
|
||||
|
||||
if (switch_core_session_in_thread(channel->session)) {
|
||||
switch_core_session_execute_application(channel->session, app, arg);
|
||||
} else {
|
||||
switch_core_session_execute_application_async(channel->session, app, arg);
|
||||
}
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
@ -2571,7 +2576,12 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_
|
|||
if ((arg = strchr(app, ' '))) {
|
||||
*arg++ = '\0';
|
||||
}
|
||||
|
||||
if (switch_core_session_in_thread(channel->session)) {
|
||||
switch_core_session_execute_application(channel->session, app, arg);
|
||||
} else {
|
||||
switch_core_session_execute_application_async(channel->session, app, arg);
|
||||
}
|
||||
}
|
||||
|
||||
if ((var = switch_channel_get_variable(channel, SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE))) {
|
||||
|
@ -2750,7 +2760,12 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan
|
|||
}
|
||||
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);
|
||||
} else {
|
||||
switch_core_session_execute_application_async(channel->session, app, arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -855,6 +855,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_event(switch_core_sess
|
|||
if (switch_queue_trypush(session->event_queue, *event) == SWITCH_STATUS_SUCCESS) {
|
||||
*event = NULL;
|
||||
status = SWITCH_STATUS_SUCCESS;
|
||||
|
||||
if (switch_channel_test_flag(session->channel, CF_PROXY_MODE) || switch_channel_test_flag(session->channel, CF_THREAD_SLEEPING)) {
|
||||
switch_core_session_wake_session_thread(session);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1814,6 +1818,28 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_app_flags(const char *ap
|
|||
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_async(switch_core_session_t *session, const char *app, const char *arg)
|
||||
{
|
||||
switch_event_t *execute_event;
|
||||
|
||||
if (switch_event_create(&execute_event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "call-command", "execute");
|
||||
switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "execute-app-name", app);
|
||||
|
||||
if (arg) {
|
||||
switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "execute-app-arg", arg);
|
||||
}
|
||||
|
||||
switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "event-lock", "true");
|
||||
switch_core_session_queue_private_event(session, &execute_event, SWITCH_FALSE);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_get_flags(switch_core_session_t *session, const char *app,
|
||||
const char *arg, int32_t *flags)
|
||||
{
|
||||
|
|
|
@ -348,20 +348,10 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
|
|||
if (read_frame_count > DEFAULT_LEAD_FRAMES && switch_channel_media_ack(chan_a)) {
|
||||
|
||||
if (exec_app) {
|
||||
switch_event_t *execute_event;
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_DEBUG, "%s Bridge execute app %s(%s)\n",
|
||||
switch_channel_get_name(chan_a), exec_app, exec_data);
|
||||
|
||||
if (switch_event_create(&execute_event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "call-command", "execute");
|
||||
switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "execute-app-name", exec_app);
|
||||
if (exec_data) {
|
||||
switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "execute-app-arg", exec_data);
|
||||
}
|
||||
//switch_event_add_header(execute_event, SWITCH_STACK_BOTTOM, "lead-frames", "%d", 5);
|
||||
switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "event-lock", "true");
|
||||
switch_core_session_queue_private_event(session_a, &execute_event, SWITCH_FALSE);
|
||||
}
|
||||
switch_core_session_execute_application_async(session_a, exec_app, exec_data);
|
||||
exec_app = exec_data = NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue