freetdm - ISDN: Added API command to print Trillium memory info

This commit is contained in:
David Yat Sin 2011-05-30 17:07:59 -04:00
parent c20f56bad0
commit 478e685292
5 changed files with 16 additions and 8 deletions

View File

@ -1297,6 +1297,9 @@ static FIO_API_FUNCTION(ftdm_sangoma_isdn_api)
status = sngisdn_check_free_ids(); status = sngisdn_check_free_ids();
goto done; goto done;
} }
if (!strcasecmp(argv[0], "check_mem")) {
sngisdn_get_memory_info();
}
done: done:
switch (status) { switch (status) {
case FTDM_SUCCESS: case FTDM_SUCCESS:

View File

@ -394,7 +394,7 @@ void sngisdn_trace_interpreted_q931(sngisdn_span_data_t *signal_data, ftdm_trace
void sngisdn_trace_raw_q921(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t dir, uint8_t *data, uint32_t data_len); void sngisdn_trace_raw_q921(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t dir, uint8_t *data, uint32_t data_len);
void sngisdn_trace_raw_q931(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t dir, uint8_t *data, uint32_t data_len); void sngisdn_trace_raw_q931(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t dir, uint8_t *data, uint32_t data_len);
void get_memory_info(void); void sngisdn_get_memory_info(void);
ftdm_status_t sng_isdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt); ftdm_status_t sng_isdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt);
ftdm_status_t sngisdn_check_free_ids(void); ftdm_status_t sngisdn_check_free_ids(void);

View File

@ -1134,10 +1134,9 @@ static void sngisdn_process_restart_confirm(ftdm_channel_t *ftdmchan)
static ftdm_status_t sngisdn_force_down(ftdm_channel_t *ftdmchan) static ftdm_status_t sngisdn_force_down(ftdm_channel_t *ftdmchan)
{ {
sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)ftdmchan->call_data; sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)ftdmchan->call_data;
ftdm_status_t status = FTDM_SUCCESS;
ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Forcing channel to DOWN state (%s)\n", ftdm_channel_state2str(ftdmchan->state)); ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Forcing channel to DOWN state (%s)\n", ftdm_channel_state2str(ftdmchan->state));
ftdm_status_t status = FTDM_SUCCESS;
switch (ftdmchan->state) { switch (ftdmchan->state) {
case FTDM_CHANNEL_STATE_DOWN: case FTDM_CHANNEL_STATE_DOWN:
/* Do nothing */ /* Do nothing */
@ -1257,11 +1256,18 @@ void sngisdn_process_rst_ind (sngisdn_event_data_t *sngisdn_event)
int16_t dChan = sngisdn_event->dChan; int16_t dChan = sngisdn_event->dChan;
uint8_t ces = sngisdn_event->ces; uint8_t ces = sngisdn_event->ces;
uint8_t evntType = sngisdn_event->evntType; uint8_t evntType = sngisdn_event->evntType;
Rst *rstEvnt = NULL;
sngisdn_span_data_t *signal_data = NULL;
ISDN_FUNC_TRACE_ENTER(__FUNCTION__); ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
Rst *rstEvnt = &sngisdn_event->event.rstEvnt; rstEvnt = &sngisdn_event->event.rstEvnt;
sngisdn_span_data_t *signal_data = g_sngisdn_data.dchans[dChan].spans[1];
/* TODO: readjust this when NFAS is implemented as signal_data will not always be the first
* span for that d-channel */
signal_data = g_sngisdn_data.dchans[dChan].spans[1];
if (!signal_data) { if (!signal_data) {
ftdm_log(FTDM_LOG_CRIT, "Received RESTART IND on unconfigured span (suId:%d)\n", suId); ftdm_log(FTDM_LOG_CRIT, "Received RESTART IND on unconfigured span (suId:%d)\n", suId);
return; return;

View File

@ -708,7 +708,7 @@ void sngisdn_rcv_q921_ind(BdMngmt *status)
void sngisdn_rcv_q931_ind(InMngmt *status) void sngisdn_rcv_q931_ind(InMngmt *status)
{ {
if (status->t.usta.alarm.cause == 287) { if (status->t.usta.alarm.cause == 287) {
get_memory_info(); sngisdn_get_memory_info();
return; return;
} }

View File

@ -47,7 +47,6 @@ static uint8_t get_trillium_val(ftdm2trillium_t *vals, uint8_t ftdm_val, uint8_t
static uint8_t get_ftdm_val(ftdm2trillium_t *vals, uint8_t trillium_val, uint8_t default_val); static uint8_t get_ftdm_val(ftdm2trillium_t *vals, uint8_t trillium_val, uint8_t default_val);
extern ftdm_sngisdn_data_t g_sngisdn_data; extern ftdm_sngisdn_data_t g_sngisdn_data;
void get_memory_info(void);
ftdm2trillium_t npi_codes[] = { ftdm2trillium_t npi_codes[] = {
{FTDM_NPI_UNKNOWN, IN_NP_UNK}, {FTDM_NPI_UNKNOWN, IN_NP_UNK},
@ -1085,7 +1084,7 @@ ftdm_status_t sngisdn_check_free_ids(void)
return FTDM_SUCCESS; return FTDM_SUCCESS;
} }
void get_memory_info(void) void sngisdn_get_memory_info(void)
{ {
U32 availmen = 0; U32 availmen = 0;
SRegInfoShow(S_REG, &availmen); SRegInfoShow(S_REG, &availmen);