]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add case for kill sigs
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 21 Dec 2006 16:46:11 +0000 (16:46 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 21 Dec 2006 16:46:11 +0000 (16:46 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3778 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_dingaling/mod_dingaling.c
src/mod/endpoints/mod_iax/mod_iax.c
src/mod/endpoints/mod_portaudio/mod_portaudio.c
src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
src/mod/endpoints/mod_woomera/mod_woomera.c

index 47d85295d36aee2e7788657d3a363413209e60fe..a7476bb3fac3b74d9581b131ef5a6427589ac28b 100644 (file)
@@ -1131,28 +1131,41 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int
        switch_channel_t *channel = NULL;
        struct private_object *tech_pvt = NULL;
 
-       if ((channel = switch_core_session_get_channel(session))) {
-               if ((tech_pvt = switch_core_session_get_private(session))) {
-                       switch_clear_flag_locked(tech_pvt, TFLAG_IO);
-                       switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
-                       switch_set_flag_locked(tech_pvt, TFLAG_BYE);
+    if (!(channel = switch_core_session_get_channel(session))) {
+        return SWITCH_STATUS_SUCCESS;
+    }
 
-                       if (tech_pvt->dlsession) {
-                               if (!switch_test_flag(tech_pvt, TFLAG_TERM)) {
-                                       ldl_session_terminate(tech_pvt->dlsession);
-                                       switch_set_flag_locked(tech_pvt, TFLAG_TERM);
-                               }
-                               ldl_session_destroy(&tech_pvt->dlsession);
+    if (!(tech_pvt = switch_core_session_get_private(session))) {
+        return SWITCH_STATUS_SUCCESS;
+    }
+    
+
+    switch (sig) {
+    case SWITCH_SIG_KILL:
+        switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+        switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+        switch_set_flag_locked(tech_pvt, TFLAG_BYE);
+
+        if (tech_pvt->dlsession) {
+            if (!switch_test_flag(tech_pvt, TFLAG_TERM)) {
+                ldl_session_terminate(tech_pvt->dlsession);
+                switch_set_flag_locked(tech_pvt, TFLAG_TERM);
+            }
+            ldl_session_destroy(&tech_pvt->dlsession);
+            
+        }
 
-                       }
+        if (switch_rtp_ready(tech_pvt->rtp_session)) {
+            switch_rtp_kill_socket(tech_pvt->rtp_session);
+        }
+        break;
+       case SWITCH_SIG_BREAK:
+               switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_BREAK);
+               break;
+    }
 
-                       if (switch_rtp_ready(tech_pvt->rtp_session)) {
-                               switch_rtp_kill_socket(tech_pvt->rtp_session);
-                       }
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
 
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
-               }
-       }
 
        return SWITCH_STATUS_SUCCESS;
 }
index 6baccc4da4a213aae068de6b6bc9a7971bdfdec3..f9aa925c778cdd5d28370c2726fe995a7a569325 100644 (file)
@@ -566,11 +566,16 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int
        tech_pvt = switch_core_session_get_private(session);
        assert(tech_pvt != NULL);
 
-       switch_clear_flag_locked(tech_pvt, TFLAG_IO);
-       switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
-       switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
-       //switch_thread_cond_signal(tech_pvt->cond);
-
+    switch(sig) {
+    case SWITCH_SIG_KILL:
+        switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+        switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+        switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+        //switch_thread_cond_signal(tech_pvt->cond);
+        break;
+    default:
+        break;
+    }
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
 
 
index 9a4a73057bad1510ad5ea7e0c780170d5e06537d..d7f203217d3bb709cf27f9a44793b03e338d2f09 100644 (file)
@@ -273,10 +273,15 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int
        tech_pvt = switch_core_session_get_private(session);
        assert(tech_pvt != NULL);
 
-       switch_clear_flag_locked(tech_pvt, TFLAG_IO);
-       deactivate_audio_device(tech_pvt);
-       switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
-
+    switch (sig) {
+    case SWITCH_SIG_KILL:
+        switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+        deactivate_audio_device(tech_pvt);
+        switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+        break;
+    default:
+        break;
+    }
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
 
 
index d61b8509c0df9c8488746fc0d562a7871beae51b..ff64b6ce546d095944037a898dcd4713b31c9a3f 100644 (file)
@@ -755,11 +755,16 @@ static switch_status_t wanpipe_kill_channel(switch_core_session_t *session, int
        tech_pvt = switch_core_session_get_private(session);
        assert(tech_pvt != NULL);
 
-       switch_mutex_lock(tech_pvt->flag_mutex);
-       switch_set_flag(tech_pvt, TFLAG_BYE);
-       switch_clear_flag(tech_pvt, TFLAG_MEDIA);
-       switch_mutex_unlock(tech_pvt->flag_mutex);
-
+       switch(sig) {
+       case SWITCH_SIG_KILL:
+               switch_mutex_lock(tech_pvt->flag_mutex);
+               switch_set_flag(tech_pvt, TFLAG_BYE);
+               switch_clear_flag(tech_pvt, TFLAG_MEDIA);
+               switch_mutex_unlock(tech_pvt->flag_mutex);
+               break;
+       default:
+               break;
+       }
        //sangoma_socket_close(&tech_pvt->wpsock->fd);
        //wp_close(tech_pvt);
 
index a31633919b133f5a31a9df5d5f9e0ae42e956950..3fdbc6380a23219fab9f7fffb7ec5afa0214e89e 100644 (file)
@@ -327,11 +327,19 @@ static switch_status_t woomerachan_kill_channel(switch_core_session_t *session,
                return SWITCH_STATUS_FALSE;
        }
 
-       udp_socket_close(tech_pvt);
-
-       switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s WOOMERACHAN KILL\n", switch_channel_get_name(channel));
-                                                 
+    switch(sig) {
+    case SWITCH_SIG_KILL:
+        udp_socket_close(tech_pvt);
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s WOOMERACHAN KILL\n", switch_channel_get_name(channel));
+        break;
+    case SWITCH_SIG_BREAK:
+        {
+            int p = 0;
+            switch_size_t len = sizeof(p);
+            switch_socket_sendto(tech_pvt->udp_socket, tech_pvt->udpwrite, 0, &p, &len);
+        }
+        break;
+    }
 
 
        return SWITCH_STATUS_SUCCESS;