From 269595ec60f1caaf1bc8ef94dbb4f70d9f163fdb Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 10 Jun 2011 11:52:57 -0400 Subject: [PATCH] chlog: freetdm: ISDN - Support for chan-id-invert-extend-bit --- .../ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h | 5 +++++ .../ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c | 6 ++++++ .../ftmod_sangoma_isdn_stack_cfg.c | 12 +++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 280b3ed527..a3cfea88ee 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -324,6 +324,11 @@ typedef struct ftdm_sngisdn_data { uint8_t num_dchan; sngisdn_dchan_data_t dchans[MAX_L1_LINKS+1]; sngisdn_span_data_t *spans[MAX_L1_LINKS+1]; /* spans are indexed by link_id */ + +#ifdef SANGOMA_ISDN_CHAN_ID_INVERT_BIT + /* Since this is a global configuration, place it here instead of sngisdn_span_data_t */ + uint8_t chan_id_invert_extend_bit; +#endif }ftdm_sngisdn_data_t; typedef struct ftdm2trillium diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index c4e64d7727..66721eba0a 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -393,6 +393,12 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ if (parse_early_media(val, span) != FTDM_SUCCESS) { return FTDM_FAIL; } + } else if (!strcasecmp(var, "chan-id-invert-extend-bit")) { +#ifdef SANGOMA_ISDN_CHAN_ID_INVERT_BIT + parse_yesno(var, val, &g_sngisdn_data.chan_id_invert_extend_bit); +#else + ftdm_log(FTDM_LOG_WARNING, "chan-id-invert-extend-bit is not supported in your version of libsng_isdn\n"); +#endif } else { ftdm_log(FTDM_LOG_WARNING, "Ignoring unknown parameter %s\n", ftdm_parameters[paramindex].var); } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c index 88aa9131b6..4288a4d615 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c @@ -624,7 +624,7 @@ ftdm_status_t sngisdn_stack_cfg_q931_dlsap(ftdm_span_t *span) cfg.t.cfg.s.inDLSAP.tCbCfg = TRUE; cfg.t.cfg.s.inDLSAP.tCbId = signal_data->cc_id; - + if (signal_data->facility == SNGISDN_OPT_TRUE) { cfg.t.cfg.s.inDLSAP.facilityHandling = IN_FACILITY_STANDRD; } else { @@ -720,6 +720,16 @@ ftdm_status_t sngisdn_stack_cfg_q931_dlsap(ftdm_span_t *span) } cfg.t.cfg.s.inDLSAP.useSubAdr = 0; /* call routing on subaddress */ +#ifdef SANGOMA_ISDN_CHAN_ID_INVERT_BIT + if (signal_data->switchtype == SNGISDN_SWITCH_DMS100 && + g_sngisdn_data.chan_id_invert_extend_bit == SNGISDN_OPT_TRUE) { + /* Since this feature is not standard, we modified Trillium to check + the useSubAdr field and remove the extended bit if this is set, this + is a global configuration and once set, applies to all spans configured + as DMS 100 */ + cfg.t.cfg.s.inDLSAP.useSubAdr = PRSNT_NODEF; + } +#endif cfg.t.cfg.s.inDLSAP.adrPref = 0; /* use of prefix for international calls */ cfg.t.cfg.s.inDLSAP.nmbPrefDig = 0; /* number of digits used for prefix */ for (i = 0; i < IN_MAXPREFDIG; i++)