mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 05:02:10 +00:00
update
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1425 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -671,12 +671,24 @@ SWITCH_DECLARE(switch_status_t) switch_api_execute(char *cmd, char *arg, switch_
|
||||
{
|
||||
switch_api_interface_t *api;
|
||||
switch_status_t status;
|
||||
switch_event_t *event;
|
||||
|
||||
assert(stream != NULL);
|
||||
assert(stream->data != NULL);
|
||||
assert(stream->write_function != NULL);
|
||||
|
||||
if (!stream->event) {
|
||||
switch_event_create(&stream->event, SWITCH_EVENT_API);
|
||||
}
|
||||
|
||||
if (stream->event) {
|
||||
if (cmd) {
|
||||
switch_event_add_header(stream->event, SWITCH_STACK_BOTTOM, "API-Command", cmd);
|
||||
}
|
||||
if (arg) {
|
||||
switch_event_add_header(stream->event, SWITCH_STACK_BOTTOM, "API-Command-Arguement", arg);
|
||||
}
|
||||
}
|
||||
|
||||
if ((api = switch_loadable_module_get_api_interface(cmd)) != 0) {
|
||||
status = api->function(arg, stream);
|
||||
} else {
|
||||
@@ -685,15 +697,8 @@ SWITCH_DECLARE(switch_status_t) switch_api_execute(char *cmd, char *arg, switch_
|
||||
//snprintf(retbuf, len, "INVALID COMMAND [%s]", cmd);
|
||||
}
|
||||
|
||||
if (switch_event_create(&event, SWITCH_EVENT_API) == SWITCH_STATUS_SUCCESS) {
|
||||
if (cmd) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "API-Command", cmd);
|
||||
}
|
||||
if (arg) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "API-Command-Arguement", arg);
|
||||
}
|
||||
//switch_event_add_body(event, retbuf);
|
||||
switch_event_fire(&event);
|
||||
if (stream->event) {
|
||||
switch_event_fire(&stream->event);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user