]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-4729 try this patch clean
authorAnthony Minessale <anthm@freeswitch.org>
Mon, 22 Oct 2012 17:37:41 +0000 (13:37 -0400)
committerAnthony Minessale <anthm@freeswitch.org>
Mon, 22 Oct 2012 17:37:41 +0000 (13:37 -0400)
src/include/switch_types.h
src/switch_ivr.c

index c4c2ed7190f23a4b1f75508bdbd3cf80536976dd..b766d1db408fc2c41788b66e12880df8f8a6b141 100644 (file)
@@ -1249,6 +1249,7 @@ typedef enum {
        CF_TRACKABLE,
        CF_NO_CDR,
        CF_EARLY_OK,
+       CF_MEDIA_TRANS,
        /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
        /* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */
        CF_FLAG_MAX
index b6c1127b3157abe98844262a81d4fa4556dc6320..b8fd0923e3638ebc8beed2228e13b3d0726d4f54 100644 (file)
@@ -1476,6 +1476,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_media(const char *uuid, switch_media_
 
        if ((session = switch_core_session_locate(uuid))) {
                channel = switch_core_session_get_channel(session);
+               
+               if (switch_channel_test_flag(channel, CF_MEDIA_TRANS)) {
+                       switch_core_session_rwunlock(session);
+                       return SWITCH_STATUS_INUSE;
+               }
+
+               switch_channel_set_flag(channel, CF_MEDIA_TRANS);
 
                if ((flags & SMF_REBRIDGE) && !switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
                        swap = 1;
@@ -1527,6 +1534,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_media(const char *uuid, switch_media_
                        }
                }
 
+               switch_channel_clear_flag(channel, CF_MEDIA_TRANS);
                switch_core_session_rwunlock(session);
 
                if (other_channel) {
@@ -1559,6 +1567,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(const char *uuid, switch_medi
                status = SWITCH_STATUS_SUCCESS;
                channel = switch_core_session_get_channel(session);
 
+               if (switch_channel_test_flag(channel, CF_MEDIA_TRANS)) {
+                       switch_core_session_rwunlock(session);
+                       return SWITCH_STATUS_INUSE;
+               }
+
+               switch_channel_set_flag(channel, CF_MEDIA_TRANS);
+
                if ((flags & SMF_REBRIDGE) && !switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
                        swap = 1;
                }
@@ -1617,9 +1632,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(const char *uuid, switch_medi
                                switch_core_session_rwunlock(other_session);
                        }
                }
-               switch_core_session_rwunlock(session);
+
+               switch_channel_clear_flag(channel, CF_MEDIA_TRANS);
        }
 
+
+
        return status;
 }