static zap_mutex_t *signal_mutex = NULL;
static uint8_t req_map[MAX_REQ_ID+1] = { 0 };
+static uint8_t nack_map[MAX_REQ_ID+1] = { 0 };
static void __release_request_id_span_chan(int span, int chan, const char *func, int line)
{
zap_mutex_lock(request_mutex);
if ((id = SETUP_GRID[span][chan])) {
+ assert(id <= MAX_REQ_ID);
req_map[id] = 0;
SETUP_GRID[span][chan] = 0;
}
static void __release_request_id(ss7_boost_request_id_t r, const char *func, int line)
{
+ assert(r <= MAX_REQ_ID);
zap_mutex_lock(request_mutex);
req_map[r] = 0;
zap_mutex_unlock(request_mutex);
if (st == BST_FAIL) {
release_request_id(r);
} else if (st != BST_READY) {
+ assert(r <= MAX_REQ_ID);
+ nack_map[r] = 1;
ss7bc_exec_command(&ss7_boost_data->mcon,
0,
0,
{
zap_channel_t *zchan;
+ if (nack_map[event->call_setup_id]) {
+ return;
+ }
+
OUTBOUND_REQUESTS[event->call_setup_id].event = *event;
- zap_mutex_lock(request_mutex);
- assert(SETUP_GRID[event->span][event->chan] == 0);
SETUP_GRID[event->span][event->chan] = event->call_setup_id;
- zap_mutex_unlock(request_mutex);
if ((zchan = find_zchan(OUTBOUND_REQUESTS[event->call_setup_id].span, event, 0))) {
if (zap_channel_open_chan(zchan) != ZAP_SUCCESS) {
zap_log(ZAP_LOG_ERROR, "OPEN ERROR [%s]\n", zchan->last_error);
- //release_request_id(event->call_setup_id);
} else {
zap_set_flag(zchan, ZAP_CHANNEL_OUTBOUND);
zap_set_flag_locked(zchan, ZAP_CHANNEL_INUSE);
if (r) {
zap_set_sflag(zchan, SFLAG_FREE_REQ_ID);
+ zap_mutex_unlock(zchan->mutex);
return;
}
}
);
+ assert(event->call_setup_id <= MAX_REQ_ID);
switch(event->event_id) {
handle_heartbeat(mcon, event);
break;
case SIGBOOST_EVENT_CALL_STOPPED_ACK:
+ handle_call_done(span, mcon, event);
+ break;
case SIGBOOST_EVENT_CALL_START_NACK_ACK:
handle_call_done(span, mcon, event);
+ nack_map[event->call_setup_id] = 0;
break;
case SIGBOOST_EVENT_INSERT_CHECK_LOOP:
//handle_call_loop_start(event);
{
sig.event_id = ZAP_SIGEVENT_STOP;
status = ss7_boost_data->signal_cb(&sig);
- zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_DOWN);
+ zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_HANGUP_COMPLETE);
zap_set_sflag_locked(zchan, SFLAG_SENT_FINAL_RESPONSE);
ss7bc_exec_command(mcon,
zchan->physical_span_id-1,
ZSD_INBOUND,
ZSM_UNACCEPTABLE,
{ZAP_CHANNEL_STATE_PROGRESS, ZAP_CHANNEL_STATE_PROGRESS_MEDIA, ZAP_END},
- {ZAP_CHANNEL_STATE_HANGUP, ZAP_CHANNEL_STATE_CANCEL, ZAP_CHANNEL_STATE_UP, ZAP_END},
+ {ZAP_CHANNEL_STATE_HANGUP, ZAP_CHANNEL_STATE_CANCEL, ZAP_CHANNEL_STATE_TERMINATING, ZAP_CHANNEL_STATE_UP, ZAP_END},
},
{
ZSD_INBOUND,