add killgw _all_ to delete all gws
This commit is contained in:
parent
b6aaea1e9e
commit
89f399832d
|
@ -2604,12 +2604,17 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
|
|||
goto done;
|
||||
}
|
||||
|
||||
if ((gateway_ptr = sofia_reg_find_gateway(argv[2]))) {
|
||||
sofia_glue_del_gateway(gateway_ptr);
|
||||
sofia_reg_release_gateway(gateway_ptr);
|
||||
stream->write_function(stream, "+OK gateway marked for deletion.\n");
|
||||
if (!strcasecmp(argv[2], "_all_")) {
|
||||
sofia_glue_del_every_gateway(profile);
|
||||
stream->write_function(stream, "+OK every gateway marked for deletion.\n");
|
||||
} else {
|
||||
stream->write_function(stream, "-ERR no such gateway.\n");
|
||||
if ((gateway_ptr = sofia_reg_find_gateway(argv[2]))) {
|
||||
sofia_glue_del_gateway(gateway_ptr);
|
||||
sofia_reg_release_gateway(gateway_ptr);
|
||||
stream->write_function(stream, "+OK gateway marked for deletion.\n");
|
||||
} else {
|
||||
stream->write_function(stream, "-ERR no such gateway.\n");
|
||||
}
|
||||
}
|
||||
|
||||
goto done;
|
||||
|
|
|
@ -915,6 +915,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_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);
|
||||
void sofia_glue_restart_all_profiles(void);
|
||||
|
|
|
@ -3932,6 +3932,19 @@ switch_status_t sofia_glue_add_profile(char *key, sofia_profile_t *profile)
|
|||
return status;
|
||||
}
|
||||
|
||||
|
||||
void sofia_glue_del_every_gateway(sofia_profile_t *profile)
|
||||
{
|
||||
sofia_gateway_t *gp = NULL;
|
||||
|
||||
switch_mutex_lock(mod_sofia_globals.hash_mutex);
|
||||
for (gp = profile->gateways; gp; gp = gp->next) {
|
||||
sofia_glue_del_gateway(gp);
|
||||
}
|
||||
switch_mutex_unlock(mod_sofia_globals.hash_mutex);
|
||||
}
|
||||
|
||||
|
||||
void sofia_glue_del_gateway(sofia_gateway_t *gp)
|
||||
{
|
||||
if (!gp->deleted) {
|
||||
|
|
Loading…
Reference in New Issue