freetdm: testing code of sending suspend message
This commit is contained in:
parent
777f946e2f
commit
14d8b42e58
|
@ -1389,67 +1389,64 @@ static ftdm_status_t handle_tx_rels(ftdm_stream_handle_t *stream, int span, int
|
||||||
static ftdm_status_t handle_tx_susp(ftdm_stream_handle_t *stream, int span, int chan, int verbose)
|
static ftdm_status_t handle_tx_susp(ftdm_stream_handle_t *stream, int span, int chan, int verbose)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
|
ftdm_channel_t *ftdmchan;
|
||||||
|
int lspan;
|
||||||
|
int lchan;
|
||||||
|
SiSuspEvnt suspEvnt;
|
||||||
sngss7_chan_data_t *ss7_info;
|
sngss7_chan_data_t *ss7_info;
|
||||||
ftdm_channel_t *ftdmchan;
|
|
||||||
int lspan;
|
|
||||||
int lchan;
|
|
||||||
|
|
||||||
|
/*
|
||||||
SS7_ERROR("JZ error alert. handle_tx_susp \n");
|
SS7_ERROR("JZ error alert. handle_tx_susp \n");
|
||||||
return FTDM_FAIL;
|
return FTDM_FAIL;
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* JZ implementation */
|
||||||
|
|
||||||
|
if (span <= 0 || chan <= 0 || chan >= 32 ) {
|
||||||
|
SS7_ERROR ("Wrong span number or chan number.\n");
|
||||||
|
return FTDM_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;
|
x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1;
|
||||||
while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
|
for ( ; g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0; x++) {
|
||||||
if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_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;
|
ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
|
||||||
ftdmchan = ss7_info->ftdmchan;
|
ftdmchan = ss7_info->ftdmchan;
|
||||||
|
|
||||||
/* if span == 0 then all spans should be printed */
|
lspan = span;
|
||||||
if (span == 0) {
|
lchan = chan;
|
||||||
lspan = ftdmchan->physical_span_id;
|
|
||||||
} else {
|
if ((ftdmchan->physical_span_id != lspan) && (ftdmchan->physical_chan_id != lchan)) {
|
||||||
lspan = span;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if chan == 0 then all chans should be printed */
|
ftdm_mutex_lock(ftdmchan->mutex);
|
||||||
if (chan == 0) {
|
|
||||||
lchan = ftdmchan->physical_chan_id;
|
|
||||||
} else {
|
|
||||||
lchan = chan;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) {
|
if (check_for_state_change(ftdmchan)) {
|
||||||
/* now that we have the right channel...put a lock on it so no-one else can use it */
|
SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", ss7_info->circuit->cic);
|
||||||
ftdm_mutex_lock(ftdmchan->mutex);
|
ftdm_assert(0, "State change not completed\n");
|
||||||
|
|
||||||
/* 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", ss7_info->circuit->cic);
|
|
||||||
/* check if we need to die */
|
|
||||||
ftdm_assert(0, "State change not completed\n");
|
|
||||||
/* unlock the channel again before we exit */
|
|
||||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
|
||||||
/* move to the next channel */
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
/* throw the ckt block flag */
|
|
||||||
sngss7_set_ckt_blk_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX);
|
|
||||||
|
|
||||||
/* set the channel to suspended state */
|
|
||||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* unlock the channel again before we exit */
|
|
||||||
ftdm_mutex_unlock(ftdmchan->mutex);
|
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
} /* if ( span and chan) */
|
/*
|
||||||
|
sngss7_set_ckt_blk_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX);
|
||||||
} /* if ( cic != 0) */
|
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
|
||||||
|
*/
|
||||||
/* go the next circuit */
|
suspEvnt.susResInd.eh.pres = PRSNT_NODEF;
|
||||||
x++;
|
suspEvnt.susResInd.susResInd.pres = PRSNT_NODEF;
|
||||||
} /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */
|
suspEvnt.susResInd.susResInd.val = EVTSITSUSPREQ;
|
||||||
|
|
||||||
|
sng_cc_susp_request(lspan, ss7_info->suInstId, ss7_info->spInstId, ss7_info->circuit->id, &suspEvnt);
|
||||||
|
|
||||||
|
ftdm_mutex_unlock(ftdmchan->mutex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handle_show_blocks(stream, span, chan, verbose);
|
handle_show_blocks(stream, span, chan, verbose);
|
||||||
|
/* end of JZ implementation */
|
||||||
|
|
||||||
return FTDM_SUCCESS;
|
return FTDM_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -607,7 +607,7 @@ typedef enum {
|
||||||
FLAG_GRP_HW_UNBLK_TX = (1 << 24),
|
FLAG_GRP_HW_UNBLK_TX = (1 << 24),
|
||||||
FLAG_GRP_HW_UNBLK_TX_DN = (1 << 25),
|
FLAG_GRP_HW_UNBLK_TX_DN = (1 << 25),
|
||||||
FLAG_GRP_MN_UNBLK_TX = (1 << 26),
|
FLAG_GRP_MN_UNBLK_TX = (1 << 26),
|
||||||
FLAG_GRP_MN_UNBLK_TX_DN = (1 << 27)
|
FLAG_GRP_MN_UNBLK_TX_DN = (1 << 27),
|
||||||
} sng_ckt_block_flag_t;
|
} sng_ckt_block_flag_t;
|
||||||
|
|
||||||
#define BLK_FLAGS_STRING \
|
#define BLK_FLAGS_STRING \
|
||||||
|
|
Loading…
Reference in New Issue