]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add break to iax
authorAnthony Minessale <anthony.minessale@gmail.com>
Sat, 30 Dec 2006 17:22:17 +0000 (17:22 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Sat, 30 Dec 2006 17:22:17 +0000 (17:22 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3872 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_iax/mod_iax.c

index f9aa925c778cdd5d28370c2726fe995a7a569325..fd7d8626d7bfcfef76909759c6d46478e4acca51 100644 (file)
@@ -56,7 +56,8 @@ typedef enum {
        TFLAG_VOICE = (1 << 4),
        TFLAG_HANGUP = (1 << 5),
        TFLAG_LINEAR = (1 << 6),
-       TFLAG_CODEC = (1 << 7)
+       TFLAG_CODEC = (1 << 7),
+       TFLAG_BREAK = (1 << 8)
 } TFLAGS;
 
 typedef enum {
@@ -573,6 +574,9 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int
         switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
         //switch_thread_cond_signal(tech_pvt->cond);
         break;
+    case SWITCH_SIG_BREAK:
+        switch_set_flag_locked(tech_pvt, TFLAG_BREAK);
+        break;
     default:
         break;
     }
@@ -644,10 +648,19 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
 
        tech_pvt = switch_core_session_get_private(session);
        assert(tech_pvt != NULL);
-
-
+    tech_pvt->read_frame.flags = SFF_NONE;
+    
        while (switch_test_flag(tech_pvt, TFLAG_IO)) {
                //switch_thread_cond_wait(tech_pvt->cond, tech_pvt->mutex);
+               if (switch_test_flag_locked(tech_pvt, TFLAG_BREAK)) {
+            switch_clear_flag(tech_pvt, TFLAG_BREAK);
+            tech_pvt->read_frame.datalen = 13;
+            memset(tech_pvt->read_frame.data, 0, 13);
+            tech_pvt->read_frame.flags = SFF_CNG; 
+            *frame = &tech_pvt->read_frame;
+            return SWITCH_STATUS_SUCCESS;
+        }
+
                if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
                        return SWITCH_STATUS_FALSE;
                }