提交 bf7144b2 authored 作者: Anthony Minessale's avatar Anthony Minessale

...

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4945 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 f40f87eb
...@@ -81,18 +81,13 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj) ...@@ -81,18 +81,13 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
switch_channel_state_t b_state; switch_channel_state_t b_state;
switch_status_t status; switch_status_t status;
switch_event_t *event; switch_event_t *event;
/* if you really want to make sure it's not ready, test it twice because it might be just a break */ /* if you really want to make sure it's not ready, test it twice because it might be just a break */
if (!switch_channel_ready(chan_a) && !switch_channel_ready(chan_a)) { if (!switch_channel_ready(chan_a) && !switch_channel_ready(chan_a)) {
break; break;
} }
b_state = switch_channel_get_state(chan_b); if ((b_state = switch_channel_get_state(chan_b)) >= CS_HANGUP) {
switch (b_state) {
case CS_HANGUP:
case CS_DONE:
default:
break; break;
} }
...@@ -181,11 +176,11 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj) ...@@ -181,11 +176,11 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
} }
} }
switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
msg.string_arg = data->b_uuid; msg.string_arg = data->b_uuid;
msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE; msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE;
msg.from = __FILE__; msg.from = __FILE__;
switch_core_session_receive_message(session_a, &msg); switch_core_session_receive_message(session_a, &msg);
switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
switch_channel_set_variable(chan_a, SWITCH_BRIDGE_VARIABLE, NULL); switch_channel_set_variable(chan_a, SWITCH_BRIDGE_VARIABLE, NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "BRIDGE THREAD DONE [%s]\n", switch_channel_get_name(chan_a)); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "BRIDGE THREAD DONE [%s]\n", switch_channel_get_name(chan_a));
......
...@@ -246,8 +246,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess ...@@ -246,8 +246,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
switch_status_t status = SWITCH_STATUS_SUCCESS; switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_channel_t *caller_channel = NULL; switch_channel_t *caller_channel = NULL;
char *peer_names[MAX_PEERS] = { 0 }; char *peer_names[MAX_PEERS] = { 0 };
switch_core_session_t *peer_session, *peer_sessions[MAX_PEERS] = { 0 }; switch_core_session_t *new_session = NULL, *peer_session, *peer_sessions[MAX_PEERS] = { 0 };
switch_caller_profile_t *caller_profiles[MAX_PEERS] = { 0 }, *caller_caller_profile; switch_caller_profile_t *new_profile = NULL, *caller_profiles[MAX_PEERS] = { 0 }, *caller_caller_profile;
char *chan_type = NULL, *chan_data; char *chan_type = NULL, *chan_data;
switch_channel_t *peer_channel = NULL, *peer_channels[MAX_PEERS] = { 0 }; switch_channel_t *peer_channel = NULL, *peer_channels[MAX_PEERS] = { 0 };
ringback_t ringback = { 0 }; ringback_t ringback = { 0 };
...@@ -427,6 +427,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess ...@@ -427,6 +427,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
memset(peer_sessions, 0, sizeof(peer_sessions)); memset(peer_sessions, 0, sizeof(peer_sessions));
memset(peer_channels, 0, sizeof(peer_channels)); memset(peer_channels, 0, sizeof(peer_channels));
memset(caller_profiles, 0, sizeof(caller_profiles)); memset(caller_profiles, 0, sizeof(caller_profiles));
new_profile = NULL;
new_session = NULL;
chan_type = NULL; chan_type = NULL;
chan_data = NULL; chan_data = NULL;
peer_channel = NULL; peer_channel = NULL;
...@@ -474,16 +476,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess ...@@ -474,16 +476,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
cid_num_override = caller_caller_profile->caller_id_number; cid_num_override = caller_caller_profile->caller_id_number;
} }
caller_profiles[i] = switch_caller_profile_new(switch_core_session_get_pool(session), new_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
caller_caller_profile->username, caller_caller_profile->username,
caller_caller_profile->dialplan, caller_caller_profile->dialplan,
cid_name_override, cid_name_override,
cid_num_override, cid_num_override,
caller_caller_profile->network_addr, caller_caller_profile->network_addr,
NULL, NULL,
NULL, NULL,
caller_caller_profile->rdnis, caller_caller_profile->rdnis,
caller_caller_profile->source, caller_caller_profile->context, chan_data); caller_caller_profile->source, caller_caller_profile->context, chan_data);
caller_profiles[i]->flags = caller_caller_profile->flags; caller_profiles[i]->flags = caller_caller_profile->flags;
pool = NULL; pool = NULL;
} else { } else {
...@@ -501,42 +503,44 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess ...@@ -501,42 +503,44 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
} }
if (caller_profile_override) { if (caller_profile_override) {
caller_profiles[i] = switch_caller_profile_new(pool, new_profile = switch_caller_profile_new(pool,
caller_profile_override->username, caller_profile_override->username,
caller_profile_override->dialplan, caller_profile_override->dialplan,
caller_profile_override->caller_id_name, caller_profile_override->caller_id_name,
caller_profile_override->caller_id_number, caller_profile_override->caller_id_number,
caller_profile_override->network_addr, caller_profile_override->network_addr,
caller_profile_override->ani, caller_profile_override->ani,
caller_profile_override->aniii, caller_profile_override->aniii,
caller_profile_override->rdnis, caller_profile_override->rdnis,
caller_profile_override->source, caller_profile_override->context, chan_data); caller_profile_override->source, caller_profile_override->context, chan_data);
} else { } else {
caller_profiles[i] = switch_caller_profile_new(pool, new_profile = switch_caller_profile_new(pool,
NULL, NULL,
NULL, NULL,
cid_name_override, cid_num_override, NULL, NULL, NULL, NULL, __FILE__, NULL, cid_name_override, cid_num_override, NULL, NULL, NULL, NULL, __FILE__, NULL,
chan_data); chan_data);
} }
} }
if ((reason = caller_profiles[i] = NULL;
switch_core_session_outgoing_channel(session, chan_type, caller_profiles[i], &peer_sessions[i], &pool)) != SWITCH_CAUSE_SUCCESS) { peer_channels[i] = NULL;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create Outgoing Channel! cause: %s\n", peer_sessions[i] = NULL;
switch_channel_cause2str(reason)); new_session = NULL;
if ((reason = switch_core_session_outgoing_channel(session, chan_type, new_profile, &new_session, &pool)) != SWITCH_CAUSE_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create Outgoing Channel! cause: %s\n", switch_channel_cause2str(reason));
if (pool) { if (pool) {
switch_core_destroy_memory_pool(&pool); switch_core_destroy_memory_pool(&pool);
} }
caller_profiles[i] = NULL;
peer_channels[i] = NULL;
peer_sessions[i] = NULL;
continue; continue;
} }
switch_core_session_read_lock(peer_sessions[i]); switch_core_session_read_lock(peer_sessions[i]);
pool = NULL; pool = NULL;
peer_channels[i] = switch_core_session_get_channel(peer_sessions[i]); caller_profiles[i] = new_profile;
peer_sessions[i] = new_session;
peer_channels[i] = switch_core_session_get_channel(new_session);
assert(peer_channels[i] != NULL); assert(peer_channels[i] != NULL);
if (!table) { if (!table) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论