freetdm: fix SS7 cgb and cgu commands causing segfault - fixes Sangoma issue #780

Conflicts:

	libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c
This commit is contained in:
Moises Silva 2011-06-23 16:12:56 -04:00
parent 14099b814f
commit f3dc175941
8 changed files with 95 additions and 79 deletions

View File

@ -788,7 +788,7 @@ static ftdm_status_t handle_show_free(ftdm_stream_handle_t *stream, int span, in
x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;
free = 0;
while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) {
ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
ftdmchan = ss7_info->ftdmchan;
@ -851,7 +851,7 @@ static ftdm_status_t handle_show_inuse(ftdm_stream_handle_t *stream, int span, i
x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;
in_use = 0;
while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) {
ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
ftdmchan = ss7_info->ftdmchan;
@ -921,7 +921,7 @@ static ftdm_status_t handle_show_inreset(ftdm_stream_handle_t *stream, int span,
x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;
in_reset = 0;
while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) {
ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
ftdmchan = ss7_info->ftdmchan;
@ -981,7 +981,7 @@ static ftdm_status_t handle_show_flags(ftdm_stream_handle_t *stream, int span, i
x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;
while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) {
ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
ftdmchan = ss7_info->ftdmchan;
@ -1046,7 +1046,7 @@ static ftdm_status_t handle_show_blocks(ftdm_stream_handle_t *stream, int span,
x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;
while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) {
ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
ftdmchan = ss7_info->ftdmchan;
@ -1150,12 +1150,12 @@ static ftdm_status_t handle_show_status(ftdm_stream_handle_t *stream, int span,
/* check if this circuit is one of the circuits we're interested in */
if ((ckt->span == lspan) && (ckt->chan == lchan)) {
if (ckt->type == HOLE) {
if (ckt->type == SNG_CKT_HOLE) {
stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|NOT USED\n",
ckt->span,
ckt->chan,
ckt->cic);
} else if (ckt->type == SIG) {
} else if (ckt->type == SNG_CKT_SIG) {
stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|SIGNALING LINK\n",
ckt->span,
ckt->chan,
@ -1237,7 +1237,7 @@ static ftdm_status_t handle_tx_blo(ftdm_stream_handle_t *stream, int span, int c
x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;
while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) {
ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
ftdmchan = ss7_info->ftdmchan;
@ -1303,7 +1303,7 @@ static ftdm_status_t handle_tx_ubl(ftdm_stream_handle_t *stream, int span, int c
x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;
while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) {
ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
ftdmchan = ss7_info->ftdmchan;
@ -1558,7 +1558,7 @@ static ftdm_status_t handle_tx_rsc(ftdm_stream_handle_t *stream, int span, int c
x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;
while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) {
sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
ftdmchan = sngss7_info->ftdmchan;
@ -1630,7 +1630,7 @@ static ftdm_status_t handle_tx_grs(ftdm_stream_handle_t *stream, int span, int c
x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;
while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) {
sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
ftdmchan = sngss7_info->ftdmchan;
@ -1677,7 +1677,7 @@ static ftdm_status_t handle_tx_grs(ftdm_stream_handle_t *stream, int span, int c
x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;
while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) {
sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
ftdmchan = sngss7_info->ftdmchan;
@ -1719,7 +1719,7 @@ static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int c
x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;
while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) {
/* extract the channel and span info for this circuit */
sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
@ -1740,7 +1740,7 @@ static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int c
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) {
if (!main_chan) {
/* attach the cgb information */
main_chan = ftdmchan;
sngss7_span->tx_cgb.circuit = sngss7_info->circuit->id;
@ -1766,12 +1766,17 @@ static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int c
x++;
} /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */
if (!main_chan) {
stream->write_function(stream, "Failed to find a voice cic in span %d chan %d range %d", span, chan, range);
return FTDM_SUCCESS;
}
/* send the circuit group block */
ft_to_sngss7_cgb(main_chan);
x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;
while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) {
sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
ftdmchan = sngss7_info->ftdmchan;
@ -1814,7 +1819,7 @@ static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int c
x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;
while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) {
/* extract the channel and span info for this circuit */
sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
@ -1835,7 +1840,7 @@ static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int c
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) {
if (!main_chan) {
/* attach the cgb information */
main_chan = ftdmchan;
sngss7_span->tx_cgu.circuit = sngss7_info->circuit->id;
@ -1861,12 +1866,17 @@ static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int c
x++;
} /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */
if (!main_chan) {
stream->write_function(stream, "Failed to find a voice cic in span %d chan %d range %d", span, chan, range);
return FTDM_SUCCESS;
}
/* send the circuit group block */
ft_to_sngss7_cgu(main_chan);
x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;
while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) {
sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
ftdmchan = sngss7_info->ftdmchan;
@ -2202,7 +2212,7 @@ static ftdm_status_t handle_status_isup_ckt(ftdm_stream_handle_t *stream, char *
}
/* confirm the ckt is a voice channel */
if (ckt->type != VOICE) {
if (ckt->type != SNG_CKT_VOICE) {
stream->write_function(stream, "Requested ckt is a sig link/hole and can not be queried (%d)\n", id);
return FTDM_FAIL;
}

View File

@ -1160,7 +1160,7 @@ ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t ci
ftdm_channel_t *ftdmchan = NULL;
/* confirm that the circuit is voice channel */
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n",
g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic,
DECODE_LCC_EVENT(evntType));
@ -1233,7 +1233,7 @@ ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circui
/* check that the infId matches and that this is not a siglink */
if ((g_ftdm_sngss7_data.cfg.isupCkt[i].infId == infId) &&
(g_ftdm_sngss7_data.cfg.isupCkt[i].type == VOICE)) {
(g_ftdm_sngss7_data.cfg.isupCkt[i].type == SNG_CKT_VOICE)) {
/* confirm that the circuit is active on our side otherwise move to the next circuit */
if (!sngss7_test_flag(&g_ftdm_sngss7_data.cfg.isupCkt[i], SNGSS7_ACTIVE)) {
@ -1298,7 +1298,7 @@ ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circu
/* check that the infId matches and that this is not a siglink */
if ((g_ftdm_sngss7_data.cfg.isupCkt[i].infId == infId) &&
(g_ftdm_sngss7_data.cfg.isupCkt[i].type == VOICE)) {
(g_ftdm_sngss7_data.cfg.isupCkt[i].type == SNG_CKT_VOICE)) {
/* confirm that the circuit is active on our side otherwise move to the next circuit */
if (!sngss7_test_flag(&g_ftdm_sngss7_data.cfg.isupCkt[i], SNGSS7_ACTIVE)) {
@ -1351,7 +1351,7 @@ ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t ci
ftdm_channel_t *ftdmchan = NULL;
/* confirm that the circuit is voice channel */
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n",
g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic,
DECODE_LCC_EVENT(evntType));
@ -1406,7 +1406,7 @@ ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint32_t cir
ftdm_channel_t *ftdmchan = NULL;
/* confirm that the circuit is voice channel */
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n",
g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic,
DECODE_LCC_EVENT(evntType));
@ -1451,7 +1451,7 @@ ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit,
ftdm_channel_t *ftdmchan = NULL;
/* confirm that the circuit is voice channel */
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n",
g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic,
DECODE_LCC_EVENT(evntType));
@ -1519,7 +1519,7 @@ ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
ftdm_channel_t *ftdmchan = NULL;
/* confirm that the circuit is voice channel */
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n",
g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic,
DECODE_LCC_EVENT(evntType));
@ -1569,7 +1569,7 @@ ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ
ftdm_channel_t *ftdmchan = NULL;
/* confirm that the circuit is voice channel */
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n",
g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic,
DECODE_LCC_EVENT(evntType));
@ -1610,7 +1610,7 @@ ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
ftdm_channel_t *ftdmchan = NULL;
/* confirm that the circuit is voice channel */
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n",
g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic,
DECODE_LCC_EVENT(evntType));
@ -1663,7 +1663,7 @@ ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ
ftdm_channel_t *ftdmchan = NULL;
/* confirm that the circuit is voice channel */
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n",
g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic,
DECODE_LCC_EVENT(evntType));
@ -1704,7 +1704,7 @@ ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
ftdm_channel_t *ftdmchan = NULL;
/* confirm that the circuit is voice channel */
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n",
g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic,
DECODE_LCC_EVENT(evntType));
@ -1763,7 +1763,7 @@ ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_
ftdm_channel_t *ftdmchan = NULL;
/* confirm that the circuit is voice channel */
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n",
g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic,
DECODE_LCC_EVENT(evntType));
@ -1821,7 +1821,7 @@ ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ
ftdm_channel_t *ftdmchan = NULL;
/* confirm that the circuit is voice channel */
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n",
g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic,
DECODE_LCC_EVENT(evntType));
@ -1912,7 +1912,7 @@ ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
/* confirm that the circuit is voice channel */
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n",
g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic,
DECODE_LCC_EVENT(evntType));
@ -1963,7 +1963,7 @@ ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ
int range;
/* confirm that the circuit is voice channel */
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n",
g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic,
DECODE_LCC_EVENT(evntType));
@ -2020,7 +2020,7 @@ ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t ci
ftdm_channel_t *ftdmchan = NULL;
/* confirm that the circuit is voice channel */
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n",
g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic,
DECODE_LCC_EVENT(evntType));
@ -2070,7 +2070,7 @@ ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t ci
ftdm_channel_t *ftdmchan = NULL;
/* confirm that the circuit is voice channel */
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n",
g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic,
DECODE_LCC_EVENT(evntType));
@ -2122,7 +2122,7 @@ ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit
/* confirm that the circuit is voice channel */
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n",
g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic,
DECODE_LCC_EVENT(evntType));
@ -2185,7 +2185,7 @@ ftdm_status_t handle_cgb_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
memset(&status[0], '\0', sizeof(status));
/* confirm that the circuit is voice channel */
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n",
g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic,
DECODE_LCC_EVENT(evntType));
@ -2247,7 +2247,7 @@ ftdm_status_t handle_cgb_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
/* loop over the cics starting from circuit until range+1 */
for (x = circuit; x < (circuit + range + 1); x++) {
/* confirm this is a voice channel */
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type != VOICE) continue;
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type != SNG_CKT_VOICE) continue;
/* grab the circuit in question */
if (extract_chan_data(x, &sngss7_info, &ftdmchan)) {
@ -2333,7 +2333,7 @@ ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
memset(&status[0], '\0', sizeof(status));
/* confirm that the circuit is voice channel */
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n",
g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic,
DECODE_LCC_EVENT(evntType));
@ -2395,7 +2395,7 @@ ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ
/* loop over the cics starting from circuit until range+1 */
for (x = circuit; x < (circuit + range + 1); x++) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type != VOICE) continue;
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type != SNG_CKT_VOICE) continue;
/* grab the circuit in question */
if (extract_chan_data(x, &sngss7_info, &ftdmchan)) {
SS7_ERROR("Failed to extract channel data for circuit = %d!\n", x);
@ -2465,7 +2465,7 @@ ftdm_status_t handle_olm_msg(uint32_t suInstId, uint32_t spInstId, uint32_t circ
ftdm_channel_t *ftdmchan = NULL;
/* confirm that the circuit is voice channel */
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n",
g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic,
DECODE_LCC_EVENT(evntType));

View File

@ -66,7 +66,7 @@ void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCo
ftdm_channel_t *ftdmchan = NULL;
sngss7_event_data_t *sngss7_event = NULL;
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit);
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
return;
@ -110,7 +110,7 @@ void sngss7_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCo
ftdm_channel_t *ftdmchan = NULL;
sngss7_event_data_t *sngss7_event = NULL;
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit);
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
return;
@ -154,7 +154,7 @@ void sngss7_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCn
ftdm_channel_t *ftdmchan = NULL;
sngss7_event_data_t *sngss7_event = NULL;
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit);
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
return;
@ -199,7 +199,7 @@ void sngss7_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRe
ftdm_channel_t *ftdmchan = NULL;
sngss7_event_data_t *sngss7_event = NULL;
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit);
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
return;
@ -243,7 +243,7 @@ void sngss7_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRe
ftdm_channel_t *ftdmchan = NULL;
sngss7_event_data_t *sngss7_event = NULL;
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit);
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
return;
@ -287,7 +287,7 @@ void sngss7_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiIn
ftdm_channel_t *ftdmchan = NULL;
sngss7_event_data_t *sngss7_event = NULL;
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit);
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
return;
@ -331,7 +331,7 @@ void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint
ftdm_channel_t *ftdmchan = NULL;
sngss7_event_data_t *sngss7_event = NULL;
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit);
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
return;
@ -376,7 +376,7 @@ void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint
ftdm_channel_t *ftdmchan = NULL;
sngss7_event_data_t *sngss7_event = NULL;
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit);
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
return;
@ -421,7 +421,7 @@ void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit)
ftdm_channel_t *ftdmchan = NULL;
sngss7_event_data_t *sngss7_event = NULL;
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit);
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
return;
@ -480,7 +480,7 @@ void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint
*/
intfId = g_ftdm_sngss7_data.cfg.isupCkt[circuit].infId;
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_DEBUG("Rx %s on circuit that is not a voice CIC (%d) finding a new circuit\n",
DECODE_LCC_EVENT(evntType),
g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic);
@ -491,7 +491,7 @@ void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint
(g_ftdm_sngss7_data.cfg.isupCkt[x].id < ((g_ftdm_sngss7_data.cfg.procId +1) * 1000))) {
/**********************************************************************/
/* confirm this is a voice channel and not a gap/sig (no ftdmchan there) */
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type != VOICE) goto move_along;
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type != SNG_CKT_VOICE) goto move_along;
/* compare the intfIds */
if (g_ftdm_sngss7_data.cfg.isupCkt[x].infId == intfId) {
@ -531,10 +531,9 @@ move_along:
break;
/**************************************************************************/
default:
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
ftdm_log(FTDM_LOG_DEBUG, "Rx %s on circuit that is not a voice CIC (%d) (circuit:%d)\n",
DECODE_LCC_EVENT(evntType),
g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, circuit);
DECODE_LCC_EVENT(evntType), g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, circuit);
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
return;
}
@ -586,7 +585,7 @@ void sngss7_susp_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiS
ftdm_channel_t *ftdmchan = NULL;
sngss7_event_data_t *sngss7_event = NULL;
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit);
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
return;
@ -633,7 +632,7 @@ void sngss7_resm_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiR
ftdm_channel_t *ftdmchan = NULL;
sngss7_event_data_t *sngss7_event = NULL;
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit);
SS7_FUNC_TRACE_EXIT(__FUNCTION__);
return;

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2009, Konrad Hammel <konrad@sangoma.com>
* Copyright (c) 2009, Sangoma Technologies
* Konrad Hammel <konrad@sangoma.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -29,6 +30,12 @@
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Contributors:
*
* Moises Silva <moy@sangoma.com>
* David Yat Sin <dyatsin@sangoma.com>
*
*/
/* INCLUDE ********************************************************************/
@ -1402,7 +1409,7 @@ static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span)
sngss7_set_flag(sngss7_info->circuit, SNGSS7_ACTIVE);
/* if this is a non-voice channel, move along cause we're done with it */
if (sngss7_info->circuit->type != VOICE) continue;
if (sngss7_info->circuit->type != SNG_CKT_VOICE) continue;
/* lock the channel */
ftdm_mutex_lock(ftdmchan->mutex);

