mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-13 21:17:06 +00:00
Add events around all application execution:
fire SWITCH_EVEHT_CHANNEL_EXECUTE <execute app> fire SWITCH_EVEHT_CHANNEL_EXECUTE_COMPLETE This can be used in async socket connections to tell when a queued application has finished executing. Add the "event" application to the dialplan: <action application="event" data="header1=val1,header2=val2"/> Events fired from this applcation will always have the type SWITCH_EVENT_CHANNEL_APPLICATION. You can add up to 25 headers of your own to the event via the application arguements. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5448 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
c43c080fa3
commit
a039d870c3
6 files changed
+72
-11
No files matched your search
@@ -912,7 +912,8 @@ SWITCH_DECLARE(switch_app_log_t *) switch_core_session_get_app_log(switch_core_s
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t *session,
|
||||
const switch_application_interface_t *application_interface, char *arg) {
|
||||
switch_app_log_t *log, *lp;
|
||||
|
||||
switch_event_t *event;
|
||||
|
||||
log = switch_core_session_alloc(session, sizeof(*log));
|
||||
|
||||
assert(log != NULL);
|
||||
@@ -928,7 +929,21 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t *
|
||||
session->app_log = log;
|
||||
}
|
||||
|
||||
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_event_set_data(session->channel, event);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application", "%s", application_interface->interface_name);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application-Data", "%s", arg);
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
|
||||
application_interface->application_function(session, arg);
|
||||
|
||||
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_event_set_data(session->channel, event);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application", "%s", application_interface->interface_name);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application-Data", "%s", arg);
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user