add skinny cmd to kill all current listeners

This commit is contained in:
Nathan Neulinger 2013-06-18 09:41:56 -05:00
parent 45d33b02e9
commit f782c280d4
1 changed files with 19 additions and 0 deletions

View File

@ -288,6 +288,20 @@ static switch_status_t skinny_api_cmd_profile_device_kill(const char *profile_na
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
static switch_status_t skinny_api_cmd_profile_kill_all(const char *profile_name, switch_stream_handle_t *stream)
{
skinny_profile_t *profile;
if ((profile = skinny_find_profile(profile_name))) {
profile_walk_listeners(profile, kill_listener, NULL);
stream->write_function(stream, "+OK\n");
} else {
stream->write_function(stream, "Profile not found!\n");
}
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t skinny_api_cmd_profile_device_send_ringer_message(const char *profile_name, const char *device_name, const char *ring_type, const char *ring_mode, switch_stream_handle_t *stream) static switch_status_t skinny_api_cmd_profile_device_send_ringer_message(const char *profile_name, const char *device_name, const char *ring_type, const char *ring_mode, switch_stream_handle_t *stream)
{ {
skinny_profile_t *profile; skinny_profile_t *profile;
@ -508,6 +522,9 @@ SWITCH_STANDARD_API(skinny_function)
} else if (argc == 3 && !strcasecmp(argv[0], "status") && !strcasecmp(argv[1], "profile")) { } else if (argc == 3 && !strcasecmp(argv[0], "status") && !strcasecmp(argv[1], "profile")) {
/* skinny status profile <profile_name> */ /* skinny status profile <profile_name> */
status = skinny_api_cmd_status_profile(argv[2], stream); status = skinny_api_cmd_status_profile(argv[2], stream);
} else if (argc == 3 && !strcasecmp(argv[0], "profile") && !strcasecmp(argv[2], "kill_all")) {
/* skinny profile <profile_name> kill_all */
status = skinny_api_cmd_profile_kill_all(argv[1],stream);
} else if (argc == 5 && !strcasecmp(argv[0], "status") && !strcasecmp(argv[1], "profile") && !strcasecmp(argv[3], "device")) { } else if (argc == 5 && !strcasecmp(argv[0], "status") && !strcasecmp(argv[1], "profile") && !strcasecmp(argv[3], "device")) {
/* skinny status profile <profile_name> device <device_name> */ /* skinny status profile <profile_name> device <device_name> */
status = skinny_api_cmd_status_profile_device(argv[2], argv[4], stream); status = skinny_api_cmd_status_profile_device(argv[2], argv[4], stream);
@ -582,6 +599,8 @@ switch_status_t skinny_api_register(switch_loadable_module_interface_t **module_
switch_console_set_complete("add skinny status profile ::skinny::list_profiles"); switch_console_set_complete("add skinny status profile ::skinny::list_profiles");
switch_console_set_complete("add skinny status profile ::skinny::list_profiles device ::skinny::list_devices"); switch_console_set_complete("add skinny status profile ::skinny::list_profiles device ::skinny::list_devices");
switch_console_set_complete("add skinny profile ::skinny::list_profiles kill_all");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices kill"); switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices kill");
switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send ResetMessage ::skinny::list_reset_types"); switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send ResetMessage ::skinny::list_reset_types");