freetdm: adding susp/resm/rels but not finished.

disable t6 finished.
This commit is contained in:
James Zhang 2012-01-30 10:28:08 -05:00
parent 8476d66465
commit 777f946e2f
2 changed files with 142 additions and 10 deletions

View File

@ -71,6 +71,10 @@ static ftdm_status_t handle_show_status(ftdm_stream_handle_t *stream, int span,
static ftdm_status_t handle_tx_rsc(ftdm_stream_handle_t *stream, int span, int chan, int verbose);
static ftdm_status_t handle_tx_grs(ftdm_stream_handle_t *stream, int span, int chan, int range, int verbose);
static ftdm_status_t handle_tx_susp(ftdm_stream_handle_t *stream, int span, int chan, int verbose);
static ftdm_status_t handle_tx_resm(ftdm_stream_handle_t *stream, int span, int chan, int verbose);
static ftdm_status_t handle_tx_rels(ftdm_stream_handle_t *stream, int span, int chan, int verbose);
static ftdm_status_t handle_tx_blo(ftdm_stream_handle_t *stream, int span, int chan, int verbose);
static ftdm_status_t handle_tx_ubl(ftdm_stream_handle_t *stream, int span, int chan, int verbose);
@ -458,9 +462,49 @@ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const cha
goto handle_cli_error;
/**********************************************************************/
}
/**************************************************************************/
/* sending resume for a ckt's call */
} else if (!strcasecmp(argv[c], "resm") == FTDM_FAIL) {
if (check_arg_count(argc, 5) == FTDM_FAIL) {
goto handle_cli_error_argc;
}
if (extract_span_chan(argv, 2, &span, &chan) == FTDM_SUCCESS) {
handle_tx_resm(stream, span, chan, verbose);
} else {
stream->write_function(stream, "Bad command format. \n");
goto handle_cli_error_argc;
}
/**************************************************************************/
/* sending resume for a ckt's call */
} else if (!strcasecmp(argv[c], "rels")) {
if (check_arg_count(argc, 5) == FTDM_FAIL) {
goto handle_cli_error_argc;
}
if (extract_span_chan(argv, 2, &span, &chan) == FTDM_SUCCESS) {
handle_tx_rels(stream, span, chan, verbose);
} else {
stream->write_function(stream, "Bad command format.\n");
goto handle_cli_error_argc;
}
/**************************************************************************/
/* sending suspend for a ckt's call */
} else if (!strcasecmp(argv[c], "susp")) {
if (check_arg_count(argc, 5) == FTDM_FAIL) {
goto handle_cli_error_argc;
}
if (extract_span_chan(argv, 2, &span, &chan) == FTDM_SUCCESS) {
handle_tx_susp(stream, span, chan, verbose);
} else {
stream->write_function(stream, "Bad command format. \n");
goto handle_cli_error_argc;
}
/**************************************************************************/
} else if (!strcasecmp(argv[c], "blo")) {
/**************************************************************************/
if (check_arg_count(argc, 2)) goto handle_cli_error_argc;
c++;
@ -1330,6 +1374,85 @@ static ftdm_status_t handle_show_status(ftdm_stream_handle_t *stream, int span,
return FTDM_SUCCESS;
}
static ftdm_status_t handle_tx_resm(ftdm_stream_handle_t *stream, int span, int chan, int verbose)
{
SS7_ERROR("JZ error alert. handle_tx_resm \n");
return FTDM_FAIL;
}
static ftdm_status_t handle_tx_rels(ftdm_stream_handle_t *stream, int span, int chan, int verbose)
{
SS7_ERROR("JZ error alert. handle_tx_rels \n");
return FTDM_FAIL;
}
/******************************************************************************/
static ftdm_status_t handle_tx_susp(ftdm_stream_handle_t *stream, int span, int chan, int verbose)
{
int x;
sngss7_chan_data_t *ss7_info;
ftdm_channel_t *ftdmchan;
int lspan;
int lchan;
SS7_ERROR("JZ error alert. handle_tx_susp \n");
return FTDM_FAIL;
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 == SNG_CKT_VOICE) {
ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj;
ftdmchan = ss7_info->ftdmchan;
/* if span == 0 then all spans should be printed */
if (span == 0) {
lspan = ftdmchan->physical_span_id;
} else {
lspan = span;
}
/* if chan == 0 then all chans should be printed */
if (chan == 0) {
lchan = ftdmchan->physical_chan_id;
} else {
lchan = chan;
}
if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) {
/* now that we have the right channel...put a lock on it so no-one else can use it */
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", 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);
} /* if ( span and chan) */
} /* if ( cic != 0) */
/* go the next circuit */
x++;
} /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */
handle_show_blocks(stream, span, chan, verbose);
return FTDM_SUCCESS;
}
/******************************************************************************/
static ftdm_status_t handle_tx_blo(ftdm_stream_handle_t *stream, int span, int chan, int verbose)
{

View File

@ -40,13 +40,6 @@
/* INCLUDE ********************************************************************/
#include "ftmod_sangoma_ss7_main.h"
#include <sng_ss7/ci_db.h>
#include <sng_ss7/cm_hash.h>
#include <sng_ss7/cm_hash.x>
#include <sng_ss7/si.h>
#include <sng_ss7/si_mf.h>
#include <sng_ss7/si_mf.x>
#include <sng_ss7/si.x>
/******************************************************************************/
/* DEFINES ********************************************************************/
@ -583,6 +576,14 @@ static void ftdm_sangoma_ss7_process_stack_event (sngss7_event_data_t *sngss7_ev
if (sngss7_test_ckt_flag(sngss7_info, FLAG_SUS_RECVD) &&
!sngss7_test_ckt_flag(sngss7_info, FLAG_T6_CANCELED)) {
if (sng_cancel_isup_tmr(sngss7_info->suInstId, ISUP_T6i) == RFAILED ) {
SS7_ERROR_CHAN(ftdmchan,"[CIC:%d]could not stop timer T6 \n", sngss7_info->circuit->cic);
} else {
sngss7_set_ckt_flag(sngss7_info, FLAG_T6_CANCELED);
SS7_ERROR_CHAN(ftdmchan,"[CIC:%d] isup timer T6 has been cancelled. \n", sngss7_info->circuit->cic);
}
#if 0
/* SPIROU cert, disable ISUP T6 when bridged natively */
int trc = 0;
SiCon *siCon = NULL;
@ -597,6 +598,7 @@ static void ftdm_sangoma_ss7_process_stack_event (sngss7_event_data_t *sngss7_ev
} else {
SS7_ERROR_CHAN(ftdmchan,"[CIC:%d]could not find siCon\n", sngss7_info->circuit->cic);
}
#endif
}
}
@ -995,6 +997,14 @@ static void ftdm_sangoma_ss7_process_peer_stack_event (ftdm_channel_t *ftdmchan,
if (sngss7_test_ckt_flag(sngss7_info, FLAG_SUS_RECVD) &&
!sngss7_test_ckt_flag(sngss7_info, FLAG_T6_CANCELED)) {
if (sng_cancel_isup_tmr(sngss7_info->suInstId, ISUP_T6i) == RFAILED ) {
SS7_ERROR_CHAN(ftdmchan,"[CIC:%d]could not stop timer T6 \n", sngss7_info->circuit->cic);
} else {
sngss7_set_ckt_flag(sngss7_info, FLAG_T6_CANCELED);
SS7_ERROR_CHAN(ftdmchan,"[CIC:%d] isup timer T6 has been cancelled. \n", sngss7_info->circuit->cic);
}
#if 0
/* SPIROU cert, disable ISUP T6 when bridged natively */
int trc = 0;
SiCon *siCon = NULL;
@ -1009,9 +1019,8 @@ static void ftdm_sangoma_ss7_process_peer_stack_event (ftdm_channel_t *ftdmchan,
} else {
SS7_ERROR_CHAN(ftdmchan,"[CIC:%d]could not find siCon\n", sngss7_info->circuit->cic);
}
#endif
}
}
static ftdm_status_t ftdm_sangoma_ss7_native_bridge_state_change(ftdm_channel_t *ftdmchan);