forked from Mirrors/freeswitch
add a mechanism to tell if a file played from sendmsg over event socket for the guy on the mailing list
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10653 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
d76b717b2c
commit
9fe1179ed1
@ -110,6 +110,9 @@ SWITCH_BEGIN_EXTERN_C
|
||||
#define SWITCH_PATH_SEPARATOR "/"
|
||||
#endif
|
||||
#define SWITCH_URL_SEPARATOR "://"
|
||||
#define SWITCH_CURRENT_APPLICATION_VARIABLE "current_application"
|
||||
#define SWITCH_CURRENT_APPLICATION_DATA_VARIABLE "current_application_data"
|
||||
#define SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE "current_application_response"
|
||||
#define SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE "enable_heartbeat_events"
|
||||
#define SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE "bypass_media_after_bridge"
|
||||
#define SWITCH_READ_RESULT_VARIABLE "read_result"
|
||||
|
@ -1646,12 +1646,27 @@ SWITCH_STANDARD_APP(playback_function)
|
||||
{
|
||||
switch_input_args_t args = { 0 };
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
switch_status_t status;
|
||||
|
||||
args.input_callback = on_dtmf;
|
||||
|
||||
switch_channel_set_variable(channel, SWITCH_PLAYBACK_TERMINATOR_USED, "" );
|
||||
|
||||
switch_ivr_play_file(session, NULL, data, &args);
|
||||
status = switch_ivr_play_file(session, NULL, data, &args);
|
||||
|
||||
switch (status) {
|
||||
case SWITCH_STATUS_SUCCESS:
|
||||
case SWITCH_STATUS_BREAK:
|
||||
switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "FILE PLAYED");
|
||||
break;
|
||||
case SWITCH_STATUS_NOTFOUND:
|
||||
switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "FILE NOT FOUND");
|
||||
break;
|
||||
default:
|
||||
switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "PLAYBACK ERROR");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_APP(gentones_function)
|
||||
|
@ -1306,9 +1306,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t *
|
||||
}
|
||||
}
|
||||
|
||||
switch_channel_set_variable(channel, "current_application", application_interface->interface_name);
|
||||
switch_channel_set_variable(channel, "current_application_data", arg);
|
||||
|
||||
switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_VARIABLE, application_interface->interface_name);
|
||||
switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_DATA_VARIABLE, arg);
|
||||
switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, NULL);
|
||||
|
||||
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_event_set_data(session->channel, event);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application", application_interface->interface_name);
|
||||
@ -1325,9 +1326,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t *
|
||||
application_interface->application_function(session, arg);
|
||||
|
||||
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE) == SWITCH_STATUS_SUCCESS) {
|
||||
const char *resp = switch_channel_get_variable(session->channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE);
|
||||
switch_channel_event_set_data(session->channel, event);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application", application_interface->interface_name);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-Data", arg);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-Response", resp ? resp : "_none_");
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user