fix some logic conditions in originate
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7964 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
4900736291
commit
d57e0387e6
|
@ -534,7 +534,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||
}
|
||||
|
||||
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;
|
||||
goto done;
|
||||
}
|
||||
|
@ -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.
|
||||
*/
|
||||
if (switch_event_create(&var_event, SWITCH_EVENT_MESSAGE) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
|
||||
status = SWITCH_STATUS_MEMERR;
|
||||
goto done;
|
||||
abort();
|
||||
}
|
||||
|
||||
if (session) {
|
||||
|
@ -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) {
|
||||
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) {
|
||||
switch_core_destroy_memory_pool(&pool);
|
||||
}
|
||||
|
@ -892,12 +891,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||
if (!peer_channels[i]) {
|
||||
continue;
|
||||
}
|
||||
valid_channels++;
|
||||
|
||||
state = switch_channel_get_state(peer_channels[i]);
|
||||
|
||||
if (state >= CS_HANGUP) {
|
||||
goto notready;
|
||||
} else if (state >= CS_RING) {
|
||||
if (state < CS_HANGUP) {
|
||||
valid_channels++;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (state >= CS_RING) {
|
||||
goto endfor1;
|
||||
}
|
||||
|
||||
|
@ -910,7 +913,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||
idx = IDX_CANCEL;
|
||||
goto notready;
|
||||
}
|
||||
switch_yield(1000);
|
||||
|
||||
switch_yield(10000);
|
||||
}
|
||||
|
||||
if (valid_channels == 0) {
|
||||
|
@ -919,6 +923,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
endfor1:
|
||||
|
||||
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
|
|||
}
|
||||
|
||||
if (idx == IDX_CANCEL) {
|
||||
*cause = SWITCH_CAUSE_ORIGINATOR_CANCEL;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||
"Originate Cancelled by originator termination Cause: %d [%s]\n", *cause, switch_channel_cause2str(*cause));
|
||||
|
||||
|
|
Loading…
Reference in New Issue