Added new channel type clear-channel for channels that do not have a signalling module

This commit is contained in:
David Yat Sin 2012-07-25 20:41:01 -04:00
parent 828a13733b
commit 3c38278134
3 changed files with 27 additions and 9 deletions

View File

@ -1470,13 +1470,23 @@ FT_DECLARE(ftdm_status_t) ftdm_group_channel_use_count(ftdm_group_t *group, uint
static __inline__ int chan_is_avail(ftdm_channel_t *check)
{
if (!ftdm_test_flag(check, FTDM_CHANNEL_READY) ||
!ftdm_test_flag(check, FTDM_CHANNEL_SIG_UP) ||
ftdm_test_flag(check, FTDM_CHANNEL_INUSE) ||
ftdm_test_flag(check, FTDM_CHANNEL_SUSPENDED) ||
ftdm_test_flag(check, FTDM_CHANNEL_IN_ALARM) ||
check->state != FTDM_CHANNEL_STATE_DOWN) {
return 0;
if (check->type == FTDM_CHAN_TYPE_CLEAR) {
if (!ftdm_test_flag(check, FTDM_CHANNEL_READY) ||
ftdm_test_flag(check, FTDM_CHANNEL_INUSE) ||
ftdm_test_flag(check, FTDM_CHANNEL_SUSPENDED) ||
ftdm_test_flag(check, FTDM_CHANNEL_IN_ALARM) ||
check->state != FTDM_CHANNEL_STATE_DOWN) {
return 0;
}
} else {
if (!ftdm_test_flag(check, FTDM_CHANNEL_READY) ||
!ftdm_test_flag(check, FTDM_CHANNEL_SIG_UP) ||
ftdm_test_flag(check, FTDM_CHANNEL_INUSE) ||
ftdm_test_flag(check, FTDM_CHANNEL_SUSPENDED) ||
ftdm_test_flag(check, FTDM_CHANNEL_IN_ALARM) ||
check->state != FTDM_CHANNEL_STATE_DOWN) {
return 0;
}
}
return 1;
}
@ -5129,6 +5139,12 @@ static ftdm_status_t load_config(void)
} else {
ftdm_log(FTDM_LOG_WARNING, "Cannot add EM channels to a non-EM trunk!\n");
}
} else if (!strcasecmp(var, "clear-channel")) {
unsigned chans_configured = 0;
chan_config.type = FTDM_CHAN_TYPE_CLEAR;
if (ftdm_configure_span_channels(span, val, &chan_config, &chans_configured) == FTDM_SUCCESS) {
configured += chans_configured;
}
} else if (!strcasecmp(var, "b-channel")) {
unsigned chans_configured = 0;
chan_config.type = FTDM_CHAN_TYPE_B;

View File

@ -306,7 +306,8 @@ static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start
if (type == FTDM_CHAN_TYPE_FXS
|| type == FTDM_CHAN_TYPE_FXO
|| type == FTDM_CHAN_TYPE_CAS
|| type == FTDM_CHAN_TYPE_B) {
|| type == FTDM_CHAN_TYPE_B
|| type == FTDM_CHAN_TYPE_CLEAR) {
int err;
hwec_str = "unavailable";

View File

@ -181,9 +181,10 @@ typedef enum {
FTDM_CHAN_TYPE_FXO, /*!< FXO analog channel */
FTDM_CHAN_TYPE_EM, /*!< E & M channel */
FTDM_CHAN_TYPE_CAS, /*!< CAS channel */
FTDM_CHAN_TYPE_CLEAR, /* Clear channnel - no signalling module */
FTDM_CHAN_TYPE_COUNT /*!< Count of channel types */
} ftdm_chan_type_t;
#define CHAN_TYPE_STRINGS "B", "DQ921", "DQ931", "FXS", "FXO", "EM", "CAS", "INVALID"
#define CHAN_TYPE_STRINGS "B", "DQ921", "DQ931", "FXS", "FXO", "EM", "CAS", "CLEAR", "INVALID"
/*! \brief transform from channel type to string and from string to channel type
* ftdm_str2ftdm_chan_type transforms a channel string (ie: "FXO" to FTDM_CHAN_TYPE_FXO)
* ftdm_chan_type2str transforms a channel type to string (ie: FTDM_CHAN_TYPE_B to "B")