diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml
index 9e31cccf08..507fc7bd34 100644
--- a/docs/phrase/phrase_en.xml
+++ b/docs/phrase/phrase_en.xml
@@ -5,6 +5,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -222,6 +239,8 @@
+
+
@@ -270,7 +289,13 @@
-
+
+
+
+
+
+
+
@@ -432,8 +457,6 @@
-
-
@@ -445,37 +468,14 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -489,6 +489,8 @@
+
+
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 902729d01c..ac69fa8d66 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
@@ -292,6 +292,12 @@ typedef struct ftdm_sngisdn_data {
sngisdn_span_data_t *spans[MAX_L1_LINKS+1]; /* spans are indexed by link_id */
}ftdm_sngisdn_data_t;
+typedef struct ftdm2trillium
+{
+ uint8_t ftdm_val;
+ uint8_t trillium_val;
+}ftdm2trillium_t;
+
/* TODO implement these 2 functions */
#define ISDN_FUNC_TRACE_ENTER(a)
diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c
index 880b61efeb..edad62fc0d 100644
--- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c
+++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c
@@ -43,9 +43,55 @@ SNGISDN_STR2ENUM(ftdm_str2ftdm_sngisdn_progind_descr, ftdm_sngisdn_progind_descr
SNGISDN_ENUM_NAMES(SNGISDN_PROGIND_LOC_NAMES, SNGISDN_PROGIND_LOC_STRINGS)
SNGISDN_STR2ENUM(ftdm_str2ftdm_sngisdn_progind_loc, ftdm_sngisdn_progind_loc2str, ftdm_sngisdn_progind_loc_t, SNGISDN_PROGIND_LOC_NAMES, SNGISDN_PROGIND_LOC_INVALID)
+static uint8_t get_trillium_val(ftdm2trillium_t *vals, uint8_t ftdm_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;
void get_memory_info(void);
+ftdm2trillium_t npi_codes[] = {
+ {FTDM_NPI_UNKNOWN, IN_NP_UNK},
+ {FTDM_NPI_ISDN, IN_NP_ISDN},
+ {FTDM_NPI_DATA, IN_NP_DATA},
+ {FTDM_NPI_TELEX, IN_NP_TELEX},
+ {FTDM_NPI_NATIONAL, IN_NP_NATIONAL},
+ {FTDM_NPI_PRIVATE, IN_NP_PRIVATE},
+ {FTDM_NPI_RESERVED, IN_NP_EXT},
+};
+
+ftdm2trillium_t ton_codes[] = {
+ {FTDM_TON_UNKNOWN, IN_TON_UNK},
+ {FTDM_TON_INTERNATIONAL, IN_TON_INT},
+ {FTDM_TON_NATIONAL, IN_TON_NAT},
+ {FTDM_TON_NETWORK_SPECIFIC, IN_TON_NETSPEC},
+ {FTDM_TON_SUBSCRIBER_NUMBER, IN_TON_SUB},
+ {FTDM_TON_ABBREVIATED_NUMBER, IN_TON_ABB},
+ {FTDM_TON_RESERVED, IN_TON_EXT},
+};
+
+static uint8_t get_trillium_val(ftdm2trillium_t *vals, uint8_t ftdm_val, uint8_t default_val)
+{
+ ftdm2trillium_t *val = vals;
+ while(val++) {
+ if (val->ftdm_val == ftdm_val) {
+ return val->trillium_val;
+ }
+ }
+ return default_val;
+}
+
+static uint8_t get_ftdm_val(ftdm2trillium_t *vals, uint8_t trillium_val, uint8_t default_val)
+{
+ ftdm2trillium_t *val = vals;
+ while(val++) {
+ if (val->trillium_val == trillium_val) {
+ return val->ftdm_val;
+ }
+ }
+ return default_val;
+}
+
+
void clear_call_data(sngisdn_chan_data_t *sngisdn_info)
{
uint32_t cc_id = ((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->cc_id;
@@ -257,11 +303,11 @@ ftdm_status_t get_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb)
}
if (cdPtyNmb->nmbPlanId.pres == PRSNT_NODEF) {
- caller_data->dnis.plan = cdPtyNmb->nmbPlanId.val;
+ caller_data->dnis.plan = get_ftdm_val(npi_codes, cdPtyNmb->nmbPlanId.val, IN_NP_UNK);
}
if (cdPtyNmb->typeNmb0.pres == PRSNT_NODEF) {
- caller_data->dnis.type = cdPtyNmb->typeNmb0.val;
+ caller_data->dnis.type = get_ftdm_val(ton_codes, cdPtyNmb->typeNmb0.val, IN_TON_UNK);
}
if (cdPtyNmb->nmbDigits.pres == PRSNT_NODEF) {
@@ -281,11 +327,11 @@ ftdm_status_t get_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb)
}
if (redirNmb->nmbPlanId.pres == PRSNT_NODEF) {
- caller_data->rdnis.plan = redirNmb->nmbPlanId.val;
+ caller_data->rdnis.plan = get_ftdm_val(npi_codes, redirNmb->nmbPlanId.val, IN_NP_UNK);
}
if (redirNmb->typeNmb.pres == PRSNT_NODEF) {
- caller_data->rdnis.type = redirNmb->typeNmb.val;
+ caller_data->rdnis.type = get_ftdm_val(ton_codes, redirNmb->typeNmb.val, IN_TON_UNK);
}
if (redirNmb->nmbDigits.pres == PRSNT_NODEF) {
@@ -380,11 +426,13 @@ ftdm_status_t get_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, uint8
ftdm_status_t get_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd)
{
uint8_t val;
+
if (!progInd->eh.pres) {
return FTDM_FAIL;
}
if (progInd->progDesc.pres) {
+ /* TODO: use get_ftdm_val function and table here */
switch (progInd->progDesc.val) {
case IN_PD_NOTETEISDN:
val = SNGISDN_PROGIND_DESCR_NETE_ISDN;
@@ -462,19 +510,11 @@ ftdm_status_t set_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb)
cgPtyNmb->presInd0.val = caller_data->pres;
cgPtyNmb->nmbPlanId.pres = PRSNT_NODEF;
- if (caller_data->cid_num.plan >= FTDM_NPI_INVALID) {
- cgPtyNmb->nmbPlanId.val = FTDM_NPI_UNKNOWN;
- } else {
- cgPtyNmb->nmbPlanId.val = caller_data->cid_num.plan;
- }
+ cgPtyNmb->nmbPlanId.val = get_trillium_val(npi_codes, caller_data->cid_num.plan, IN_NP_UNK);
cgPtyNmb->typeNmb1.pres = PRSNT_NODEF;
- if (caller_data->cid_num.type >= FTDM_TON_INVALID) {
- cgPtyNmb->typeNmb1.val = FTDM_TON_UNKNOWN;
- } else {
- cgPtyNmb->typeNmb1.val = caller_data->cid_num.type;
- }
+ cgPtyNmb->typeNmb1.val = get_trillium_val(ton_codes, caller_data->cid_num.type, IN_TON_UNK);
cgPtyNmb->nmbDigits.pres = PRSNT_NODEF;
cgPtyNmb->nmbDigits.len = len;
@@ -508,7 +548,7 @@ ftdm_status_t set_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb)
val = FTDM_SCREENING_INVALID;
string = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.cg_pty2.screening_ind");
- if ((string != NULL) && (*string)) {
+ if (!ftdm_strlen_zero(string)) {
val = ftdm_str2ftdm_screening(string);
}
@@ -525,7 +565,7 @@ ftdm_status_t set_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb)
val = FTDM_PRES_INVALID;
string = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.cg_pty2.presentation_ind");
- if ((string != NULL) && (*string)) {
+ if (!ftdm_strlen_zero(string)) {
val = ftdm_str2ftdm_presentation(string);
}
@@ -540,14 +580,14 @@ ftdm_status_t set_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb)
val = FTDM_NPI_INVALID;
string = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.cg_pty2.npi");
- if ((string != NULL) && (*string)) {
+ if (!ftdm_strlen_zero(string)) {
val = ftdm_str2ftdm_npi(string);
}
if (val == FTDM_NPI_INVALID) {
cgPtyNmb->nmbPlanId.val = caller_data->cid_num.plan;
} else {
- cgPtyNmb->nmbPlanId.val = val;
+ cgPtyNmb->nmbPlanId.val = get_trillium_val(npi_codes, val, IN_NP_UNK);
}
cgPtyNmb->typeNmb1.pres = PRSNT_NODEF;
@@ -555,14 +595,14 @@ ftdm_status_t set_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb)
/* Type of Number */
val = FTDM_TON_INVALID;
string = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.cg_pty2.ton");
- if ((string != NULL) && (*string)) {
+ if (!ftdm_strlen_zero(string)) {
val = ftdm_str2ftdm_ton(string);
}
if (val == FTDM_TON_INVALID) {
cgPtyNmb->typeNmb1.val = caller_data->cid_num.type;
} else {
- cgPtyNmb->typeNmb1.val = val;
+ cgPtyNmb->typeNmb1.val = get_trillium_val(ton_codes, val, IN_TON_UNK);
}
return FTDM_SUCCESS;
}
@@ -575,21 +615,14 @@ ftdm_status_t set_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb)
if (!len) {
return FTDM_SUCCESS;
}
- cdPtyNmb->eh.pres = PRSNT_NODEF;
-
- cdPtyNmb->nmbPlanId.pres = PRSNT_NODEF;
- if (caller_data->dnis.plan >= FTDM_NPI_INVALID) {
- cdPtyNmb->nmbPlanId.val = FTDM_NPI_UNKNOWN;
- } else {
- cdPtyNmb->nmbPlanId.val = caller_data->dnis.plan;
- }
- cdPtyNmb->typeNmb0.pres = PRSNT_NODEF;
- if (caller_data->dnis.type >= FTDM_TON_INVALID) {
- cdPtyNmb->typeNmb0.val = FTDM_TON_UNKNOWN;
- } else {
- cdPtyNmb->typeNmb0.val = caller_data->dnis.type;
- }
+ cdPtyNmb->eh.pres = PRSNT_NODEF;
+
+ cdPtyNmb->nmbPlanId.pres = PRSNT_NODEF;
+ cdPtyNmb->nmbPlanId.val = get_trillium_val(npi_codes, caller_data->dnis.plan, IN_NP_UNK);
+
+ cdPtyNmb->typeNmb0.pres = PRSNT_NODEF;
+ cdPtyNmb->typeNmb0.val = get_trillium_val(ton_codes, caller_data->dnis.type, IN_TON_UNK);
cdPtyNmb->nmbDigits.pres = PRSNT_NODEF;
cdPtyNmb->nmbDigits.len = len;
@@ -610,18 +643,10 @@ ftdm_status_t set_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb)
redirNmb->eh.pres = PRSNT_NODEF;
redirNmb->nmbPlanId.pres = PRSNT_NODEF;
- if (caller_data->rdnis.plan >= FTDM_NPI_INVALID) {
- redirNmb->nmbPlanId.val = FTDM_NPI_UNKNOWN;
- } else {
- redirNmb->nmbPlanId.val = caller_data->rdnis.plan;
- }
+ redirNmb->nmbPlanId.val = get_trillium_val(npi_codes, caller_data->rdnis.plan, IN_NP_UNK);
redirNmb->typeNmb.pres = PRSNT_NODEF;
- if (caller_data->rdnis.type >= FTDM_TON_INVALID) {
- redirNmb->typeNmb.val = FTDM_TON_UNKNOWN;
- } else {
- redirNmb->typeNmb.val = caller_data->rdnis.type;
- }
+ redirNmb->typeNmb.val = get_trillium_val(ton_codes, caller_data->rdnis.type, IN_TON_UNK);
redirNmb->nmbDigits.pres = PRSNT_NODEF;
redirNmb->nmbDigits.len = len;
@@ -1103,9 +1128,9 @@ ftdm_bearer_cap_t sngisdn_get_infoTranCap_from_stack(uint8_t bearer_capability)
{
switch(bearer_capability) {
case IN_ITC_SPEECH:
- return FTDM_BEARER_CAP_SPEECH;
+ return FTDM_BEARER_CAP_SPEECH;
case IN_ITC_UNRDIG:
- return FTDM_BEARER_CAP_64K_UNRESTRICTED;
+ return FTDM_BEARER_CAP_64K_UNRESTRICTED;
case IN_ITC_A31KHZ:
return FTDM_BEARER_CAP_3_1KHZ_AUDIO;
default:
diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h
index 6ab518a6e3..3bc2f5b25d 100755
--- a/libs/freetdm/src/include/freetdm.h
+++ b/libs/freetdm/src/include/freetdm.h
@@ -241,12 +241,12 @@ FTDM_STR2ENUM_P(ftdm_str2ftdm_ton, ftdm_ton2str, ftdm_ton_t)
/*! Numbering Plan Identification (NPI) */
typedef enum {
FTDM_NPI_UNKNOWN = 0,
- FTDM_NPI_ISDN = 1,
- FTDM_NPI_DATA = 3,
- FTDM_NPI_TELEX = 4,
- FTDM_NPI_NATIONAL = 8,
- FTDM_NPI_PRIVATE = 9,
- FTDM_NPI_RESERVED = 10,
+ FTDM_NPI_ISDN,
+ FTDM_NPI_DATA,
+ FTDM_NPI_TELEX,
+ FTDM_NPI_NATIONAL,
+ FTDM_NPI_PRIVATE,
+ FTDM_NPI_RESERVED,
FTDM_NPI_INVALID
} ftdm_npi_t;
#define NPI_STRINGS "unknown", "ISDN", "data", "telex", "national", "private", "reserved", "invalid"
diff --git a/scripts/lua/sound_test.lua b/scripts/lua/sound_test.lua
new file mode 100644
index 0000000000..e29c2f9ca7
--- /dev/null
+++ b/scripts/lua/sound_test.lua
@@ -0,0 +1,74 @@
+--
+-- sound_test.lua
+--
+-- accepts two args and then rolls through the sound files
+-- arg 1: type
+-- arg 2: rate
+--
+--[[ Use a dialplan entry like this:
+
+
+
+
+
+
+
+
+Note the syntax of the destination number:
+Rate can be 8000, 16000, 32000, or 48000
+Type can be ivr, conference, voicemail, misc, digits, etc.
+
+Using the extension listed above you could call it with mod_portaudio from fs_cli:
+
+ pa call 16000ivr
+ pa call 8000conference
+ pa call 32000conference
+
+ etc.
+
+]]
+
+-- Create tables that hold our rates and types
+
+tbl_types = {
+ ['ascii'] = 1,
+ ['base256'] = 1,
+ ['conference'] = 1,
+ ['currency'] = 1,
+ ['digits'] = 1,
+ ['directory'] = 1,
+ ['ivr'] = 1,
+ ['misc'] = 1,
+ ['phonetic-ascii'] = 1,
+ ['time'] = 1,
+ ['voicemail'] = 1,
+ ['zrtp'] = 1
+};
+
+tbl_rates = {['8000'] = 1 ,['16000'] = 1, ['32000'] = 1, ['48000'] = 1};
+
+stype = argv[1];
+srate = argv[2];
+
+freeswitch.consoleLog("INFO","Args: Type = " .. argv[1] .. ', Rate = ' .. argv[2] .. "\n");
+
+if ( tbl_types[stype] == nil ) then
+ freeswitch.consoleLog("ERR","Type '" .. stype .. "' is not valid.\n");
+elseif ( tbl_rates[srate] == nil ) then
+ freeswitch.consoleLog("ERR","Rate '" .. srate .. "' is not valid.\n");
+else
+ -- Looks good, let's play some sound files
+ sound_base = session:getVariable('sounds_dir') .. '/en/us/callie/' .. stype .. '/' .. srate;
+ input_file = '/tmp/filez.txt';
+ res = os.execute('ls -1 ' .. sound_base .. ' > ' .. input_file);
+ freeswitch.consoleLog("INFO","Result of system call: " .. res .. "\n");
+ if ( res == 0 ) then
+ for fname in io.lines(input_file) do
+ freeswitch.consoleLog("NOTICE","Playing file: " .. fname .. "\n");
+ session:streamFile(sound_base .. '/' .. fname);
+ session:sleep(100);
+ end
+ else
+ freeswitch.consoleLog("ERR","Result of system call: " .. res .. "\n");
+ end
+end
\ No newline at end of file
diff --git a/src/mod/applications/mod_nibblebill/mod_nibblebill.c b/src/mod/applications/mod_nibblebill/mod_nibblebill.c
index 068a31f5f3..2cd772ece0 100755
--- a/src/mod/applications/mod_nibblebill/mod_nibblebill.c
+++ b/src/mod/applications/mod_nibblebill/mod_nibblebill.c
@@ -902,7 +902,7 @@ switch_state_handler_table_t nibble_state_handler = {
/* on_hibernate */ NULL,
/* on_reset */ NULL,
/* on_park */ NULL,
- /* on_reporting */ process_hangup, /* force billing event on b-leg if we can */
+ /* on_reporting */ NULL,
/* on_destroy */ NULL
};