View File

@ -99,9 +99,9 @@ typedef enum {
} sng_bit_enums_t;
typedef enum {
VOICE = 0,
SIG,
HOLE
SNG_CKT_VOICE = 0,
SNG_CKT_SIG,
SNG_CKT_HOLE
} sng_ckt_type_t;
typedef enum {

View File

@ -150,7 +150,7 @@ ftdm_status_t disable_all_ckts_for_relay(void)
while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
/**********************************************************************/
/* make sure this is voice channel */
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) {
/* get the ftdmchan and ss7_chan_data from the circuit */
if (extract_chan_data(g_ftdm_sngss7_data.cfg.isupCkt[x].id, &sngss7_info, &ftdmchan)) {
@ -165,7 +165,7 @@ ftdm_status_t disable_all_ckts_for_relay(void)
/* throw the channel infId status flags to PAUSED ... they will be executed next process cycle */
sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_RESUME);
sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_PAUSED);
} /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) */
} /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) */
/* move along */
x++;
@ -189,7 +189,7 @@ ftdm_status_t enable_all_ckts_for_relay(void)
while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
/**********************************************************************/
/* make sure this is voice channel */
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) {
/* get the ftdmchan and ss7_chan_data from the circuit */
if (extract_chan_data(g_ftdm_sngss7_data.cfg.isupCkt[x].id, &sngss7_info, &ftdmchan)) {
@ -213,7 +213,7 @@ ftdm_status_t enable_all_ckts_for_relay(void)
sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_RESUME);
sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_PAUSED);
}
} /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) */
} /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) */
/* move along */
x++;
@ -233,7 +233,7 @@ ftdm_status_t reconfig_all_ckts_for_relay(void)
x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;
while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
/**************************************************************************/
if ( g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
if ( g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) {
/* grab the private data structure */
sngss7_info = g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
@ -262,7 +262,7 @@ ftdm_status_t block_all_ckts_for_relay(uint32_t procId)
x = (procId * 1000) + 1;
while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
/**************************************************************************/
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) {
/* send a block request via stack manager */
ret = ftmod_ss7_block_isup_ckt(g_ftdm_sngss7_data.cfg.isupCkt[x].id);
@ -276,7 +276,7 @@ ftdm_status_t block_all_ckts_for_relay(uint32_t procId)
g_ftdm_sngss7_data.cfg.isupCkt[x].id);
}
} /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) */
} /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) */
/* move along */
x++;
@ -322,7 +322,7 @@ static ftdm_status_t unblock_all_ckts_for_relay(uint32_t procId)
x = (procId * 1000) + 1;
while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
/**************************************************************************/
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) {
/* send a block request via stack manager */
ret = ftmod_ss7_unblock_isup_ckt(g_ftdm_sngss7_data.cfg.isupCkt[x].id);
@ -336,7 +336,7 @@ static ftdm_status_t unblock_all_ckts_for_relay(uint32_t procId)
g_ftdm_sngss7_data.cfg.isupCkt[x].id);
}
} /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) */
} /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) */
/* move along */
x++;

