]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
allow monitor_early_media and ignore_early_media to work for hmmhesays
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 2 Jun 2010 22:31:08 +0000 (17:31 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 2 Jun 2010 22:31:55 +0000 (17:31 -0500)
src/include/switch_types.h
src/switch_ivr_originate.c

index c5781b524904f9fc9998306d259a06b27e6313e1..55cd26c148db83e8a8549bd810758363e2f04a63 100644 (file)
@@ -1006,6 +1006,7 @@ typedef enum {
        CF_BROADCAST_DROP_MEDIA,
        CF_EARLY_HANGUP,
        CF_MEDIA_SET,
+       CF_CONSUME_ON_ORIGINATE,
        /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
        CF_FLAG_MAX
 } switch_channel_flag_t;
index 47875df4b2efc62192899a783e902b19be6c8f49..2783125dcd7b3dbd1ed7fef280d7356b827e642d 100644 (file)
@@ -39,10 +39,9 @@ static switch_status_t originate_on_consume_media_transmit(switch_core_session_t
 {
        switch_channel_t *channel = switch_core_session_get_channel(session);
 
-       /* testing out not using this, we probably don't need it anymore now that we have audio sync */
-#if 0
-       if (!switch_channel_test_flag(channel, CF_PROXY_MODE)) {
-               while (switch_channel_get_state(channel) == CS_CONSUME_MEDIA && !switch_channel_test_flag(channel, CF_TAGGED)) {
+       if (!switch_channel_test_flag(channel, CF_PROXY_MODE) && switch_channel_test_flag(channel, CF_CONSUME_ON_ORIGINATE)) {
+               while (switch_channel_test_flag(channel, CF_ORIGINATING) &&
+                          switch_channel_get_state(channel) == CS_CONSUME_MEDIA && !switch_channel_test_flag(channel, CF_TAGGED)) {
                        if (!switch_channel_media_ready(channel)) {
                                switch_yield(10000);
                        } else {
@@ -50,7 +49,6 @@ static switch_status_t originate_on_consume_media_transmit(switch_core_session_t
                        }
                }
        }
-#endif
 
        switch_channel_clear_state_handler(channel, &originate_state_handlers);
 
@@ -2612,6 +2610,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                if (table) {
                                        switch_channel_add_state_handler(originate_status[i].peer_channel, table);
                                }
+                               
+                               if (oglobals.monitor_early_media_ring || oglobals.monitor_early_media_fail) {
+                                       switch_channel_set_flag(originate_status[i].peer_channel, CF_CONSUME_ON_ORIGINATE);
+                               }
 
                                switch_channel_add_state_handler(originate_status[i].peer_channel, &originate_state_handlers);