mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-31 15:44:21 +00:00
add uuid_fileman <uuid> <cmd>:<val> <-- same vals as the callbacks in js and lua to control the currently playing file of a channel from the cli or ESL (for the people who were ignoring me on the conference call so I decided to implement it instead of try to explain it )
This commit is contained in:
1 parent
5b15e03f30
commit
c4369fc84d
9 files changed
+258
-114
No files matched your search
@@ -3968,6 +3968,47 @@ SWITCH_STANDARD_API(uuid_getvar_function)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
#define FILEMAN_SYNTAX "<uuid> <cmd>:<val>"
|
||||
SWITCH_STANDARD_API(uuid_fileman_function)
|
||||
{
|
||||
switch_core_session_t *psession = NULL;
|
||||
char *mycmd = NULL, *argv[4] = { 0 };
|
||||
int argc = 0;
|
||||
|
||||
if (!zstr(cmd) && (mycmd = strdup(cmd))) {
|
||||
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
|
||||
if (argc >= 2 && !zstr(argv[0])) {
|
||||
char *uuid = argv[0];
|
||||
char *cmd = argv[1];
|
||||
|
||||
if ((psession = switch_core_session_locate(uuid))) {
|
||||
switch_channel_t *channel;
|
||||
switch_file_handle_t *fh = NULL;
|
||||
|
||||
channel = switch_core_session_get_channel(psession);
|
||||
|
||||
if (switch_ivr_get_file_handle(psession, &fh) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_ivr_process_fh(psession, cmd, fh);
|
||||
switch_ivr_release_file_handle(psession, &fh);
|
||||
}
|
||||
|
||||
switch_core_session_rwunlock(psession);
|
||||
|
||||
} else {
|
||||
stream->write_function(stream, "-ERR No Such Channel!\n");
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
stream->write_function(stream, "-USAGE: %s\n", GETVAR_SYNTAX);
|
||||
|
||||
done:
|
||||
switch_safe_free(mycmd);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#define UUID_SEND_DTMF_SYNTAX "<uuid> <dtmf_data>"
|
||||
SWITCH_STANDARD_API(uuid_send_dtmf_function)
|
||||
{
|
||||
@@ -4674,6 +4715,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
|
||||
SWITCH_ADD_API(commands_api_interface, "uuid_display", "change display", uuid_display_function, DISPLAY_SYNTAX);
|
||||
SWITCH_ADD_API(commands_api_interface, "uuid_dump", "uuid_dump", uuid_dump_function, DUMP_SYNTAX);
|
||||
SWITCH_ADD_API(commands_api_interface, "uuid_exists", "see if a uuid exists", uuid_exists_function, EXISTS_SYNTAX);
|
||||
SWITCH_ADD_API(commands_api_interface, "uuid_fileman", "uuid_fileman", uuid_fileman_function, FILEMAN_SYNTAX);
|
||||
SWITCH_ADD_API(commands_api_interface, "uuid_flush_dtmf", "Flush dtmf on a given uuid", uuid_flush_dtmf_function, "<uuid>");
|
||||
SWITCH_ADD_API(commands_api_interface, "uuid_getvar", "uuid_getvar", uuid_getvar_function, GETVAR_SYNTAX);
|
||||
SWITCH_ADD_API(commands_api_interface, "uuid_hold", "hold", uuid_hold_function, HOLD_SYNTAX);
|
||||
@@ -4785,6 +4827,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
|
||||
switch_console_set_complete("add uuid_display ::console::list_uuid");
|
||||
switch_console_set_complete("add uuid_dump ::console::list_uuid");
|
||||
switch_console_set_complete("add uuid_exists ::console::list_uuid");
|
||||
switch_console_set_complete("add uuid_fileman ::console::list_uuid");
|
||||
switch_console_set_complete("add uuid_flush_dtmf ::console::list_uuid");
|
||||
switch_console_set_complete("add uuid_getvar ::console::list_uuid");
|
||||
switch_console_set_complete("add uuid_hold ::console::list_uuid");
|
||||
|
||||
Reference in new issue
Block a user