fix last commit typos and return hangup cause on failure in funky pri boost early media fail scenario

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@994 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Michael Jerris 2010-01-21 05:35:53 +00:00
parent 72e37bd888
commit a9953ac8e1
2 changed files with 27 additions and 10 deletions

View File

@ -1160,7 +1160,12 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
if (status != ZAP_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No channels available\n");
return SWITCH_CAUSE_NORMAL_CIRCUIT_CONGESTION;
if (caller_data.hangup_cause == SWITCH_CAUSE_NONE) {
caller_data.hangup_cause = SWITCH_CAUSE_NORMAL_CIRCUIT_CONGESTION;
}
return caller_data.hangup_cause;
}
if ((var = switch_event_get_header(var_event, "openzap_pre_buffer_size"))) {

View File

@ -71,6 +71,7 @@ typedef struct {
sangomabc_short_event_t event;
zap_span_t *span;
zap_channel_t *zchan;
int hangup_cause;
} sangoma_boost_request_t;
//#define MAX_REQ_ID ZAP_MAX_PHYSICAL_SPANS_PER_LOGICAL_SPAN * ZAP_MAX_CHANNELS_PHYSICAL_SPAN
@ -395,18 +396,26 @@ static ZIO_CHANNEL_REQUEST_FUNCTION(sangoma_boost_channel_request)
if (OUTBOUND_REQUESTS[r].zchan && OUTBOUND_REQUESTS[r].status != BST_READY && zap_test_flag((OUTBOUND_REQUESTS[r].zchan), ZAP_CHANNEL_INUSE)) {
status = ZAP_FAIL;
*zchan = NULL;
OUTBOUND_REQUESTS[event->call_setup_id].zchan = NULL;
if (zchan->extra_id) {
zchan->extra_id = 0;
if (OUTBOUND_REQUESTS[r].zchan->extra_id) {
OUTBOUND_REQUESTS[r].zchan->extra_id = 0;
}
zchan->sflags = 0;
zchan->call_data = NULL;
zap_channel_done(zchan);
(OUTBOUND_REQUESTS[r].zchan)->sflags = 0;
(OUTBOUND_REQUESTS[r].zchan)->call_data = NULL;
zap_channel_done((OUTBOUND_REQUESTS[r].zchan));
OUTBOUND_REQUESTS[r].zchan = NULL;
}
st = OUTBOUND_REQUESTS[r].status;
OUTBOUND_REQUESTS[r].status = BST_FREE;
if (status == ZAP_FAIL) {
if (st == BST_FAIL) {
caller_data->hangup_cause = OUTBOUND_REQUESTS[r].hangup_cause;
} else {
caller_data->hangup_cause = ZAP_CAUSE_RECOVERY_ON_TIMER_EXPIRE;
}
}
if (st == BST_FAIL) {
release_request_id(r);
} else if (st != BST_READY) {
@ -496,6 +505,7 @@ static void handle_call_progress(sangomabc_connection_t *mcon, sangomabc_short_e
SIGBOOST_EVENT_CALL_STOPPED,
ZAP_CAUSE_DESTINATION_OUT_OF_ORDER);
OUTBOUND_REQUESTS[event->call_setup_id].status = BST_FAIL;
OUTBOUND_REQUESTS[event->call_setup_id].hangup_cause = ZAP_CAUSE_DESTINATION_OUT_OF_ORDER;
}
/**
@ -543,6 +553,7 @@ static void handle_call_start_ack(sangomabc_connection_t *mcon, sangomabc_short_
SIGBOOST_EVENT_CALL_STOPPED,
ZAP_CAUSE_DESTINATION_OUT_OF_ORDER);
OUTBOUND_REQUESTS[event->call_setup_id].status = BST_FAIL;
OUTBOUND_REQUESTS[event->call_setup_id].hangup_cause = ZAP_CAUSE_DESTINATION_OUT_OF_ORDER;
}
@ -633,6 +644,7 @@ static void handle_call_start_nack(zap_span_t *span, sangomabc_connection_t *mco
OUTBOUND_REQUESTS[event->call_setup_id].event = *event;
OUTBOUND_REQUESTS[event->call_setup_id].status = BST_FAIL;
OUTBOUND_REQUESTS[event->call_setup_id].hangup_cause = event->release_cause;
return;
} else {
if ((zchan = find_zchan(span, event, 1))) {