git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@198 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2005-12-23 03:12:39 +00:00
parent f52b45c2c9
commit f3d53dfa7b
2 changed files with 18 additions and 18 deletions

View File

@@ -410,13 +410,27 @@ SWITCH_DECLARE(int) loadable_module_get_codecs_sorted(switch_memory_pool *pool,
SWITCH_DECLARE(switch_status) switch_api_execute(char *cmd, char *arg, char *retbuf, size_t len)
{
switch_api_interface *api;
switch_status status;
switch_event *event;
if ((api = loadable_module_get_api_interface(cmd))) {
api->function(arg, retbuf, len);
status = api->function(arg, retbuf, len);
} else {
status = SWITCH_STATUS_FALSE;
snprintf(retbuf, len, "INVALID COMMAND [%s]", cmd);
return SWITCH_STATUS_FALSE;
}
return SWITCH_STATUS_SUCCESS;
if (switch_event_create(&event, SWITCH_EVENT_API) == SWITCH_STATUS_SUCCESS) {
if (cmd) {
switch_event_add_header(event, "re_command", cmd);
}
if (arg) {
switch_event_add_header(event, "re_command_arg", arg);
}
switch_event_add_body(event, retbuf);
switch_event_fire(&event);
}
return status;
}