]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix some oversights from earlier sip patch
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 1 May 2007 00:26:41 +0000 (00:26 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 1 May 2007 00:26:41 +0000 (00:26 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5047 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c

index e25d2b8c7cc766b2913cb017a5c03876c85e44a8..87daf4a0c000b2f057480356da66fedcd7cbe155 100644 (file)
@@ -953,7 +953,11 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
        if (!strcasecmp(argv[1], "stop")) {
                sofia_clear_pflag_locked(profile, PFLAG_RUNNING);
                stream->write_function(stream, "stopping: %s", profile->name);
-       } 
+       } else if (!strcasecmp(argv[1], "restart")) {
+               sofia_set_pflag_locked(profile, PFLAG_RESPAWN);
+               sofia_clear_pflag_locked(profile, PFLAG_RUNNING);
+               stream->write_function(stream, "restarting: %s", profile->name);
+       }
 
        if (profile) {
                switch_thread_rwlock_unlock(profile->rwlock);
index c42c5f83e43a1b6b9ceef61ba23884026f2bb68c..d4b2ec4e4a7e59641e643fc9230e8a375e22201f 100644 (file)
@@ -110,7 +110,8 @@ typedef enum {
        PFLAG_PASS_RFC2833 = (1 << 5),
        PFLAG_DISABLE_TRANSCODING = (1 << 6),
        PFLAG_REWRITE_TIMESTAMPS = (1 << 7),
-       PFLAG_RUNNING = (1 << 8)
+       PFLAG_RUNNING = (1 << 8),
+       PFLAG_RESPAWN = (1 << 9)
 } PFLAGS;
 
 typedef enum {
index cb5533fbd6d5c3f05c1d0fed751f26b439955544..90ed89433ea3ecbd8c7b6302e1098bbeb1710f34 100644 (file)
@@ -252,7 +252,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
        uint32_t ireg_loops = 0;
        uint32_t gateway_loops = 0;
        switch_event_t *s_event;
-
+       
        switch_mutex_lock(mod_sofia_globals.mutex);
        mod_sofia_globals.threads++;
        switch_mutex_unlock(mod_sofia_globals.mutex);
@@ -384,6 +384,10 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
        sofia_glue_del_profile(profile);
 
        switch_thread_rwlock_unlock(profile->rwlock);
+
+       if (sofia_test_pflag(profile, PFLAG_RESPAWN)) {
+               config_sofia(1, profile->name);
+       }
        
        switch_core_destroy_memory_pool(&pool);
 
@@ -869,6 +873,7 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                                                                        parse_gateways(profile, gateways_tag);
                                                                                }
                                                                        }
+                                                                       switch_xml_free(droot);
                                                                }
                                                        }
                                                        sofia_glue_add_profile(switch_core_strdup(profile->pool, dname), profile);