cause code goodies
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2671 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
387fdc5311
commit
06a0b2c0d5
|
@ -53,7 +53,8 @@ static void audio_bridge_function(switch_core_session_t *session, char *data)
|
||||||
|
|
||||||
if (switch_ivr_originate(session, &peer_session, &cause, data, timelimit, NULL, NULL, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
|
if (switch_ivr_originate(session, &peer_session, &cause, data, timelimit, NULL, NULL, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create Outgoing Channel!\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create Outgoing Channel!\n");
|
||||||
switch_channel_hangup(caller_channel, SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL);
|
/* Hangup the channel with the cause code from the failed originate.*/
|
||||||
|
switch_channel_hangup(caller_channel, cause);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
switch_ivr_multi_threaded_bridge(session, peer_session, NULL, NULL, NULL);
|
switch_ivr_multi_threaded_bridge(session, peer_session, NULL, NULL, NULL);
|
||||||
|
|
|
@ -1555,7 +1555,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
||||||
switch_channel_t *caller_channel = NULL;
|
switch_channel_t *caller_channel = NULL;
|
||||||
switch_memory_pool_t *pool = NULL;
|
switch_memory_pool_t *pool = NULL;
|
||||||
char *data = NULL;
|
char *data = NULL;
|
||||||
int i, argc;
|
int i, argc = 0;
|
||||||
int32_t idx = -1;
|
int32_t idx = -1;
|
||||||
switch_codec_t write_codec = {0};
|
switch_codec_t write_codec = {0};
|
||||||
switch_frame_t write_frame = {0};
|
switch_frame_t write_frame = {0};
|
||||||
|
@ -1850,17 +1850,33 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
||||||
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (caller_channel) {
|
*cause = SWITCH_CAUSE_UNALLOCATED;
|
||||||
*cause = switch_channel_get_cause(caller_channel);
|
|
||||||
|
if (status == SWITCH_STATUS_SUCCESS) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Originate Resulted in Success: [%s]\n", switch_channel_get_name(peer_channel));
|
||||||
} else {
|
} else {
|
||||||
*cause = SWITCH_CAUSE_CHANNEL_UNACCEPTABLE;
|
if (peer_channel) {
|
||||||
|
*cause = switch_channel_get_cause(peer_channel);
|
||||||
|
} else {
|
||||||
|
for (i = 0; i < argc; i++) {
|
||||||
|
if (!peer_channels[i]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
*cause = switch_channel_get_cause(peer_channels[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Originate Resulted in Error Cause: %d [%s]\n", *cause, switch_channel_cause2str(*cause));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (odata) {
|
if (odata) {
|
||||||
free(odata);
|
free(odata);
|
||||||
}
|
}
|
||||||
if (!pass && write_codec.implementation) {
|
if (!pass && write_codec.implementation) {
|
||||||
switch_core_codec_destroy(&write_codec);
|
switch_core_codec_destroy(&write_codec);
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue