fix some bypass media scenarios

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16480 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Brian West 2010-01-23 18:35:05 +00:00
parent ae25849888
commit 8f7a3e43dc
4 changed files with 26 additions and 9 deletions

View File

@ -2071,6 +2071,7 @@ SWITCH_DECLARE(void) switch_cache_db_detach(void);
SWITCH_DECLARE(uint32_t) switch_core_debug_level(void);
SWITCH_DECLARE(void) switch_cache_db_flush_handles(void);
SWITCH_DECLARE(const char *) switch_core_banner(void);
SWITCH_DECLARE(switch_bool_t) switch_core_session_in_thread(switch_core_session_t *session);
SWITCH_END_EXTERN_C
#endif

View File

@ -1141,6 +1141,14 @@ SWITCH_DECLARE(void) switch_core_session_disable_heartbeat(switch_core_session_t
}
SWITCH_DECLARE(switch_bool_t) switch_core_session_in_thread(switch_core_session_t *session)
{
if (switch_thread_self() == session->thread_id) {
return SWITCH_TRUE;
}
return SWITCH_FALSE;
}
static void *SWITCH_THREAD_FUNC switch_core_session_thread(switch_thread_t *thread, void *obj)
{
switch_core_session_t *session = obj;

View File

@ -1286,7 +1286,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(const char *uuid, switch_medi
if (other_channel) {
switch_channel_wait_for_state(other_channel, channel, CS_PARK);
}
switch_channel_wait_for_state_timeout(channel, CS_PARK, 5000000);
if (switch_core_session_in_thread(session)) {
switch_yield(100000);
}
switch_channel_clear_flag(channel, CF_NOT_READY);
@ -1300,7 +1302,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(const char *uuid, switch_medi
switch_ivr_signal_bridge(session, other_session);
}
switch_channel_wait_for_state(other_channel, channel, CS_HIBERNATE);
switch_channel_wait_for_state(channel, other_channel, CS_HIBERNATE);
if (switch_core_session_in_thread(session)) {
switch_yield(100000);
}
switch_core_session_rwunlock(other_session);
}
}

View File

@ -30,7 +30,7 @@
*/
#include <switch.h>
#define DEFAULT_LEAD_FRAMES 5
#define DEFAULT_LEAD_FRAMES 10
static const switch_state_handler_table_t audio_bridge_peer_state_handlers;
static void cleanup_proxy_mode_a(switch_core_session_t *session);
@ -839,19 +839,23 @@ static switch_status_t signal_bridge_on_hangup(switch_core_session_t *session)
switch_channel_set_variable(other_channel, SWITCH_BRIDGE_VARIABLE, NULL);
if (switch_channel_up(other_channel)) {
if (switch_true(switch_channel_get_variable(other_channel, SWITCH_PARK_AFTER_BRIDGE_VARIABLE))) {
switch_ivr_park_session(other_session);
} else if ((var = switch_channel_get_variable(other_channel, SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE))) {
transfer_after_bridge(other_session, var);
}
if (switch_channel_test_flag(other_channel, CF_BRIDGE_ORIGINATOR) &&
switch_channel_test_flag(channel, CF_ANSWERED) &&
if (switch_channel_test_flag(other_channel, CF_BRIDGE_ORIGINATOR)) {
if (switch_channel_test_flag(channel, CF_ANSWERED) &&
switch_true(switch_channel_get_variable(other_channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE))) {
switch_channel_hangup(other_channel, switch_channel_get_cause(channel));
} else {
switch_channel_set_state(other_channel, CS_EXECUTE);
}
} else {
switch_channel_hangup(other_channel, switch_channel_get_cause(channel));
}
}
}