]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add killgw _all_ to delete all gws
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 31 Mar 2010 20:02:50 +0000 (15:02 -0500)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 31 Mar 2010 20:02:50 +0000 (15:02 -0500)
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia_glue.c

index cf8b365f29163fc86c1d61b1fc84fd75c3097f92..6657cfd2c23f8e8edcce1f2307de949513700cdd 100644 (file)
@@ -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;
index bff6087cfd85c39066f4604733b4059b7c7593ae..c03da5f648de1831fd0cf5d8edb4ea7471242bea 100644 (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);
 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);
index aeffdbfc4928c0d034674b08d140065dada4aa35..782e62dd9080cd26823d5f9d1464c5478a0eb773 100644 (file)
@@ -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) {