chlog: freetdm: ss7 - added support to check isup stack circuit state via cli (ftdm ss7 show status isup ckt X)
freetdm: ss7 - updated module to support latest changes to freetdm core
This commit is contained in:
parent
706550e2ca
commit
7ec2a5d246
|
@ -83,8 +83,8 @@ static ftdm_status_t handle_tx_lpr(ftdm_stream_handle_t *stream, char *name);
|
|||
static ftdm_status_t handle_status_mtp3link(ftdm_stream_handle_t *stream, char *name);
|
||||
static ftdm_status_t handle_status_mtp2link(ftdm_stream_handle_t *stream, char *name);
|
||||
static ftdm_status_t handle_status_linkset(ftdm_stream_handle_t *stream, char *name);
|
||||
|
||||
static ftdm_status_t handle_status_relay(ftdm_stream_handle_t *stream, char *name);
|
||||
static ftdm_status_t handle_status_isup_ckt(ftdm_stream_handle_t *stream, char *id_name);
|
||||
|
||||
static ftdm_status_t extract_span_chan(char *argv[10], int pos, int *span, int *chan);
|
||||
static ftdm_status_t check_arg_count(int args, int min);
|
||||
|
@ -149,6 +149,25 @@ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const cha
|
|||
|
||||
handle_show_status(stream, span, chan, verbose);
|
||||
/******************************************************************/
|
||||
} else if (!strcasecmp(argv[c], "isup")) {
|
||||
/******************************************************************/
|
||||
if (check_arg_count(argc, 4)) goto handle_cli_error_argc;
|
||||
c++;
|
||||
|
||||
if (!strcasecmp(argv[c], "ckt")) {
|
||||
/**************************************************************/
|
||||
if (check_arg_count(argc, 5)) goto handle_cli_error_argc;
|
||||
c++;
|
||||
|
||||
handle_status_isup_ckt(stream, argv[c]);
|
||||
/**************************************************************/
|
||||
} else {
|
||||
/**************************************************************/
|
||||
stream->write_function(stream, "Unknown \"status isup\" command\n");
|
||||
goto handle_cli_error;
|
||||
/**************************************************************/
|
||||
}
|
||||
/******************************************************************/
|
||||
} else {
|
||||
/******************************************************************/
|
||||
stream->write_function(stream, "Unknown \"status\" command\n");
|
||||
|
@ -1037,37 +1056,37 @@ static ftdm_status_t handle_show_blocks(ftdm_stream_handle_t *stream, int span,
|
|||
ftdmchan->physical_chan_id,
|
||||
ss7_info->circuit->cic);
|
||||
|
||||
if((sngss7_test_ckt_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX)) || (sngss7_test_ckt_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX))) {
|
||||
if((sngss7_test_ckt_blk_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX)) || (sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX))) {
|
||||
stream->write_function(stream, "l_mn=Y|");
|
||||
}else {
|
||||
stream->write_function(stream, "l_mn=N|");
|
||||
}
|
||||
|
||||
if((sngss7_test_ckt_flag(ss7_info, FLAG_CKT_MN_BLOCK_RX)) || (sngss7_test_ckt_flag(ss7_info, FLAG_GRP_MN_BLOCK_RX))) {
|
||||
if((sngss7_test_ckt_blk_flag(ss7_info, FLAG_CKT_MN_BLOCK_RX)) || (sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_MN_BLOCK_RX))) {
|
||||
stream->write_function(stream, "r_mn=Y|");
|
||||
}else {
|
||||
stream->write_function(stream, "r_mn=N|");
|
||||
}
|
||||
|
||||
if(sngss7_test_ckt_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX)) {
|
||||
if(sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX)) {
|
||||
stream->write_function(stream, "l_hw=Y|");
|
||||
}else {
|
||||
stream->write_function(stream, "l_hw=N|");
|
||||
}
|
||||
|
||||
if(sngss7_test_ckt_flag(ss7_info, FLAG_GRP_HW_BLOCK_RX)) {
|
||||
if(sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_HW_BLOCK_RX)) {
|
||||
stream->write_function(stream, "r_hw=Y|");
|
||||
}else {
|
||||
stream->write_function(stream, "r_hw=N|");
|
||||
}
|
||||
|
||||
if(sngss7_test_ckt_flag(ss7_info, FLAG_CKT_LC_BLOCK_RX)) {
|
||||
if(sngss7_test_ckt_blk_flag(ss7_info, FLAG_CKT_LC_BLOCK_RX)) {
|
||||
stream->write_function(stream, "l_mngmt=Y|");
|
||||
}else {
|
||||
stream->write_function(stream, "l_mngmt=N|");
|
||||
}
|
||||
|
||||
if(sngss7_test_ckt_flag(ss7_info, FLAG_CKT_UCIC_BLOCK)) {
|
||||
if(sngss7_test_ckt_blk_flag(ss7_info, FLAG_CKT_UCIC_BLOCK)) {
|
||||
stream->write_function(stream, "l_ucic=Y|");
|
||||
}else {
|
||||
stream->write_function(stream, "l_ucic=N|");
|
||||
|
@ -1142,48 +1161,47 @@ static ftdm_status_t handle_show_status(ftdm_stream_handle_t *stream, int span,
|
|||
/* grab the signaling_status */
|
||||
ftdm_channel_get_sig_status(ftdmchan, &sigstatus);
|
||||
|
||||
stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|sig_status=%4s|state=%s|",
|
||||
stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|ckt=%4d|sig_status=%4s|state=%s|",
|
||||
ckt->span,
|
||||
ckt->chan,
|
||||
ckt->cic,
|
||||
ckt->id,
|
||||
ftdm_signaling_status2str(sigstatus),
|
||||
ftdm_channel_state2str(ftdmchan->state));
|
||||
|
||||
if ((sngss7_test_ckt_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX)) ||
|
||||
(sngss7_test_ckt_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX))) {
|
||||
if ((sngss7_test_ckt_blk_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX)) ||
|
||||
(sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX))) {
|
||||
stream->write_function(stream, "l_mn=Y|");
|
||||
}else {
|
||||
stream->write_function(stream, "l_mn=N|");
|
||||
}
|
||||
|
||||
if ((sngss7_test_ckt_flag(ss7_info, FLAG_CKT_MN_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_flag(ss7_info, FLAG_GRP_MN_BLOCK_RX))) {
|
||||
if ((sngss7_test_ckt_blk_flag(ss7_info, FLAG_CKT_MN_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_MN_BLOCK_RX))) {
|
||||
stream->write_function(stream, "r_mn=Y|");
|
||||
}else {
|
||||
stream->write_function(stream, "r_mn=N|");
|
||||
}
|
||||
|
||||
if (sngss7_test_ckt_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX)) {
|
||||
if (sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX)) {
|
||||
stream->write_function(stream, "l_hw=Y|");
|
||||
}else {
|
||||
stream->write_function(stream, "l_hw=N|");
|
||||
}
|
||||
|
||||
if (sngss7_test_ckt_flag(ss7_info, FLAG_GRP_HW_BLOCK_RX)) {
|
||||
if (sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_HW_BLOCK_RX)) {
|
||||
stream->write_function(stream, "r_hw=Y|");
|
||||
}else {
|
||||
stream->write_function(stream, "r_hw=N|");
|
||||
}
|
||||
|
||||
if (sngss7_test_ckt_flag(ss7_info, FLAG_RELAY_DOWN)) {
|
||||
stream->write_function(stream, "relay=Y|");
|
||||
stream->write_function(stream, "relay=Y");
|
||||
}else {
|
||||
stream->write_function(stream, "relay=N|");
|
||||
stream->write_function(stream, "relay=N");
|
||||
}
|
||||
}
|
||||
|
||||
stream->write_function(stream, "flags=0x%X",ss7_info->ckt_flags);
|
||||
|
||||
|
||||
stream->write_function(stream, "\n");
|
||||
} /* if ( hole, sig, voice) */
|
||||
} /* if ( span and chan) */
|
||||
|
@ -1237,10 +1255,10 @@ static ftdm_status_t handle_tx_blo(ftdm_stream_handle_t *stream, int span, int c
|
|||
continue;
|
||||
} else {
|
||||
/* throw the ckt block flag */
|
||||
sngss7_set_ckt_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX);
|
||||
sngss7_set_ckt_blk_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX);
|
||||
|
||||
/* set the channel to suspended state */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
}
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
|
@ -1303,13 +1321,13 @@ static ftdm_status_t handle_tx_ubl(ftdm_stream_handle_t *stream, int span, int c
|
|||
continue;
|
||||
} else {
|
||||
/* throw the ckt block flag */
|
||||
sngss7_set_ckt_flag(ss7_info, FLAG_CKT_MN_UNBLK_TX);
|
||||
sngss7_set_ckt_blk_flag(ss7_info, FLAG_CKT_MN_UNBLK_TX);
|
||||
|
||||
/* clear the block flag */
|
||||
sngss7_clear_ckt_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX);
|
||||
sngss7_clear_ckt_blk_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX);
|
||||
|
||||
/* set the channel to suspended state */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
}
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
|
@ -1554,12 +1572,12 @@ static ftdm_status_t handle_tx_rsc(ftdm_stream_handle_t *stream, int span, int c
|
|||
/**************************************************************************/
|
||||
case FTDM_CHANNEL_STATE_RESTART:
|
||||
/* go to idle so that we can redo the restart state*/
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IDLE);
|
||||
break;
|
||||
/**************************************************************************/
|
||||
default:
|
||||
/* set the state of the channel to restart...the rest is done by the chan monitor */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
break;
|
||||
/**************************************************************************/
|
||||
}
|
||||
|
@ -1627,7 +1645,7 @@ static ftdm_status_t handle_tx_grs(ftdm_stream_handle_t *stream, int span, int c
|
|||
}
|
||||
|
||||
/* set the channel to suspended state */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1701,15 +1719,10 @@ static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int c
|
|||
ftdm_mutex_lock(ftdmchan->mutex);
|
||||
|
||||
/* throw the grp maint. block flag */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX);
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX);
|
||||
|
||||
/* bring the sig status down */
|
||||
sigev.chan_id = ftdmchan->chan_id;
|
||||
sigev.span_id = ftdmchan->span_id;
|
||||
sigev.channel = ftdmchan;
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN);
|
||||
|
||||
/* if this is the first channel in the range */
|
||||
if (ftdmchan->physical_chan_id == chan) {
|
||||
|
@ -1801,15 +1814,10 @@ static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int c
|
|||
ftdm_mutex_lock(ftdmchan->mutex);
|
||||
|
||||
/* throw the grp maint. block flag */
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX);
|
||||
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX);
|
||||
|
||||
/* bring the sig status up */
|
||||
sigev.chan_id = ftdmchan->chan_id;
|
||||
sigev.span_id = ftdmchan->span_id;
|
||||
sigev.channel = ftdmchan;
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_UP;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP);
|
||||
|
||||
/* if this is the first channel in the range */
|
||||
if (ftdmchan->physical_chan_id == chan) {
|
||||
|
@ -2154,6 +2162,184 @@ success:
|
|||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
static ftdm_status_t handle_status_isup_ckt(ftdm_stream_handle_t *stream, char *id_name)
|
||||
{
|
||||
sng_isup_ckt_t *ckt;
|
||||
sngss7_chan_data_t *ss7_info;
|
||||
ftdm_channel_t *ftdmchan;
|
||||
uint32_t id;
|
||||
uint8_t state = 0;
|
||||
uint8_t bits_ab = 0;
|
||||
uint8_t bits_cd = 0;
|
||||
uint8_t bits_ef = 0;
|
||||
|
||||
/* extract the integer version of the id (ckt) */
|
||||
id = atoi(id_name);
|
||||
|
||||
/* extract the global config circuit structure */
|
||||
ckt = &g_ftdm_sngss7_data.cfg.isupCkt[id];
|
||||
|
||||
/* confirm the ckt exists */
|
||||
if (ckt->id == 0) {
|
||||
stream->write_function(stream, "Requested ckt does not exist (%d)\n", id);
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
/* confirm the ckt is a voice channel */
|
||||
if (ckt->type != VOICE) {
|
||||
stream->write_function(stream, "Requested ckt is a sig link/hole and can not be queried (%d)\n", id);
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
/* extract the global structure */
|
||||
ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[id].obj;
|
||||
ftdmchan = ss7_info->ftdmchan;
|
||||
|
||||
/* query the isup stack for the state of the ckt */
|
||||
if (ftmod_ss7_isup_ckt_sta(ckt->id, &state)) {
|
||||
stream->write_function(stream, "Failed to read isup ckt =%d status\n", id);
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
|
||||
stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|ckt=%4d|state=0x%02X|",
|
||||
ckt->span,
|
||||
ckt->chan,
|
||||
ckt->cic,
|
||||
ckt->id,
|
||||
state);
|
||||
|
||||
/* extract the bit sections */
|
||||
bits_ab = (state & (SNG_BIT_A + SNG_BIT_B)) >> 0;
|
||||
|
||||
bits_cd = (state & (SNG_BIT_C + SNG_BIT_D)) >> 2;
|
||||
|
||||
bits_ef = (state & (SNG_BIT_E + SNG_BIT_F)) >> 4;
|
||||
|
||||
/* check bits C and D */
|
||||
switch (bits_cd) {
|
||||
/**************************************************************************/
|
||||
case (0):
|
||||
/* ckt is either un-equipped or transient, check bits A and B */
|
||||
switch (bits_ab) {
|
||||
/**********************************************************************/
|
||||
case (0):
|
||||
/* bit a and bit are cleared, transient */
|
||||
stream->write_function(stream, "transient\n");
|
||||
goto success;
|
||||
break;
|
||||
/**********************************************************************/
|
||||
case (1):
|
||||
case (2):
|
||||
/* bit a or bit b are set, spare ... shouldn't happen */
|
||||
stream->write_function(stream, "spare\n");
|
||||
goto success;
|
||||
break;
|
||||
/**********************************************************************/
|
||||
case (3):
|
||||
/* bit a and bit b are set, unequipped */
|
||||
stream->write_function(stream, "unequipped\n");
|
||||
goto success;
|
||||
break;
|
||||
/**********************************************************************/
|
||||
default:
|
||||
stream->write_function(stream, "invalid values for bits A and B (%d)\n",
|
||||
bits_ab);
|
||||
goto success;
|
||||
break;
|
||||
/**********************************************************************/
|
||||
} /* switch (bits_ab) */
|
||||
|
||||
/* shouldn't get here but have a break for properness */
|
||||
break;
|
||||
/**************************************************************************/
|
||||
case (1):
|
||||
/* circuit incoming busy */
|
||||
stream->write_function(stream, "incoming busy");
|
||||
break;
|
||||
/**************************************************************************/
|
||||
case (2):
|
||||
/* circuit outgoing busy */
|
||||
stream->write_function(stream, "outgoing busy");
|
||||
break;
|
||||
/**************************************************************************/
|
||||
case (3):
|
||||
/* circuit idle */
|
||||
stream->write_function(stream, "idle");
|
||||
break;
|
||||
/**************************************************************************/
|
||||
default:
|
||||
/* invalid */
|
||||
stream->write_function(stream, "bits C and D are invalid (%d)!\n",
|
||||
bits_cd);
|
||||
goto success;
|
||||
/**************************************************************************/
|
||||
} /* switch (bits_cd) */
|
||||
|
||||
/* check the maintenance block status in bits A and B */
|
||||
switch (bits_ab) {
|
||||
/**************************************************************************/
|
||||
case (0):
|
||||
/* no maintenace block...do nothing */
|
||||
break;
|
||||
/**************************************************************************/
|
||||
case (1):
|
||||
/* locally blocked */
|
||||
stream->write_function(stream, "|l_mn");
|
||||
break;
|
||||
/**************************************************************************/
|
||||
case (2):
|
||||
/* remotely blocked */
|
||||
stream->write_function(stream, "|r_mn");
|
||||
break;
|
||||
/**************************************************************************/
|
||||
case (3):
|
||||
/* both locally and remotely blocked */
|
||||
stream->write_function(stream, "|l_mn|r_mn");
|
||||
break;
|
||||
/**************************************************************************/
|
||||
default:
|
||||
stream->write_function(stream, "bits A and B are invlaid (%d)!\n",
|
||||
bits_ab);
|
||||
goto success;
|
||||
/**************************************************************************/
|
||||
} /* switch (bits_ab) */
|
||||
|
||||
/* check the hardware block status in bits e and f */
|
||||
switch (bits_ef) {
|
||||
/**************************************************************************/
|
||||
case (0):
|
||||
/* no maintenace block...do nothing */
|
||||
break;
|
||||
/**************************************************************************/
|
||||
case (1):
|
||||
/* locally blocked */
|
||||
stream->write_function(stream, "|l_hw");
|
||||
break;
|
||||
/**************************************************************************/
|
||||
case (2):
|
||||
/* remotely blocked */
|
||||
stream->write_function(stream, "|r_hw");
|
||||
break;
|
||||
/**************************************************************************/
|
||||
case (3):
|
||||
/* both locally and remotely blocked */
|
||||
stream->write_function(stream, "|l_hw|r_hw");
|
||||
break;
|
||||
/**************************************************************************/
|
||||
default:
|
||||
stream->write_function(stream, "bits E and F are invlaid (%d)!\n",
|
||||
bits_ef);
|
||||
goto success;
|
||||
/**************************************************************************/
|
||||
} /* switch (bits_ef) */
|
||||
|
||||
success:
|
||||
stream->write_function(stream, "\n");
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
static ftdm_status_t extract_span_chan(char *argv[10], int pos, int *span, int *chan)
|
||||
{
|
||||
|
|
|
@ -101,19 +101,17 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
|
||||
if (sngss7_test_ckt_flag(sngss7_info, FLAG_GLARE)) {
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx IAM (glare)\n", sngss7_info->circuit->cic);
|
||||
} else {
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx IAM\n", sngss7_info->circuit->cic);
|
||||
}
|
||||
}
|
||||
|
||||
/* check if the circuit has a remote block */
|
||||
if ((sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) {
|
||||
if ((sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) {
|
||||
|
||||
/* as per Q.764, 2.8.2.3 xiv ... remove the block from this channel */
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX);
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX);
|
||||
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);
|
||||
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX);
|
||||
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX);
|
||||
|
||||
/* KONRAD FIX ME : check in case there is a ckt and grp block */
|
||||
}
|
||||
|
@ -139,7 +137,7 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
ftdmchan->caller_data.hangup_cause = 41;
|
||||
|
||||
/* move the state to CANCEL */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_CANCEL);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL);
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -211,11 +209,10 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
|
||||
/* add any special variables for the dialplan */
|
||||
sprintf(nadi, "%d", siConEvnt->cgPtyNum.natAddrInd.val);
|
||||
ftdm_call_add_var(&ftdmchan->caller_data, "ss7_clg_nadi", nadi);
|
||||
sngss7_add_var(sngss7_info, "ss7_clg_nadi", nadi);
|
||||
|
||||
sprintf(nadi, "%d", siConEvnt->cdPtyNum.natAddrInd.val);
|
||||
ftdm_call_add_var(&ftdmchan->caller_data, "ss7_cld_nadi", nadi);
|
||||
|
||||
sngss7_add_var(sngss7_info, "ss7_cld_nadi", nadi);
|
||||
|
||||
/* check if a COT test is requested */
|
||||
if ((siConEvnt->natConInd.eh.pres) &&
|
||||
|
@ -228,12 +225,19 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_LOOP, NULL);
|
||||
|
||||
/* move to in loop state */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IN_LOOP);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IN_LOOP);
|
||||
} else {
|
||||
/* set the state of the channel to collecting...the rest is done by the chan monitor */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_COLLECT);
|
||||
}
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx IAM clg = \"%s\" (NADI=%d), cld = \"%s\" (NADI=%d)\n",
|
||||
sngss7_info->circuit->cic,
|
||||
ftdmchan->caller_data.cid_num.digits,
|
||||
siConEvnt->cgPtyNum.natAddrInd.val,
|
||||
ftdmchan->caller_data.dnis.digits,
|
||||
siConEvnt->cdPtyNum.natAddrInd.val);
|
||||
|
||||
} /* if (channel is usable */
|
||||
|
||||
break;
|
||||
|
@ -264,7 +268,7 @@ handle_glare:
|
|||
sngss7_set_ckt_flag(sngss7_info, FLAG_REMOTE_REL);
|
||||
|
||||
/* move the state of the channel to Terminating to end the call */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
} /* if (!(sngss7_test_ckt_flag(sngss7_info, FLAG_GLARE))) */
|
||||
break;
|
||||
/**************************************************************************/
|
||||
|
@ -275,7 +279,7 @@ handle_glare:
|
|||
sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX);
|
||||
|
||||
/* move the state of the channel to RESTART to force a reset */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
|
@ -324,14 +328,14 @@ ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
|
||||
if (siCnStEvnt->optBckCalInd.inbndInfoInd.val) {
|
||||
/* go to PROGRESS_MEDIA */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA);
|
||||
} else {
|
||||
/* go to PROGRESS */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS);
|
||||
} /* if (inband) */
|
||||
} else {
|
||||
/* go to PROGRESS_MEDIA */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -344,7 +348,7 @@ ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX);
|
||||
|
||||
/* go to RESTART */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
break;
|
||||
/**********************************************************************/
|
||||
} /* switch (ftdmchan->state) */
|
||||
|
@ -398,7 +402,7 @@ ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
}
|
||||
|
||||
/* go to idle so that collect state is processed again */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IDLE);
|
||||
|
||||
break;
|
||||
/**********************************************************************/
|
||||
|
@ -527,7 +531,7 @@ ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx ANM\n", sngss7_info->circuit->cic);
|
||||
|
||||
/* go to UP */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
|
@ -536,7 +540,7 @@ ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CON\n", sngss7_info->circuit->cic);
|
||||
|
||||
/* go to UP */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
|
@ -548,7 +552,7 @@ ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_TX);
|
||||
|
||||
/* go to RESTART */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
|
@ -600,7 +604,7 @@ ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
sngss7_set_ckt_flag(sngss7_info, FLAG_REMOTE_REL);
|
||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
|
||||
/* move the state of the channel to CANCEL to end the call */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
|
@ -621,7 +625,7 @@ ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
|
|||
sngss7_set_ckt_flag(sngss7_info, FLAG_REMOTE_REL);
|
||||
|
||||
/* move the state of the channel to TERMINATING to end the call */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
|
@ -634,7 +638,7 @@ ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
|
|||
sngss7_set_ckt_flag(sngss7_info, FLAG_REMOTE_REL);
|
||||
|
||||
/* go to hangup complete to send the RLC */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE);
|
||||
|
||||
/* save the call info for the RLC */
|
||||
sngss7_info->suInstId = get_unique_id();
|
||||
|
@ -648,7 +652,7 @@ ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
|
|||
sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_RX);
|
||||
|
||||
/* set the state to RESTART */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
break;
|
||||
/**************************************************************************/
|
||||
} /* switch (ftdmchan->state) */
|
||||
|
@ -687,7 +691,7 @@ ftdm_status_t handle_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
case FTDM_CHANNEL_STATE_HANGUP_COMPLETE:
|
||||
|
||||
/* go to DOWN */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
|
@ -699,7 +703,7 @@ ftdm_status_t handle_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
/* KONRAD: should just stop the call...but a reset is easier for now (since it does hangup the call) */
|
||||
|
||||
/* go to RESTART */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
|
@ -1152,7 +1156,7 @@ ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t ci
|
|||
sngss7_set_ckt_flag(sngss7_info, FLAG_REMOTE_REL);
|
||||
|
||||
/* move the state of the channel to Terminating to end the call */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
}
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
|
@ -1201,6 +1205,9 @@ ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circui
|
|||
SS7_DEBUG_CHAN(ftdmchan, "Rx PAUSE%s\n", "");
|
||||
/* set the pause flag on the channel */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_PAUSED);
|
||||
|
||||
/* clear the resume flag on the channel */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_RESUME);
|
||||
}
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
|
@ -1308,7 +1315,7 @@ ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t ci
|
|||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_LOOP, NULL);
|
||||
|
||||
/* switch to the IN_LOOP state */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IN_LOOP);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IN_LOOP);
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
|
@ -1339,7 +1346,7 @@ ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint32_t cir
|
|||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
|
||||
|
||||
/* exit out of the LOOP state to the last state */
|
||||
ftdm_set_state_locked(ftdmchan, ftdmchan->last_state);
|
||||
ftdm_set_state(ftdmchan, ftdmchan->last_state);
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
|
@ -1373,13 +1380,13 @@ ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit,
|
|||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
|
||||
|
||||
/* exit out of the LOOP state and go to collect */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_COLLECT);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
default:
|
||||
/* exit out of the LOOP state to the last state */
|
||||
ftdm_set_state_locked(ftdmchan, ftdmchan->last_state);
|
||||
ftdm_set_state(ftdmchan, ftdmchan->last_state);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
|
@ -1421,15 +1428,15 @@ ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
ftdm_mutex_lock(ftdmchan->mutex);
|
||||
|
||||
/* check if the circuit is already blocked or not */
|
||||
if (sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) {
|
||||
if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) {
|
||||
SS7_WARN("Received BLO on circuit that is already blocked!\n");
|
||||
}
|
||||
|
||||
/* throw the ckt block flag */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);
|
||||
|
||||
/* set the channel to suspended state */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
|
@ -1484,18 +1491,18 @@ ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
ftdm_mutex_lock(ftdmchan->mutex);
|
||||
|
||||
/* check if the channel is blocked */
|
||||
if (!(sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX))) {
|
||||
if (!(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX))) {
|
||||
SS7_WARN("Received UBL on circuit that is not blocked!\n");
|
||||
}
|
||||
|
||||
/* throw the unblock flag */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_CKT_MN_UNBLK_RX);
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_RX);
|
||||
|
||||
/* clear the block flag */
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);
|
||||
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX);
|
||||
|
||||
/* set the channel to suspended state */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
|
@ -1557,14 +1564,14 @@ ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
case FTDM_CHANNEL_STATE_RESTART:
|
||||
|
||||
/* go to idle so that we can redo the restart state*/
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IDLE);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
default:
|
||||
|
||||
/* set the state of the channel to restart...the rest is done by the chan monitor */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
break;
|
||||
/**************************************************************************/
|
||||
}
|
||||
|
@ -1602,14 +1609,14 @@ ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_
|
|||
case FTDM_CHANNEL_STATE_RESTART:
|
||||
|
||||
/* go to idle so that we can redo the restart state*/
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IDLE);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
default:
|
||||
|
||||
/* set the state of the channel to restart...the rest is done by the chan monitor */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
break;
|
||||
/**************************************************************************/
|
||||
}
|
||||
|
@ -1648,7 +1655,7 @@ ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX_RSP);
|
||||
|
||||
/* go to DOWN */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
} else {
|
||||
SS7_ERROR("Received RSC-RLC but we're not waiting on a RSC-RLC on CIC #, dropping\n", sngss7_info->circuit->cic);
|
||||
}
|
||||
|
@ -1670,7 +1677,7 @@ ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX_RSP);
|
||||
|
||||
/* go to DOWN */
|
||||
/*ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);*/
|
||||
/*ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);*/
|
||||
|
||||
break;
|
||||
/**********************************************************************/
|
||||
|
@ -1684,7 +1691,7 @@ ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
ftdmchan->caller_data.hangup_cause = 98; /* Message not compatiable with call state */
|
||||
}
|
||||
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
break;
|
||||
/**********************************************************************/
|
||||
}
|
||||
|
@ -1795,15 +1802,15 @@ ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t ci
|
|||
ftdm_mutex_lock(ftdmchan->mutex);
|
||||
|
||||
/* check if the circuit is already blocked or not */
|
||||
if (sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX)) {
|
||||
if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX)) {
|
||||
SS7_WARN("Received local BLO on circuit that is already blocked!\n");
|
||||
}
|
||||
|
||||
/* throw the ckt block flag */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX);
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX);
|
||||
|
||||
/* set the channel to suspended state */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
|
@ -1831,15 +1838,15 @@ ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t ci
|
|||
ftdm_mutex_lock(ftdmchan->mutex);
|
||||
|
||||
/* check if the circuit is already blocked or not */
|
||||
if (sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX)) {
|
||||
if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX)) {
|
||||
SS7_WARN("Received local UBL on circuit that is already unblocked!\n");
|
||||
}
|
||||
|
||||
/* throw the ckt block flag */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX);
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX);
|
||||
|
||||
/* set the channel to suspended state */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
|
@ -1878,10 +1885,10 @@ ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit
|
|||
ftdm_mutex_lock(ftdmchan->mutex);
|
||||
|
||||
/* throw the ckt block flag */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK);
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK);
|
||||
|
||||
/* set the channel to suspended state */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
|
@ -1904,9 +1911,7 @@ ftdm_status_t handle_cgb_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
int byte = 0;
|
||||
int bit = 0;
|
||||
int x;
|
||||
ftdm_sigmsg_t sigev;
|
||||
|
||||
memset(&sigev, 0, sizeof (sigev));
|
||||
memset(&status[0], '\0', sizeof(status));
|
||||
|
||||
/* get the ftdmchan and ss7_chan_data from the circuit */
|
||||
|
@ -1982,11 +1987,11 @@ ftdm_status_t handle_cgb_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
switch (blockType) {
|
||||
/**********************************************************************/
|
||||
case 0: /* maintenance oriented */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX);
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX);
|
||||
break;
|
||||
/**********************************************************************/
|
||||
case 1: /* hardware failure oriented */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX);
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX);
|
||||
break;
|
||||
/**********************************************************************/
|
||||
case 2: /* reserved for national use */
|
||||
|
@ -1998,14 +2003,8 @@ ftdm_status_t handle_cgb_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
} /* switch (blockType) */
|
||||
}
|
||||
|
||||
sigev.chan_id = ftdmchan->chan_id;
|
||||
sigev.span_id = ftdmchan->span_id;
|
||||
sigev.channel = ftdmchan;
|
||||
|
||||
/* bring the sig status down */
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN);
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
|
@ -2113,11 +2112,11 @@ ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
switch (blockType) {
|
||||
/**********************************************************************/
|
||||
case 0: /* maintenance oriented */
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX);
|
||||
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX);
|
||||
break;
|
||||
/**********************************************************************/
|
||||
case 1: /* hardware failure oriented */
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX);
|
||||
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX);
|
||||
break;
|
||||
/**********************************************************************/
|
||||
case 2: /* reserved for national use */
|
||||
|
@ -2134,9 +2133,7 @@ ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
|
|||
sigev.channel = ftdmchan;
|
||||
|
||||
/* bring the sig status down */
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_UP;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP);
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
|
|
|
@ -492,21 +492,17 @@ static void ftdm_sangoma_ss7_process_stack_event (sngss7_event_data_t *sngss7_ev
|
|||
ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
||||
{
|
||||
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
|
||||
sng_isup_inf_t *isup_intf = NULL;
|
||||
sng_isup_inf_t *isup_intf = NULL;
|
||||
int state_flag = 1;
|
||||
int i = 0;
|
||||
ftdm_sigmsg_t sigev;
|
||||
|
||||
memset (&sigev, 0, sizeof (sigev));
|
||||
|
||||
sigev.chan_id = ftdmchan->chan_id;
|
||||
sigev.span_id = ftdmchan->span_id;
|
||||
sigev.channel = ftdmchan;
|
||||
|
||||
SS7_DEBUG_CHAN(ftdmchan, "ftmod_sangoma_ss7 processing state %s\n", ftdm_channel_state2str (ftdmchan->state));
|
||||
|
||||
#if 0
|
||||
/* clear the state change flag...since we might be setting a new state */
|
||||
ftdm_channel_complete_state(ftdmchan);
|
||||
|
||||
#endif
|
||||
|
||||
/*check what state we are supposed to be in */
|
||||
switch (ftdmchan->state) {
|
||||
/**************************************************************************/
|
||||
|
@ -529,13 +525,15 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
ftdmchan->caller_data.dnis.digits[i-1] = '\0';
|
||||
|
||||
/*now go to the RING state */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_RING);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING);
|
||||
|
||||
} else if (i >= sngss7_info->circuit->min_digits) {
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Received %d digits (min digits = %d)\n", i, sngss7_info->circuit->min_digits);
|
||||
|
||||
/*now go to the RING state */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_RING);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING);
|
||||
|
||||
} else {
|
||||
/* if we are coming from idle state then we have already been here once before */
|
||||
|
@ -561,7 +559,8 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
sngss7_set_ckt_flag (sngss7_info, FLAG_LOCAL_REL);
|
||||
|
||||
/* end the call */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_CANCEL);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL);
|
||||
} /* if (ftdm_sched_timer(sngss7_info->t35.sched, */
|
||||
} /* if (ftdmchan->last_state != FTDM_CHANNEL_STATE_IDLE) */
|
||||
} /* checking ST/#digits */
|
||||
|
@ -587,8 +586,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
|
||||
|
||||
/* we have enough information to inform FTDM of the call */
|
||||
sigev.event_id = FTDM_SIGEVENT_START;
|
||||
ftdm_span_send_signal (ftdmchan->span, &sigev);
|
||||
sngss7_send_signal(sngss7_info, FTDM_SIGEVENT_START);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
|
@ -618,11 +616,11 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
/*check if the channel is inbound or outbound */
|
||||
if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OUTBOUND)) {
|
||||
/*OUTBOUND...so we were told by the line of this so noifiy the user */
|
||||
sigev.event_id = FTDM_SIGEVENT_PROGRESS;
|
||||
ftdm_span_send_signal (ftdmchan->span, &sigev);
|
||||
sngss7_send_signal(sngss7_info, FTDM_SIGEVENT_PROGRESS);
|
||||
|
||||
/* move to progress media */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA);
|
||||
} else {
|
||||
/* inbound call so we need to send out ACM */
|
||||
ft_to_sngss7_acm(ftdmchan);
|
||||
|
@ -639,8 +637,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
|
||||
if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OUTBOUND)) {
|
||||
/* inform the user there is media avai */
|
||||
sigev.event_id = FTDM_SIGEVENT_PROGRESS_MEDIA;
|
||||
ftdm_span_send_signal (ftdmchan->span, &sigev);
|
||||
sngss7_send_signal(sngss7_info, FTDM_SIGEVENT_PROGRESS_MEDIA);
|
||||
}
|
||||
|
||||
|
||||
|
@ -657,8 +654,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
/*check if the channel is inbound or outbound */
|
||||
if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OUTBOUND)) {
|
||||
/*OUTBOUND...so we were told by the line that the other side answered */
|
||||
sigev.event_id = FTDM_SIGEVENT_UP;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngss7_send_signal(sngss7_info, FTDM_SIGEVENT_UP);
|
||||
} else {
|
||||
/*INBOUND...so FS told us it was going to answer...tell the stack */
|
||||
ft_to_sngss7_anm(ftdmchan);
|
||||
|
@ -676,7 +672,8 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
SS7_ERROR_CHAN(ftdmchan,"Hanging up call before informing user%s\n", " ");
|
||||
|
||||
/*now go to the HANGUP complete state */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_HANGUP);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
|
@ -691,8 +688,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
sngss7_set_ckt_flag (sngss7_info, FLAG_REMOTE_REL);
|
||||
|
||||
/*this state is set when the line is hanging up */
|
||||
sigev.event_id = FTDM_SIGEVENT_STOP;
|
||||
ftdm_span_send_signal (ftdmchan->span, &sigev);
|
||||
sngss7_send_signal(sngss7_info, FTDM_SIGEVENT_STOP);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
|
@ -721,7 +717,8 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
}
|
||||
|
||||
/*now go to the HANGUP complete state */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE);
|
||||
|
||||
break;
|
||||
|
||||
|
@ -737,7 +734,8 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
/* check if this hangup is from a tx RSC */
|
||||
if (sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_TX)) {
|
||||
/* go to RESTART State until RSCa is received */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
} else {
|
||||
/* if the hangup is from a rx RSC, rx GRS, or glare don't sent RLC */
|
||||
if (!(sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_RX)) &&
|
||||
|
@ -749,7 +747,8 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
}
|
||||
|
||||
/*now go to the DOWN state */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
}
|
||||
|
||||
SS7_DEBUG_CHAN(ftdmchan,"Completing remotely requested hangup!%s\n", "");
|
||||
|
@ -758,15 +757,16 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
/* if this hang up is do to a rx RESET we need to sit here till the RSP arrives */
|
||||
if (sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_TX_RSP)) {
|
||||
/* go to the down state as we have already received RSC-RLC */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
}
|
||||
|
||||
/* if it's a local release the user sends us to down */
|
||||
SS7_DEBUG_CHAN(ftdmchan,"Completing locally requested hangup!%s\n", "");
|
||||
} else if (sngss7_test_ckt_flag (sngss7_info, FLAG_GLARE)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan,"Completing requested hangup due to glare!%s\n", "");
|
||||
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
} else {
|
||||
SS7_DEBUG_CHAN(ftdmchan,"Completing requested hangup for unknown reason!%s\n", "");
|
||||
}
|
||||
|
@ -836,28 +836,27 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
!(sngss7_test_ckt_flag (sngss7_info, FLAG_GRP_RESET_RX))) {
|
||||
|
||||
/* now check if there is an active block */
|
||||
if (!(sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX)) &&
|
||||
!(sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) &&
|
||||
!(sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) &&
|
||||
!(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) &&
|
||||
!(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX)) &&
|
||||
!(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX)) &&
|
||||
!(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX))) {
|
||||
if (!(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX)) &&
|
||||
!(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) &&
|
||||
!(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) &&
|
||||
!(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) &&
|
||||
!(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX)) &&
|
||||
!(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX)) &&
|
||||
!(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX))) {
|
||||
|
||||
/* check if the sig status is down, and bring it up if it isn't */
|
||||
if (!ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan,"All reset flags cleared %s\n", "");
|
||||
/* all flags are down so we can bring up the sig status */
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_UP;
|
||||
ftdm_span_send_signal (ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP);
|
||||
} /* if (!ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) */
|
||||
} /* if !blocked */
|
||||
} else {
|
||||
SS7_DEBUG_CHAN(ftdmchan,"Reset flags present (0x%X)\n", sngss7_info->ckt_flags);
|
||||
|
||||
/* there is still another reset pending so go back to reset*/
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
}
|
||||
} /* if ((ftdmchan->last_state == FTDM_CHANNEL_STATE_RESTART) */
|
||||
|
||||
|
@ -906,20 +905,21 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
/**************************************************************************/
|
||||
case FTDM_CHANNEL_STATE_RESTART: /* CICs needs a Reset */
|
||||
|
||||
if (sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK)) {
|
||||
if ((sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_RX)) ||
|
||||
(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX))) {
|
||||
if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK)) {
|
||||
if ((sngss7_test_ckt_blk_flag(sngss7_info, FLAG_RESET_RX)) ||
|
||||
(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_RESET_RX))) {
|
||||
|
||||
SS7_DEBUG_CHAN(ftdmchan,"Incoming Reset request on CIC in UCIC block, removing UCIC block%s\n", "");
|
||||
|
||||
/* set the unblk flag */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_CKT_UCIC_UNBLK);
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_UNBLK);
|
||||
|
||||
/* clear the block flag */
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK);
|
||||
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK);
|
||||
|
||||
/* process the flag */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
|
||||
/* break out of the processing for now */
|
||||
break;
|
||||
|
@ -956,9 +956,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
|
||||
/* if the sig_status is up...bring it down */
|
||||
if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) {
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN;
|
||||
ftdm_span_send_signal (ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN);
|
||||
}
|
||||
|
||||
if (sngss7_test_ckt_flag (sngss7_info, FLAG_GRP_RESET_RX)) {
|
||||
|
@ -972,13 +970,15 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
switch (ftdmchan->last_state){
|
||||
/******************************************************************/
|
||||
case (FTDM_CHANNEL_STATE_TERMINATING):
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP);
|
||||
break;
|
||||
/******************************************************************/
|
||||
case (FTDM_CHANNEL_STATE_HANGUP):
|
||||
case (FTDM_CHANNEL_STATE_HANGUP_COMPLETE):
|
||||
/* go back to the last state after taking care of the rest of the restart state */
|
||||
ftdm_set_state_locked (ftdmchan, ftdmchan->last_state);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, ftdmchan->last_state);
|
||||
break;
|
||||
/******************************************************************/
|
||||
case (FTDM_CHANNEL_STATE_IN_LOOP):
|
||||
|
@ -986,7 +986,8 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
|
||||
|
||||
/* go to down */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
break;
|
||||
/******************************************************************/
|
||||
default:
|
||||
|
@ -996,7 +997,8 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
/* change the state to terminatting, it will throw us back here
|
||||
* once the call is done
|
||||
*/
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
break;
|
||||
/******************************************************************/
|
||||
} /* switch (ftdmchan->last_state) */
|
||||
|
@ -1010,7 +1012,8 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
SS7_DEBUG_CHAN(ftdmchan, "Reset processed moving to DOWN (0x%X)\n", sngss7_info->ckt_flags);
|
||||
|
||||
/* go to a down state to clear the channel and send the response */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
} else {
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Waiting on Reset Rsp/Grp Reset to move to DOWN (0x%X)\n", sngss7_info->ckt_flags);
|
||||
}
|
||||
|
@ -1029,6 +1032,9 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
/* clear the RESUME flag */
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_RESUME);
|
||||
|
||||
/* clear the PAUSE flag */
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_PAUSED);
|
||||
|
||||
/* if there are any resets present */
|
||||
if ((sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_TX)) ||
|
||||
(sngss7_test_ckt_flag (sngss7_info, FLAG_RESET_RX)) ||
|
||||
|
@ -1040,9 +1046,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
} else {
|
||||
|
||||
/* bring the sig status back up */
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_UP;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP);
|
||||
}
|
||||
|
||||
/* go back to the last state */
|
||||
|
@ -1053,112 +1057,125 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
SS7_DEBUG_CHAN(ftdmchan, "Processing PAUSE%s\n", "");
|
||||
|
||||
/* bring the sig status down */
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN);
|
||||
|
||||
/* go back to the last state */
|
||||
goto suspend_goto_last;
|
||||
} /* if (sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED)) { */
|
||||
/**********************************************************************/
|
||||
if (sngss7_test_ckt_flag (sngss7_info, FLAG_CKT_MN_BLOCK_RX)) {
|
||||
if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX) &&
|
||||
!sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_BLOCK_RX flag %s\n", "");
|
||||
|
||||
/* bring the sig status down */
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN);
|
||||
|
||||
/* send a BLA */
|
||||
ft_to_sngss7_bla (ftdmchan);
|
||||
|
||||
/* throw the done flag */
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN);
|
||||
|
||||
/* check the last state and return to it to allow the call to finish */
|
||||
goto suspend_goto_last;
|
||||
}
|
||||
|
||||
if (sngss7_test_ckt_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX)){
|
||||
if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX) &&
|
||||
!sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX_DN)){
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_UNBLK_RX flag %s\n", "");
|
||||
|
||||
/* clear the unblock flag */
|
||||
sngss7_clear_ckt_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX);
|
||||
sngss7_clear_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX);
|
||||
|
||||
/* bring the sig status up */
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_UP;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP);
|
||||
|
||||
/* send a uba */
|
||||
ft_to_sngss7_uba (ftdmchan);
|
||||
|
||||
/* throw the done flag */
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_RX_DN);
|
||||
|
||||
/* check the last state and return to it to allow the call to finish */
|
||||
goto suspend_goto_last;
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
if (sngss7_test_ckt_flag (sngss7_info, FLAG_CKT_MN_BLOCK_TX)) {
|
||||
if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX) &&
|
||||
!sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX_DN)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_BLOCK_TX flag %s\n", "");
|
||||
|
||||
/* bring the sig status down */
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN);
|
||||
|
||||
/* send a blo */
|
||||
ft_to_sngss7_blo (ftdmchan);
|
||||
|
||||
/* throw the done flag */
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX_DN);
|
||||
|
||||
/* check the last state and return to it to allow the call to finish */
|
||||
goto suspend_goto_last;
|
||||
}
|
||||
|
||||
if (sngss7_test_ckt_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX)){
|
||||
if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX) &&
|
||||
!sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX_DN)){
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_UNBLK_TX flag %s\n", "");
|
||||
|
||||
/* clear the unblock flag */
|
||||
sngss7_clear_ckt_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX);
|
||||
sngss7_clear_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX);
|
||||
|
||||
/* bring the sig status up */
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_UP;
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP);
|
||||
|
||||
/* send a ubl */
|
||||
ft_to_sngss7_ubl (ftdmchan);
|
||||
|
||||
/* throw the done flag */
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_TX_DN);
|
||||
|
||||
/* check the last state and return to it to allow the call to finish */
|
||||
goto suspend_goto_last;
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
if (sngss7_test_ckt_flag (sngss7_info, FLAG_CKT_LC_BLOCK_RX)) {
|
||||
if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX) &&
|
||||
!sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX_DN)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_LC_BLOCK_RX flag %s\n", "");
|
||||
|
||||
/* send a BLA */
|
||||
/*ft_to_sngss7_bla(ftdmchan);*/
|
||||
|
||||
/* throw the done flag */
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX_DN);
|
||||
|
||||
/* check the last state and return to it to allow the call to finish */
|
||||
goto suspend_goto_last;
|
||||
}
|
||||
|
||||
if (sngss7_test_ckt_flag (sngss7_info, FLAG_CKT_LC_UNBLK_RX)) {
|
||||
if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX) &&
|
||||
!sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX_DN)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_LC_UNBLK_RX flag %s\n", "");
|
||||
|
||||
/* clear the unblock flag */
|
||||
sngss7_clear_ckt_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX);
|
||||
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_RX);
|
||||
|
||||
/* send a uba */
|
||||
/*ft_to_sngss7_uba(ftdmchan);*/
|
||||
|
||||
/* throw the done flag */
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX_DN);
|
||||
|
||||
/* check the last state and return to it to allow the call to finish */
|
||||
goto suspend_goto_last;
|
||||
}
|
||||
/**********************************************************************/
|
||||
if (sngss7_test_ckt_flag (sngss7_info, FLAG_CKT_UCIC_BLOCK)) {
|
||||
if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_UCIC_BLOCK) &&
|
||||
!sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_UCIC_BLOCK_DN)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_UCIC_BLOCK flag %s\n", "");
|
||||
|
||||
/* bring the channel signaling status to down */
|
||||
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN;
|
||||
ftdm_span_send_signal (ftdmchan->span, &sigev);
|
||||
sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN);
|
||||
|
||||
/* remove any reset flags */
|
||||
clear_rx_grs_flags(sngss7_info);
|
||||
|
@ -1167,33 +1184,42 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
|
|||
clear_tx_grs_data(sngss7_info);
|
||||
clear_rx_rsc_flags(sngss7_info);
|
||||
clear_tx_rsc_flags(sngss7_info);
|
||||
|
||||
/* throw the done flag */
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK_DN);
|
||||
|
||||
/* bring the channel down */
|
||||
goto suspend_goto_last;
|
||||
}
|
||||
|
||||
if (sngss7_test_ckt_flag (sngss7_info, FLAG_CKT_UCIC_UNBLK)) {
|
||||
if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_UCIC_UNBLK) &&
|
||||
!sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_UCIC_UNBLK_DN)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_UCIC_UNBLK flag %s\n", "");;
|
||||
|
||||
/* remove the UCIC block flag */
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK);
|
||||
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK);
|
||||
|
||||
/* remove the UCIC unblock flag */
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_CKT_UCIC_UNBLK);
|
||||
sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_UNBLK);
|
||||
|
||||
/* throw the channel into reset to sync states */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX);
|
||||
|
||||
/* throw the done flag */
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_UNBLK_DN);
|
||||
|
||||
/* bring the channel into restart again */
|
||||
goto suspend_goto_restart;
|
||||
}
|
||||
|
||||
suspend_goto_last:
|
||||
ftdm_set_state_locked (ftdmchan, ftdmchan->last_state);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, ftdmchan->last_state);
|
||||
break;
|
||||
|
||||
suspend_goto_restart:
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
break;
|
||||
|
||||
/**************************************************************************/
|
||||
|
@ -1209,7 +1235,8 @@ suspend_goto_restart:
|
|||
break;
|
||||
/**************************************************************************/
|
||||
case FTDM_CHANNEL_STATE_IDLE:
|
||||
ftdm_set_state_locked(ftdmchan, ftdmchan->last_state);
|
||||
state_flag = 0;
|
||||
ftdm_set_state(ftdmchan, ftdmchan->last_state);
|
||||
break;
|
||||
/**************************************************************************/
|
||||
default:
|
||||
|
@ -1219,7 +1246,12 @@ suspend_goto_restart:
|
|||
break;
|
||||
/**************************************************************************/
|
||||
}/*switch (ftdmchan->state) */
|
||||
|
||||
#if 1
|
||||
if (state_flag) {
|
||||
/* clear the state change flag...since we might be setting a new state */
|
||||
ftdm_channel_complete_state(ftdmchan);
|
||||
}
|
||||
#endif
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1228,17 +1260,7 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_ss7_outgoing_call)
|
|||
{
|
||||
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
|
||||
|
||||
/* lock the channel while we check whether it is availble */
|
||||
ftdm_mutex_lock (ftdmchan->mutex);
|
||||
|
||||
/* check if there is a pending state change, give it a bit to clear */
|
||||
if (check_for_state_change(ftdmchan)) {
|
||||
SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic);
|
||||
/* check if we need to die */
|
||||
SS7_ASSERT;
|
||||
/* end the request */
|
||||
goto outgoing_fail;
|
||||
};
|
||||
/* the core has this channel already locked so need to lock again */
|
||||
|
||||
/* check if the channel sig state is UP */
|
||||
if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) {
|
||||
|
@ -1247,9 +1269,9 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_ss7_outgoing_call)
|
|||
}
|
||||
|
||||
/* check if there is a remote block */
|
||||
if ((sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) {
|
||||
if ((sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) {
|
||||
|
||||
/* the channel is blocked...can't send any calls here */
|
||||
SS7_ERROR_CHAN(ftdmchan, "Requested channel is remotely blocked, re-hunt channel!%s\n", " ");
|
||||
|
@ -1257,9 +1279,9 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_ss7_outgoing_call)
|
|||
}
|
||||
|
||||
/* check if there is a local block */
|
||||
if ((sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) ||
|
||||
(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX)) ||
|
||||
(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX))) {
|
||||
if ((sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) ||
|
||||
(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX)) ||
|
||||
(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX))) {
|
||||
|
||||
/* KONRAD FIX ME : we should check if this is a TEST call and allow it */
|
||||
|
||||
|
@ -1273,9 +1295,6 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_ss7_outgoing_call)
|
|||
/**************************************************************************/
|
||||
case FTDM_CHANNEL_STATE_DOWN:
|
||||
/* inform the monitor thread that we want to make a call by returning FTDM_SUCCESS */
|
||||
|
||||
/* unlock the channel */
|
||||
ftdm_mutex_unlock (ftdmchan->mutex);
|
||||
|
||||
goto outgoing_successful;
|
||||
break;
|
||||
|
@ -1293,20 +1312,14 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_ss7_outgoing_call)
|
|||
|
||||
outgoing_fail:
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Call Request failed%s\n", " ");
|
||||
/* unlock the channel */
|
||||
ftdm_mutex_unlock (ftdmchan->mutex);
|
||||
return FTDM_FAIL;
|
||||
|
||||
outgoing_break:
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Call Request re-hunt%s\n", " ");
|
||||
/* unlock the channel */
|
||||
ftdm_mutex_unlock (ftdmchan->mutex);
|
||||
return FTDM_BREAK;
|
||||
|
||||
outgoing_successful:
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Call Request successful%s\n", " ");
|
||||
/* unlock the channel */
|
||||
ftdm_mutex_unlock (ftdmchan->mutex);
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1409,7 +1422,7 @@ static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span)
|
|||
sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX);
|
||||
#endif
|
||||
/* throw the channel to suspend */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
|
||||
/* unlock the channel */
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
|
|
|
@ -76,6 +76,17 @@ typedef enum {
|
|||
SNGSS7_SSP_STA_CFM_EVENT
|
||||
} sng_event_type_t;
|
||||
|
||||
typedef enum {
|
||||
SNG_BIT_A = (1 << 0),
|
||||
SNG_BIT_B = (1 << 1),
|
||||
SNG_BIT_C = (1 << 2),
|
||||
SNG_BIT_D = (1 << 3),
|
||||
SNG_BIT_E = (1 << 4),
|
||||
SNG_BIT_F = (1 << 5),
|
||||
SNG_BIT_G = (1 << 6),
|
||||
SNG_BIT_H = (1 << 7)
|
||||
} sng_bit_enums_t;
|
||||
|
||||
typedef enum {
|
||||
VOICE = 0,
|
||||
SIG,
|
||||
|
@ -294,7 +305,6 @@ typedef struct sng_isup_intf {
|
|||
typedef struct sng_isup_ckt {
|
||||
uint32_t options;
|
||||
uint32_t flags;
|
||||
uint32_t ckt_flags;
|
||||
uint32_t procId;
|
||||
uint32_t id;
|
||||
uint32_t ccSpanId;
|
||||
|
@ -431,6 +441,10 @@ typedef struct sngss7_chan_data {
|
|||
uint32_t spId;
|
||||
uint8_t globalFlg;
|
||||
uint32_t ckt_flags;
|
||||
uint32_t blk_flags;
|
||||
ftdm_hash_t* variables; /* send on next sigevent */
|
||||
ftdm_size_t raw_data_len;
|
||||
void *raw_data; /* send on next sigevent */
|
||||
sngss7_glare_data_t glare;
|
||||
sngss7_timer_data_t t35;
|
||||
}sngss7_chan_data_t;
|
||||
|
@ -489,23 +503,41 @@ typedef enum {
|
|||
FLAG_GLARE = (1 << 13),
|
||||
FLAG_INFID_RESUME = (1 << 14),
|
||||
FLAG_INFID_PAUSED = (1 << 15),
|
||||
FLAG_CKT_UCIC_BLOCK = (1 << 16),
|
||||
FLAG_CKT_UCIC_UNBLK = (1 << 17),
|
||||
FLAG_CKT_LC_BLOCK_RX = (1 << 18),
|
||||
FLAG_CKT_LC_UNBLK_RX = (1 << 19),
|
||||
FLAG_CKT_MN_BLOCK_RX = (1 << 20),
|
||||
FLAG_CKT_MN_UNBLK_RX = (1 << 21),
|
||||
FLAG_CKT_MN_BLOCK_TX = (1 << 22),
|
||||
FLAG_CKT_MN_UNBLK_TX = (1 << 23),
|
||||
FLAG_GRP_HW_BLOCK_RX = (1 << 24),
|
||||
FLAG_GRP_HW_BLOCK_TX = (1 << 25),
|
||||
FLAG_GRP_MN_BLOCK_RX = (1 << 26),
|
||||
FLAG_GRP_MN_BLOCK_TX = (1 << 27),
|
||||
FLAG_GRP_HW_UNBLK_TX = (1 << 28),
|
||||
FLAG_GRP_MN_UNBLK_TX = (1 << 29),
|
||||
FLAG_RELAY_DOWN = (1 << 30)
|
||||
} sng_ckt_flag_t;
|
||||
|
||||
/* ckt blocking flags */
|
||||
typedef enum {
|
||||
FLAG_CKT_UCIC_BLOCK = (1 << 0),
|
||||
FLAG_CKT_UCIC_BLOCK_DN = (1 << 1),
|
||||
FLAG_CKT_UCIC_UNBLK = (1 << 2),
|
||||
FLAG_CKT_UCIC_UNBLK_DN = (1 << 3),
|
||||
FLAG_CKT_LC_BLOCK_RX = (1 << 4),
|
||||
FLAG_CKT_LC_BLOCK_RX_DN = (1 << 5),
|
||||
FLAG_CKT_LC_UNBLK_RX = (1 << 6),
|
||||
FLAG_CKT_LC_UNBLK_RX_DN = (1 << 7),
|
||||
FLAG_CKT_MN_BLOCK_RX = (1 << 8),
|
||||
FLAG_CKT_MN_BLOCK_RX_DN = (1 << 9),
|
||||
FLAG_CKT_MN_UNBLK_RX = (1 << 10),
|
||||
FLAG_CKT_MN_UNBLK_RX_DN = (1 << 11),
|
||||
FLAG_CKT_MN_BLOCK_TX = (1 << 12),
|
||||
FLAG_CKT_MN_BLOCK_TX_DN = (1 << 13),
|
||||
FLAG_CKT_MN_UNBLK_TX = (1 << 14),
|
||||
FLAG_CKT_MN_UNBLK_TX_DN = (1 << 15),
|
||||
FLAG_GRP_HW_BLOCK_RX = (1 << 16),
|
||||
FLAG_GRP_HW_BLOCK_RX_DN = (1 << 17),
|
||||
FLAG_GRP_HW_BLOCK_TX = (1 << 18),
|
||||
FLAG_GRP_HW_BLOCK_TX_DN = (1 << 19),
|
||||
FLAG_GRP_MN_BLOCK_RX = (1 << 20),
|
||||
FLAG_GRP_MN_BLOCK_RX_DN = (1 << 21),
|
||||
FLAG_GRP_MN_BLOCK_TX = (1 << 22),
|
||||
FLAG_GRP_MN_BLOCK_TX_DN = (1 << 23),
|
||||
FLAG_GRP_HW_UNBLK_TX = (1 << 24),
|
||||
FLAG_GRP_HW_UNBLK_TX_DN = (1 << 25),
|
||||
FLAG_GRP_MN_UNBLK_TX = (1 << 26),
|
||||
FLAG_GRP_MN_UNBLK_TX_DN = (1 << 27)
|
||||
} sng_ckt_block_flag_t;
|
||||
|
||||
/* valid for every cfg array except circuits */
|
||||
typedef enum {
|
||||
SNGSS7_CONFIGURED = (1 << 0),
|
||||
|
@ -607,6 +639,7 @@ int ftmod_ss7_mtp3link_sta(uint32_t id, SnMngmt *cfm);
|
|||
int ftmod_ss7_mtplinkSet_sta(uint32_t id, SnMngmt *cfm);
|
||||
int ftmod_ss7_isup_intf_sta(uint32_t id, uint8_t *status);
|
||||
int ftmod_ss7_relay_status(uint32_t id, RyMngmt *cfm);
|
||||
int ftmod_ss7_isup_ckt_sta(uint32_t id, unsigned char *state);
|
||||
|
||||
|
||||
/* in ftmod_sangoma_ss7_out.c */
|
||||
|
@ -724,6 +757,11 @@ int find_cic_cntrl_in_map(const char *cntrlType);
|
|||
|
||||
ftdm_status_t check_status_of_all_isup_intf(void);
|
||||
|
||||
void sngss7_send_signal(sngss7_chan_data_t *sngss7_info, ftdm_signal_event_t event_id);
|
||||
void sngss7_set_sig_status(sngss7_chan_data_t *sngss7_info, ftdm_signaling_status_t status);
|
||||
ftdm_status_t sngss7_add_var(sngss7_chan_data_t *ss7_info, const char* var, const char* val);
|
||||
ftdm_status_t sngss7_add_raw_data(sngss7_chan_data_t *sngss7_info, uint8_t* data, ftdm_size_t data_len);
|
||||
|
||||
/* in ftmod_sangoma_ss7_timers.c */
|
||||
void handle_isup_t35(void *userdata);
|
||||
/******************************************************************************/
|
||||
|
@ -860,6 +898,10 @@ void handle_isup_t35(void *userdata);
|
|||
#define sngss7_clear_ckt_flag(obj, flag) ((obj)->ckt_flags &= ~(flag))
|
||||
#define sngss7_set_ckt_flag(obj, flag) ((obj)->ckt_flags |= (flag))
|
||||
|
||||
#define sngss7_test_ckt_blk_flag(obj, flag) ((obj)->blk_flags & flag)
|
||||
#define sngss7_clear_ckt_blk_flag(obj, flag) ((obj)->blk_flags &= ~(flag))
|
||||
#define sngss7_set_ckt_blk_flag(obj, flag) ((obj)->blk_flags |= (flag))
|
||||
|
||||
#define sngss7_test_options(obj, option) ((obj)->options & option)
|
||||
#define sngss7_clear_options(obj, option) ((obj)->options &= ~(option))
|
||||
#define sngss7_set_options(obj, option) ((obj)->options |= (option))
|
||||
|
|
|
@ -187,7 +187,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
|
|||
copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum);
|
||||
|
||||
/* check if the user would like a custom NADI value for the calling Pty Num */
|
||||
clg_nadi = ftdm_call_get_var(&ftdmchan->caller_data, "ss7_clg_nadi");
|
||||
clg_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_clg_nadi");
|
||||
if ((clg_nadi != NULL) && (*clg_nadi)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Calling NADI value \"%s\"\n", clg_nadi);
|
||||
iam.cgPtyNum.natAddrInd.val = atoi(clg_nadi);
|
||||
|
@ -196,7 +196,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
|
|||
SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found for CLG, using \"%d\"\n", iam.cgPtyNum.natAddrInd.val);
|
||||
}
|
||||
|
||||
cld_nadi = ftdm_call_get_var(&ftdmchan->caller_data, "ss7_cld_nadi");
|
||||
cld_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cld_nadi");
|
||||
if ((cld_nadi != NULL) && (*cld_nadi)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Called NADI value \"%s\"\n", cld_nadi);
|
||||
iam.cdPtyNum.natAddrInd.val = atoi(cld_nadi);
|
||||
|
@ -206,7 +206,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
|
|||
}
|
||||
|
||||
/* check if the user would like us to send a clg_sub-address */
|
||||
clg_subAddr = ftdm_call_get_var(&ftdmchan->caller_data, "ss7_clg_subaddr");
|
||||
clg_subAddr = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_clg_subaddr");
|
||||
if ((clg_subAddr != NULL) && (*clg_subAddr)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Calling Sub-Address value \"%s\"\n", clg_subAddr);
|
||||
|
||||
|
@ -245,7 +245,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
|
|||
}
|
||||
|
||||
/* check if the user would like us to send a cld_sub-address */
|
||||
cld_subAddr = ftdm_call_get_var(&ftdmchan->caller_data, "ss7_cld_subaddr");
|
||||
cld_subAddr = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cld_subaddr");
|
||||
if ((cld_subAddr != NULL) && (*cld_subAddr)) {
|
||||
SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Called Sub-Address value \"%s\"\n", cld_subAddr);
|
||||
|
||||
|
@ -282,9 +282,6 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
|
|||
} /* if (subAddrIE[0] != '0') */
|
||||
} /* if ((cld_subAddr != NULL) && (*cld_subAddr)) */
|
||||
|
||||
|
||||
|
||||
|
||||
sng_cc_con_request (sngss7_info->spId,
|
||||
sngss7_info->suInstId,
|
||||
sngss7_info->spInstId,
|
||||
|
@ -299,7 +296,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
|
|||
ftdmchan->caller_data.dnis.digits,
|
||||
iam.cdPtyNum.natAddrInd.val);
|
||||
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
@ -379,7 +376,7 @@ void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan)
|
|||
ADDRCMPLT);
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx ACM\n", sngss7_info->circuit->cic);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
@ -403,7 +400,7 @@ void ft_to_sngss7_anm (ftdm_channel_t * ftdmchan)
|
|||
5);
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx ANM\n", sngss7_info->circuit->cic);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
@ -438,7 +435,7 @@ void ft_to_sngss7_rel (ftdm_channel_t * ftdmchan)
|
|||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx REL cause=%d \n",
|
||||
sngss7_info->circuit->cic,
|
||||
ftdmchan->caller_data.hangup_cause );
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
@ -461,7 +458,7 @@ void ft_to_sngss7_rlc (ftdm_channel_t * ftdmchan)
|
|||
&rlc);
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx RLC\n", sngss7_info->circuit->cic);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
@ -482,7 +479,7 @@ void ft_to_sngss7_rsc (ftdm_channel_t * ftdmchan)
|
|||
NULL);
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx RSC\n", sngss7_info->circuit->cic);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
@ -503,7 +500,7 @@ void ft_to_sngss7_rsca (ftdm_channel_t * ftdmchan)
|
|||
NULL);
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx RSC-RLC\n", sngss7_info->circuit->cic);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
@ -524,7 +521,7 @@ void ft_to_sngss7_blo (ftdm_channel_t * ftdmchan)
|
|||
NULL);
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx BLO\n", sngss7_info->circuit->cic);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
@ -545,7 +542,7 @@ void ft_to_sngss7_bla (ftdm_channel_t * ftdmchan)
|
|||
NULL);
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx BLA\n", sngss7_info->circuit->cic);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
@ -567,7 +564,7 @@ ft_to_sngss7_ubl (ftdm_channel_t * ftdmchan)
|
|||
NULL);
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx UBL\n", sngss7_info->circuit->cic);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
@ -588,7 +585,7 @@ void ft_to_sngss7_uba (ftdm_channel_t * ftdmchan)
|
|||
NULL);
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx UBA\n", sngss7_info->circuit->cic);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
@ -609,7 +606,7 @@ void ft_to_sngss7_lpa (ftdm_channel_t * ftdmchan)
|
|||
NULL);
|
||||
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx LPA\n", sngss7_info->circuit->cic);
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
@ -654,7 +651,7 @@ void ft_to_sngss7_gra (ftdm_channel_t * ftdmchan)
|
|||
sngss7_info->circuit->cic,
|
||||
(sngss7_info->circuit->cic + sngss7_span->rx_grs.range));
|
||||
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
@ -688,7 +685,7 @@ void ft_to_sngss7_grs (ftdm_channel_t * ftdmchan)
|
|||
sngss7_info->circuit->cic,
|
||||
(sngss7_info->circuit->cic + sngss7_span->tx_grs.range));
|
||||
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
@ -737,7 +734,7 @@ void ft_to_sngss7_cgba(ftdm_channel_t * ftdmchan)
|
|||
|
||||
/* clean out the saved data */
|
||||
memset(&sngss7_span->rx_cgb, 0x0, sizeof(sngss7_group_data_t));
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
@ -787,7 +784,7 @@ void ft_to_sngss7_cgua(ftdm_channel_t * ftdmchan)
|
|||
/* clean out the saved data */
|
||||
memset(&sngss7_span->rx_cgu, 0x0, sizeof(sngss7_group_data_t));
|
||||
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
@ -838,7 +835,7 @@ void ft_to_sngss7_cgb(ftdm_channel_t * ftdmchan)
|
|||
/* clean out the saved data */
|
||||
memset(&sngss7_span->tx_cgb, 0x0, sizeof(sngss7_group_data_t));
|
||||
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
@ -889,7 +886,7 @@ void ft_to_sngss7_cgu(ftdm_channel_t * ftdmchan)
|
|||
/* clean out the saved data */
|
||||
memset(&sngss7_span->tx_cgu, 0x0, sizeof(sngss7_group_data_t));
|
||||
|
||||
ftdm_call_clear_data(&ftdmchan->caller_data);
|
||||
|
||||
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -207,7 +207,7 @@ ftdm_status_t enable_all_ckts_for_relay(void)
|
|||
SS7_DEBUG_CHAN(ftdmchan, "ISUP interface (%d) set to resume, resuming channel\n", sngIntf->id);
|
||||
/* throw the channel infId status flags to PAUSED ... they will be executed next process cycle */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_RESUME);
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_PAUSED);
|
||||
sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_PAUSED);
|
||||
}
|
||||
} /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) */
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ int ftmod_ss7_mtp3link_sta(uint32_t id, SnMngmt *cfm);
|
|||
int ftmod_ss7_mtplinkSet_sta(uint32_t id, SnMngmt *cfm);
|
||||
int ftmod_ss7_isup_intf_sta(uint32_t id, uint8_t *status);
|
||||
int ftmod_ss7_relay_status(uint32_t id, RyMngmt *cfm);
|
||||
int ftmod_ss7_isup_ckt_sta(uint32_t id, unsigned char *state);
|
||||
/******************************************************************************/
|
||||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
|
@ -188,6 +189,43 @@ int ftmod_ss7_relay_status(uint32_t id, RyMngmt *cfm)
|
|||
return(sng_sta_relay(&pst, &sta, cfm));
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int ftmod_ss7_isup_ckt_sta(uint32_t id, unsigned char *state)
|
||||
{
|
||||
SiMngmt sta;
|
||||
SiMngmt cfm;
|
||||
Pst pst;
|
||||
int ret;
|
||||
|
||||
memset(&sta, 0x0, sizeof(sta));
|
||||
|
||||
/* initalize the post structure */
|
||||
smPstInit(&pst);
|
||||
|
||||
/* insert the destination Entity */
|
||||
pst.dstEnt = ENTSI;
|
||||
|
||||
/* check the for the correct ProcId and make sure it goes to the right system */
|
||||
if (g_ftdm_sngss7_data.cfg.procId != 1) {
|
||||
pst.dstProcId = 1;
|
||||
}
|
||||
|
||||
/* request the status of an inftId */
|
||||
sta.hdr.entId.ent = ENTSI;
|
||||
sta.hdr.entId.inst = S_INST;
|
||||
sta.hdr.msgType = TSSTA;
|
||||
sta.hdr.elmId.elmnt = SI_STCIRGRP;
|
||||
|
||||
sta.t.ssta.elmntId.circuit = id;
|
||||
sta.t.ssta.param.cirgr.range = 1;
|
||||
|
||||
ret = sng_sta_isup(&pst, &sta, &cfm);
|
||||
|
||||
*state = cfm.t.ssta.cfm.s.cir.state[0];
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
|
|
|
@ -83,6 +83,11 @@ int find_ssf_type_in_map(const char *ssfType);
|
|||
int find_cic_cntrl_in_map(const char *cntrlType);
|
||||
|
||||
ftdm_status_t check_status_of_all_isup_intf(void);
|
||||
|
||||
void sngss7_send_signal(sngss7_chan_data_t *sngss7_info, ftdm_signal_event_t event_id);
|
||||
void sngss7_set_sig_status(sngss7_chan_data_t *sngss7_info, ftdm_signaling_status_t status);
|
||||
ftdm_status_t sngss7_add_var(sngss7_chan_data_t *ss7_info, const char* var, const char* val);
|
||||
ftdm_status_t sngss7_add_raw_data(sngss7_chan_data_t *sngss7_info, uint8_t* data, ftdm_size_t data_len);
|
||||
/******************************************************************************/
|
||||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
|
@ -560,14 +565,14 @@ ftdm_status_t check_if_rx_grs_started(ftdm_span_t *ftdmspan)
|
|||
case FTDM_CHANNEL_STATE_RESTART:
|
||||
|
||||
/* go to idle so that we can redo the restart state*/
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IDLE);
|
||||
|
||||
break;
|
||||
/**************************************************************************/
|
||||
default:
|
||||
|
||||
/* set the state of the channel to restart...the rest is done by the chan monitor */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART);
|
||||
break;
|
||||
/**************************************************************************/
|
||||
} /* switch (ftdmchan->state) */
|
||||
|
@ -638,13 +643,13 @@ ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan)
|
|||
sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX_CMPLT);
|
||||
|
||||
/* move the channel to the down state */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
|
||||
/* update the status map if the ckt is in blocked state */
|
||||
if ((sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) ||
|
||||
(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) {
|
||||
if ((sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) ||
|
||||
(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX)) ||
|
||||
(sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) {
|
||||
|
||||
sngss7_span->rx_grs.status[byte] = (sngss7_span->rx_grs.status[byte] | (1 << bit));
|
||||
} /* if blocked */
|
||||
|
@ -714,7 +719,7 @@ ftdm_status_t check_if_rx_gra_started(ftdm_span_t *ftdmspan)
|
|||
sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP);
|
||||
|
||||
/* go to DOWN */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||
|
||||
break;
|
||||
/**********************************************************************/
|
||||
|
@ -743,7 +748,7 @@ ftdm_status_t check_if_rx_gra_started(ftdm_span_t *ftdmspan)
|
|||
}
|
||||
|
||||
/* go to terminating to hang up the call */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||
break;
|
||||
/**********************************************************************/
|
||||
}
|
||||
|
@ -795,7 +800,7 @@ ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan)
|
|||
|
||||
/* throw the channel into SUSPENDED to process the flag */
|
||||
/* after doing this once the sig status will be down */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
ftdm_set_state (ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
}
|
||||
|
||||
/* if the RESUME flag is up go to SUSPENDED to process the flag */
|
||||
|
@ -808,7 +813,7 @@ ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan)
|
|||
}
|
||||
|
||||
/* got SUSPENDED state to clear the flag */
|
||||
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
ftdm_set_state (ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
}
|
||||
|
||||
/* unlock the channel */
|
||||
|
@ -849,10 +854,10 @@ ftdm_status_t process_span_ucic(ftdm_span_t *ftdmspan)
|
|||
}
|
||||
|
||||
/* throw the ckt block flag */
|
||||
sngss7_set_ckt_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK);
|
||||
sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK);
|
||||
|
||||
/* set the channel to suspended state */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||
|
||||
/* unlock the channel again before we exit */
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
|
@ -1348,6 +1353,107 @@ ftdm_status_t check_status_of_all_isup_intf(void)
|
|||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
ftdm_status_t sngss7_add_var(sngss7_chan_data_t *sngss7_info, const char* var, const char* val)
|
||||
{
|
||||
char *t_name = 0;
|
||||
char *t_val = 0;
|
||||
|
||||
/* confirm the user has sent us a value */
|
||||
if (!var || !val) {
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
|
||||
if (!sngss7_info->variables) {
|
||||
/* initialize on first use */
|
||||
sngss7_info->variables = create_hashtable(16, ftdm_hash_hashfromstring, ftdm_hash_equalkeys);
|
||||
ftdm_assert_return(sngss7_info->variables, FTDM_FAIL, "Failed to create hash table\n");
|
||||
}
|
||||
|
||||
t_name = ftdm_strdup(var);
|
||||
t_val = ftdm_strdup(val);
|
||||
|
||||
hashtable_insert(sngss7_info->variables, t_name, t_val, HASHTABLE_FLAG_FREE_KEY | HASHTABLE_FLAG_FREE_VALUE);
|
||||
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
ftdm_status_t sngss7_add_raw_data(sngss7_chan_data_t *sngss7_info, uint8_t* data, ftdm_size_t data_len)
|
||||
{
|
||||
ftdm_assert_return(!sngss7_info->raw_data, FTDM_FAIL, "Overwriting existing raw data\n");
|
||||
|
||||
sngss7_info->raw_data = ftdm_calloc(1, data_len);
|
||||
ftdm_assert_return(sngss7_info->raw_data, FTDM_FAIL, "Failed to allocate raw data\n");
|
||||
|
||||
memcpy(sngss7_info->raw_data, data, data_len);
|
||||
sngss7_info->raw_data_len = data_len;
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void sngss7_send_signal(sngss7_chan_data_t *sngss7_info, ftdm_signal_event_t event_id)
|
||||
{
|
||||
ftdm_sigmsg_t sigev;
|
||||
ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan;
|
||||
|
||||
memset(&sigev, 0, sizeof(sigev));
|
||||
|
||||
sigev.chan_id = ftdmchan->chan_id;
|
||||
sigev.span_id = ftdmchan->span_id;
|
||||
sigev.channel = ftdmchan;
|
||||
sigev.event_id = event_id;
|
||||
|
||||
if (sngss7_info->variables) {
|
||||
/*
|
||||
* variables now belongs to the ftdm core, and
|
||||
* will be cleared after sigev is processed by user. Set
|
||||
* local pointer to NULL so we do not attempt to
|
||||
* destroy it */
|
||||
sigev.variables = sngss7_info->variables;
|
||||
sngss7_info->variables = NULL;
|
||||
}
|
||||
|
||||
if (sngss7_info->raw_data) {
|
||||
/*
|
||||
* raw_data now belongs to the ftdm core, and
|
||||
* will be cleared after sigev is processed by user. Set
|
||||
* local pointer to NULL so we do not attempt to
|
||||
* destroy it */
|
||||
|
||||
sigev.raw.data = sngss7_info->raw_data;
|
||||
sigev.raw.len = sngss7_info->raw_data_len;
|
||||
|
||||
sngss7_info->raw_data = NULL;
|
||||
sngss7_info->raw_data_len = 0;
|
||||
}
|
||||
ftdm_span_send_signal(ftdmchan->span, &sigev);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void sngss7_set_sig_status(sngss7_chan_data_t *sngss7_info, ftdm_signaling_status_t status)
|
||||
{
|
||||
ftdm_sigmsg_t sig;
|
||||
ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan;
|
||||
|
||||
SS7_DEBUG_CHAN(ftdmchan, "Signalling link status changed to %s\n",
|
||||
ftdm_signaling_status2str(status));
|
||||
|
||||
memset(&sig, 0, sizeof(sig));
|
||||
|
||||
sig.chan_id = ftdmchan->chan_id;
|
||||
sig.span_id = ftdmchan->span_id;
|
||||
sig.channel = ftdmchan;
|
||||
sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
|
||||
sig.ev_data.sigstatus.status = status;
|
||||
|
||||
if (ftdm_span_send_signal(ftdmchan->span, &sig) != FTDM_SUCCESS) {
|
||||
SS7_ERROR_CHAN(ftdmchan, "Failed to change channel status to %s\n",
|
||||
ftdm_signaling_status2str(status));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
|
|
|
@ -67,7 +67,7 @@ void handle_isup_t35(void *userdata)
|
|||
ftdmchan->caller_data.hangup_cause = 28;
|
||||
|
||||
/* end the call */
|
||||
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_CANCEL);
|
||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL);
|
||||
|
||||
/*unlock*/
|
||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||
|
|
Loading…
Reference in New Issue