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;
}
}
+ switch_channel_clear_flag(channel, CF_MEDIA_TRANS);
switch_core_session_rwunlock(session);
if (other_channel) {
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;
}
switch_core_session_rwunlock(other_session);
}
}
- switch_core_session_rwunlock(session);
+
+ switch_channel_clear_flag(channel, CF_MEDIA_TRANS);
}
+
+
return status;
}