add killgw _all_ to delete all gws

This commit is contained in:
Anthony Minessale 2010-03-31 15:02:50 -05:00
parent b6aaea1e9e
commit 89f399832d
3 changed files with 24 additions and 5 deletions

View File

@ -2604,6 +2604,10 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
goto done; goto done;
} }
if (!strcasecmp(argv[2], "_all_")) {
sofia_glue_del_every_gateway(profile);
stream->write_function(stream, "+OK every gateway marked for deletion.\n");
} else {
if ((gateway_ptr = sofia_reg_find_gateway(argv[2]))) { if ((gateway_ptr = sofia_reg_find_gateway(argv[2]))) {
sofia_glue_del_gateway(gateway_ptr); sofia_glue_del_gateway(gateway_ptr);
sofia_reg_release_gateway(gateway_ptr); sofia_reg_release_gateway(gateway_ptr);
@ -2611,6 +2615,7 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
} else { } else {
stream->write_function(stream, "-ERR no such gateway.\n"); stream->write_function(stream, "-ERR no such gateway.\n");
} }
}
goto done; goto done;
} }

View File

@ -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); const char *sofia_glue_strip_proto(const char *uri);
switch_status_t reconfig_sofia(sofia_profile_t *profile); switch_status_t reconfig_sofia(sofia_profile_t *profile);
void sofia_glue_del_gateway(sofia_gateway_t *gp); 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, 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); const char *network_ip);
void sofia_glue_restart_all_profiles(void); void sofia_glue_restart_all_profiles(void);

View File

@ -3932,6 +3932,19 @@ switch_status_t sofia_glue_add_profile(char *key, sofia_profile_t *profile)
return status; 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) void sofia_glue_del_gateway(sofia_gateway_t *gp)
{ {
if (!gp->deleted) { if (!gp->deleted) {