]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-9806: [mod_loopback] mod_loopback: bowout is always done even if set to false...
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 20 Dec 2016 17:08:17 +0000 (11:08 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 20 Dec 2016 17:08:17 +0000 (11:08 -0600)
src/mod/endpoints/mod_loopback/mod_loopback.c
src/switch_core_media.c

index 3a01377c10431372e238753d48300560c44caf70..dfd97b900bf4eccef6225c9599fc95bea8ffe8d7 100644 (file)
@@ -293,6 +293,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
 
 
                switch_channel_set_flag(channel, CF_ACCEPT_CNG);
+               switch_channel_set_flag(channel, CF_AUDIO);
 
                if ((vars = (switch_event_t *) switch_channel_get_private(channel, "__loopback_vars__"))) {
                        switch_event_header_t *h;
@@ -1085,7 +1086,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
                switch_event_t *clone = NULL;
 
                switch_core_session_add_stream(*new_session, NULL);
-
+               
                if ((tech_pvt = (loopback_private_t *) switch_core_session_alloc(*new_session, sizeof(loopback_private_t))) != 0) {
                        channel = switch_core_session_get_channel(*new_session);
                        switch_snprintf(name, sizeof(name), "loopback/%s-a", outbound_profile->destination_number);
@@ -1172,7 +1173,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
                }
 
                switch_channel_set_state(channel, CS_INIT);
-
+               switch_channel_set_flag(channel, CF_AUDIO);
                return SWITCH_CAUSE_SUCCESS;
        }
 
index c4e9b66b045dc5576c75eebd15596175c8c3ecdc..94ba63dc4db9a0a2a328ce0f250c07806ad06c9c 100644 (file)
@@ -6162,24 +6162,21 @@ static switch_status_t perform_write(switch_core_session_t *session, switch_fram
 {
        switch_io_event_hook_write_frame_t *ptr;
        switch_status_t status = SWITCH_STATUS_FALSE;
-       switch_rtp_engine_t *a_engine;
        switch_media_handle_t *smh;
 
        switch_assert(session != NULL);
 
-       if (!(smh = session->media_handle)) {
-               return SWITCH_STATUS_FALSE;
-       }
-
-       a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO];
+       if ((smh = session->media_handle)) {
+               switch_rtp_engine_t *a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO];
 
-       if (a_engine && a_engine->write_fb && !(flags & SWITCH_IO_FLAG_QUEUED)) {
-               switch_frame_t *dupframe = NULL;
-
-               if (switch_frame_buffer_dup(a_engine->write_fb, frame, &dupframe) == SWITCH_STATUS_SUCCESS) {
-                       switch_frame_buffer_push(a_engine->write_fb, dupframe);
-                       dupframe = NULL;
-                       return SWITCH_STATUS_SUCCESS;
+               if (a_engine && a_engine->write_fb && !(flags & SWITCH_IO_FLAG_QUEUED)) {
+                       switch_frame_t *dupframe = NULL;
+                       
+                       if (switch_frame_buffer_dup(a_engine->write_fb, frame, &dupframe) == SWITCH_STATUS_SUCCESS) {
+                               switch_frame_buffer_push(a_engine->write_fb, dupframe);
+                               dupframe = NULL;
+                               return SWITCH_STATUS_SUCCESS;
+                       }
                }
        }
 
@@ -14305,7 +14302,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
        switch_assert(session != NULL);
        switch_assert(frame != NULL);
 
-       if (!switch_channel_ready(session->channel)) {
+       if (!switch_channel_up_nosig(session->channel)) {
                return SWITCH_STATUS_FALSE;
        }