View File

@ -974,7 +974,7 @@ ftdm_status_t check_if_rx_grs_started(ftdm_span_t *ftdmspan)
for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) {
/* confirm this is a voice channel, otherwise we do nothing */
if (g_ftdm_sngss7_data.cfg.isupCkt[i].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[i].type != SNG_CKT_VOICE) {
continue;
}
@ -1040,7 +1040,7 @@ ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan)
for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) {
/* confirm this is a voice channel, otherwise we do nothing */
if (g_ftdm_sngss7_data.cfg.isupCkt[i].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[i].type != SNG_CKT_VOICE) {
continue;
}
@ -1074,7 +1074,7 @@ ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan)
for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) {
/* confirm this is a voice channel, otherwise we do nothing */
if (g_ftdm_sngss7_data.cfg.isupCkt[i].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[i].type != SNG_CKT_VOICE) {
continue;
}
@ -1114,7 +1114,7 @@ GRS_UNLOCK_ALL:
for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) {
/* confirm this is a voice channel, otherwise we do nothing */
if (g_ftdm_sngss7_data.cfg.isupCkt[i].type != VOICE) {
if (g_ftdm_sngss7_data.cfg.isupCkt[i].type != SNG_CKT_VOICE) {
continue;
}

View File

@ -2901,11 +2901,11 @@ static int ftmod_ss7_fill_in_ccSpan(sng_ccSpan_t *ccSpan)
g_ftdm_sngss7_data.cfg.isupCkt[x].chan = count;
if (timeslot.siglink) {
g_ftdm_sngss7_data.cfg.isupCkt[x].type = SIG;
g_ftdm_sngss7_data.cfg.isupCkt[x].type = SNG_CKT_SIG;
} else if (timeslot.gap) {
g_ftdm_sngss7_data.cfg.isupCkt[x].type = HOLE;
g_ftdm_sngss7_data.cfg.isupCkt[x].type = SNG_CKT_HOLE;
} else {
g_ftdm_sngss7_data.cfg.isupCkt[x].type = VOICE;
g_ftdm_sngss7_data.cfg.isupCkt[x].type = SNG_CKT_VOICE;
/* throw the flag to indicate that we need to start call control */
sngss7_set_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC);