mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-18 09:32:34 +00:00
add sofia profile <profile> gwlist up|down to list up or downed profiles for feeding into mod distributor to exclude dead gateways
This commit is contained in:
parent
445731eea1
commit
0477cb67f5
src/mod/endpoints/mod_sofia
@ -3166,6 +3166,21 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
if (!strcasecmp(argv[1], "gwlist")) {
|
||||
int up = 1;
|
||||
|
||||
if (argc > 2) {
|
||||
if (!strcasecmp(argv[2], "down")) {
|
||||
up = 0;
|
||||
}
|
||||
}
|
||||
|
||||
sofia_glue_gateway_list(profile, stream, up);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
stream->write_function(stream, "-ERR Unknown command!\n");
|
||||
|
||||
done:
|
||||
@ -4637,6 +4652,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
|
||||
switch_console_set_complete("add sofia profile ::sofia::list_profiles siptrace on");
|
||||
switch_console_set_complete("add sofia profile ::sofia::list_profiles siptrace off");
|
||||
|
||||
switch_console_set_complete("add sofia profile ::sofia::list_profiles gwlist up");
|
||||
switch_console_set_complete("add sofia profile ::sofia::list_profiles gwlist down");
|
||||
|
||||
switch_console_set_complete("add sofia status profile ::sofia::list_profiles");
|
||||
switch_console_set_complete("add sofia status profile ::sofia::list_profiles reg");
|
||||
switch_console_set_complete("add sofia status gateway ::sofia::list_gateways");
|
||||
|
@ -942,6 +942,7 @@ switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int
|
||||
const char *sofia_glue_strip_proto(const char *uri);
|
||||
switch_status_t reconfig_sofia(sofia_profile_t *profile);
|
||||
void sofia_glue_del_gateway(sofia_gateway_t *gp);
|
||||
void sofia_glue_gateway_list(sofia_profile_t *profile, switch_stream_handle_t *stream, int up);
|
||||
void sofia_glue_del_every_gateway(sofia_profile_t *profile);
|
||||
void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const char *host, const char *contact, const char *user_agent,
|
||||
const char *network_ip);
|
||||
|
@ -4267,6 +4267,28 @@ void sofia_glue_del_every_gateway(sofia_profile_t *profile)
|
||||
}
|
||||
|
||||
|
||||
void sofia_glue_gateway_list(sofia_profile_t *profile, switch_stream_handle_t *stream, int up)
|
||||
{
|
||||
sofia_gateway_t *gp = NULL;
|
||||
char *r = (char *) stream->data;
|
||||
|
||||
switch_mutex_lock(mod_sofia_globals.hash_mutex);
|
||||
for (gp = profile->gateways; gp; gp = gp->next) {
|
||||
int reged = (gp->state == REG_STATE_REGED);
|
||||
|
||||
if (up ? reged : !reged) {
|
||||
stream->write_function(stream, "%s ", gp->name);
|
||||
}
|
||||
}
|
||||
|
||||
if (r) {
|
||||
end_of(r) = '\0';
|
||||
}
|
||||
|
||||
switch_mutex_unlock(mod_sofia_globals.hash_mutex);
|
||||
}
|
||||
|
||||
|
||||
void sofia_glue_del_gateway(sofia_gateway_t *gp)
|
||||
{
|
||||
if (!gp->deleted) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user