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

fix some logic conditions in originate

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7964 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 49007362
...@@ -534,7 +534,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess ...@@ -534,7 +534,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
} }
if (switch_strlen_zero(data)) { if (switch_strlen_zero(data)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No origination URL specified!\n");
status = SWITCH_STATUS_GENERR; status = SWITCH_STATUS_GENERR;
goto done; goto done;
} }
...@@ -544,9 +544,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess ...@@ -544,9 +544,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
will use as a pseudo hash to consult for params as needed. will use as a pseudo hash to consult for params as needed.
*/ */
if (switch_event_create(&var_event, SWITCH_EVENT_MESSAGE) != SWITCH_STATUS_SUCCESS) { if (switch_event_create(&var_event, SWITCH_EVENT_MESSAGE) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n"); abort();
status = SWITCH_STATUS_MEMERR;
goto done;
} }
if (session) { if (session) {
...@@ -812,7 +810,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess ...@@ -812,7 +810,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
} }
} }
if ((reason = switch_core_session_outgoing_channel(session, chan_type, new_profile, &new_session, &pool, myflags)) != SWITCH_CAUSE_SUCCESS) { if ((reason = switch_core_session_outgoing_channel(session, chan_type, new_profile, &new_session, &pool, myflags)) != SWITCH_CAUSE_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create Outgoing Channel! cause: %s\n", switch_channel_cause2str(reason)); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot create outgoing channel of type [%s] cause: [%s]\n",
chan_type, switch_channel_cause2str(reason));
if (pool) { if (pool) {
switch_core_destroy_memory_pool(&pool); switch_core_destroy_memory_pool(&pool);
} }
...@@ -892,12 +891,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess ...@@ -892,12 +891,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
if (!peer_channels[i]) { if (!peer_channels[i]) {
continue; continue;
} }
valid_channels++;
state = switch_channel_get_state(peer_channels[i]); state = switch_channel_get_state(peer_channels[i]);
if (state >= CS_HANGUP) { if (state < CS_HANGUP) {
goto notready; valid_channels++;
} else if (state >= CS_RING) { } else {
continue;
}
if (state >= CS_RING) {
goto endfor1; goto endfor1;
} }
...@@ -910,7 +913,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess ...@@ -910,7 +913,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
idx = IDX_CANCEL; idx = IDX_CANCEL;
goto notready; goto notready;
} }
switch_yield(1000);
switch_yield(10000);
} }
if (valid_channels == 0) { if (valid_channels == 0) {
...@@ -919,6 +923,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess ...@@ -919,6 +923,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
} }
} }
endfor1: endfor1:
if (ringback_data && !switch_channel_test_flag(caller_channel, CF_ANSWERED) if (ringback_data && !switch_channel_test_flag(caller_channel, CF_ANSWERED)
...@@ -1228,6 +1233,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess ...@@ -1228,6 +1233,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
} }
if (idx == IDX_CANCEL) { if (idx == IDX_CANCEL) {
*cause = SWITCH_CAUSE_ORIGINATOR_CANCEL;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
"Originate Cancelled by originator termination Cause: %d [%s]\n", *cause, switch_channel_cause2str(*cause)); "Originate Cancelled by originator termination Cause: %d [%s]\n", *cause, switch_channel_cause2str(*cause));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论