Merge 73e826d993
into 5cb74797fe
This commit is contained in:
commit
39a5cc59c3
|
@ -1362,6 +1362,23 @@ static void drop_detached(void)
|
|||
switch_thread_rwlock_unlock(verto_globals.tech_rwlock);
|
||||
}
|
||||
|
||||
static void drop_calls(void)
|
||||
{
|
||||
verto_pvt_t *tech_pvt;
|
||||
|
||||
switch_thread_rwlock_rdlock(verto_globals.tech_rwlock);
|
||||
|
||||
for(tech_pvt = verto_globals.tech_head; tech_pvt; tech_pvt = tech_pvt->next) {
|
||||
|
||||
if (!switch_channel_up_nosig(tech_pvt->channel)) {
|
||||
continue;
|
||||
}
|
||||
switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||
}
|
||||
|
||||
switch_thread_rwlock_unlock(verto_globals.tech_rwlock);
|
||||
}
|
||||
|
||||
static void attach_calls(jsock_t *jsock)
|
||||
{
|
||||
verto_pvt_t *tech_pvt;
|
||||
|
@ -1422,6 +1439,36 @@ static void detach_calls(jsock_t *jsock)
|
|||
if (wake) attach_wake();
|
||||
}
|
||||
|
||||
static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t *stream)
|
||||
{
|
||||
const char *err;
|
||||
|
||||
if (argc < 2) {
|
||||
stream->write_function(stream, "Invalid Args!\n");
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (argv[1] && !strcasecmp(argv[0], "restart") && !strcasecmp(argv[1], "all")) {
|
||||
switch_xml_reload(&err);
|
||||
stream->write_function(stream, "Restart all profiles\n");
|
||||
/* hangup all calls */
|
||||
drop_calls();
|
||||
/* stop all profiles */
|
||||
kill_profiles();
|
||||
/* reload config: init ssl, load profiles, start profiles */
|
||||
init();
|
||||
run_profiles();
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
stream->write_function(stream, "-ERR Unknown command!\n");
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static void process_jrpc_response(jsock_t *jsock, cJSON *json)
|
||||
{
|
||||
}
|
||||
|
@ -5709,6 +5756,7 @@ SWITCH_STANDARD_API(verto_function)
|
|||
"verto debug [0-10]\n"
|
||||
"verto perm <sessid> <type> <value>\n"
|
||||
"verto noperm <sessid> <type> <value>\n"
|
||||
"verto profile restart all \n"
|
||||
"--------------------------------------------------------------------------------\n";
|
||||
|
||||
if (zstr(cmd)) {
|
||||
|
@ -5771,6 +5819,8 @@ SWITCH_STANDARD_API(verto_function)
|
|||
}
|
||||
stream->write_function(stream, "Debug Level: %s\n", switch_log_level2str(verto_globals.debug_level));
|
||||
goto done;
|
||||
} else if (!strcasecmp(argv[0], "profile")) {
|
||||
func = cmd_profile;
|
||||
}
|
||||
|
||||
if (func) {
|
||||
|
@ -6880,6 +6930,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_verto_load)
|
|||
switch_console_set_complete("add verto debug-level");
|
||||
switch_console_set_complete("add verto status");
|
||||
switch_console_set_complete("add verto xmlstatus");
|
||||
switch_console_set_complete("add verto profile restart all");
|
||||
|
||||
SWITCH_ADD_JSON_API(json_api_interface, "store", "JSON store", json_store_function, "");
|
||||
|
||||
|
|
|
@ -345,6 +345,9 @@ typedef switch_bool_t (*jrpc_func_t)(const char *method, cJSON *params, jsock_t
|
|||
|
||||
void set_log_path(const char *path);
|
||||
|
||||
static void kill_profiles(void);
|
||||
static void run_profiles(void);
|
||||
static int init(void);
|
||||
|
||||
/** @} */
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue