git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3563 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2006-12-07 04:06:46 +00:00
parent 20bc2fde18
commit 243a820dff
1 changed files with 21 additions and 12 deletions

View File

@ -2365,6 +2365,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
} }
for (r = 0; r < or_argc; r++) { for (r = 0; r < or_argc; r++) {
reason = SWITCH_CAUSE_UNALLOCATED;
memset(peer_names, 0, sizeof(peer_names)); memset(peer_names, 0, sizeof(peer_names));
peer_session = NULL; peer_session = NULL;
memset(peer_sessions, 0, sizeof(peer_sessions)); memset(peer_sessions, 0, sizeof(peer_sessions));
@ -2732,7 +2733,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
} }
if (i != idx) { if (i != idx) {
if (idx == IDX_CANCEL) { if (idx == IDX_CANCEL) {
if (to) {
reason = SWITCH_CAUSE_NO_ANSWER;
} else {
reason = SWITCH_CAUSE_ORIGINATOR_CANCEL; reason = SWITCH_CAUSE_ORIGINATOR_CANCEL;
}
} else { } else {
if (to) { if (to) {
reason = SWITCH_CAUSE_NO_ANSWER; reason = SWITCH_CAUSE_NO_ANSWER;
@ -2743,6 +2748,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
} }
} }
switch_channel_hangup(peer_channels[i], reason); switch_channel_hangup(peer_channels[i], reason);
} }
} }
@ -2793,25 +2799,28 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
} }
} }
if (caller_channel) { if (reason != SWITCH_CAUSE_UNALLOCATED) {
if (idx == IDX_CANCEL) { *cause = reason;
} else if (caller_channel) {
*cause = switch_channel_get_cause(caller_channel); *cause = switch_channel_get_cause(caller_channel);
} else {
*cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
} }
switch_channel_set_variable(caller_channel, "originate_disposition", switch_channel_cause2str(*cause));
}
if (idx == IDX_CANCEL) { if (idx == IDX_CANCEL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Originate Cancelled by originator termination Cause: %d [%s]\n", switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Originate Cancelled by originator termination Cause: %d [%s]\n",
*cause, switch_channel_cause2str(*cause)); *cause, switch_channel_cause2str(*cause));
if (peer_channel) {
switch_channel_hangup(peer_channel, SWITCH_CAUSE_ORIGINATOR_CANCEL);
}
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Originate Resulted in Error Cause: %d [%s]\n", switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Originate Resulted in Error Cause: %d [%s]\n",
*cause, switch_channel_cause2str(*cause)); *cause, switch_channel_cause2str(*cause));
} }
} }
if (caller_channel) {
switch_channel_set_variable(caller_channel, "originate_disposition", switch_channel_cause2str(*cause));
}
if (!pass && write_codec.implementation) { if (!pass && write_codec.implementation) {
switch_core_codec_destroy(&write_codec); switch_core_codec_destroy(&write_codec);
} }