Merge branch 'master' of ssh://git.freeswitch.org:222/freeswitch

This commit is contained in:
David Yat Sin 2011-05-10 11:05:41 -04:00
commit 086be03bee
6 changed files with 186 additions and 79 deletions

View File

@ -5,6 +5,23 @@
<prompt phrase="Pound" filename="35.wav"/>
<prompt phrase="Star" filename="42.wav"/>
<prompt phrase="Dot" filename="46.wav"/>
<prompt phrase="Hyphen" filename="45.wav"/>
<prompt phrase="Exclamation point" filename="33.wav"/>
<prompt phrase="At" filename="64.wav"/>
<prompt phrase="Dollar sign" filename="36.wav"/>
<prompt phrase="Percent" filename="37.wav"/>
<prompt phrase="Ampersand" filename="38.wav"/>
<prompt phrase="Double quote" filename="34.wav"/>
<prompt phrase="Single quote" filename="39.wav"/>
<prompt phrase="Forward slash" filename="47.wav"/>
<prompt phrase="Underscore" filename="95.wav"/>
<prompt phrase="Backslash" filename="92.wav"/>
<prompt phrase="Tilde" filename="126.wav"/>
<prompt phrase="Equal sign" filename="61.wav"/>
<prompt phrase="Colon" filename="58.wav"/>
<prompt phrase="Semicolon" filename="59.wav"/>
<prompt phrase="Caret" filename="94.wav"/>
<prompt phrase="Pipe" filename="124.wav"/>
<prompt phrase="A" filename="97.wav"/>
<prompt phrase="B" filename="98.wav"/>
<prompt phrase="C" filename="99.wav"/>
@ -222,6 +239,8 @@
<prompt phrase="I need to record your first and last name. This recording is used throughout the system, including in the company directory." filename="vm-tutorial_record_name.wav"/>
<prompt phrase="Your personal identification number, or 'pin', is used to prevent others from accessing your voicemail messages. Would you like to change it now?" filename="vm-tutorial_change_pin.wav"/>
<prompt phrase="The person you are trying to reach is not available and does not have voicemail." filename="vm-not_available_no_voicemail.wav"/>
<prompt phrase="The PIN you entered is below the minimum length." filename="voicemail/vm-pin_below_minimum_length.wav"/>
<prompt phrase="The minimum PIN length is..." filename="voicemail/vm-minimum_pin_length_is.wav"/>
</voicemail>
<directory>
<prompt phrase="Please enter the first few letters of the persons" filename="dir-enter_person.wav"/>
@ -270,7 +289,13 @@
<prompt phrase="You are now bi-directionally muted." filename="conf-you_are_now_bidirectionally_muted.wav"/>
<prompt phrase="Enter the number of listeners at this location, then press pound." filename="conf-number_of_listeners.wav"/>
<prompt phrase="...listeners in this conference." filename="conf-listeners_in_conference.wav"/>
<prompt phrase="...members in this conference." filename="conf-members_in_conference.wav"/> </conference>
<prompt phrase="...listener in this conference." filename="conf-listener_in_conference.wav"/>
<prompt phrase="...members in this conference." filename="conf-members_in_conference.wav"/>
<prompt phrase="This conference is in Q and A mode." filename="conference/conf-conference_is_in_qna_mode.wav"/>
<prompt phrase="Q and A mode..." filename="conference/conf-qna_mode.wav"/>
<prompt phrase="Entry sound..." filename="conference/conf-entry_sound.wav"/>
<prompt phrase="Exit sound..." filename="conference/conf-exit_sound.wav"/>
</conference>
<ivr>
<prompt phrase="Account number" filename="ivr-account_number.wav"/>
<prompt phrase="Connect to caller" filename="ivr-connect_to_caller.wav"/>
@ -432,8 +457,6 @@
<prompt phrase="There are..." filename="ivr-there_are.wav"/>
<prompt phrase="Please enter the source telephone number, then press pound." filename="ivr-enter_source_telephone_number.wav"/>
<prompt phrase="Please enter the destination telephone number, then press pound." filename="ivr-enter_destination_telephone_number.wav"/>
<!-- The following phrases still need to be recorded -->
<prompt phrase="Recording started." filename="ivr-recording_started.wav"/>
<prompt phrase="Recording stopped." filename="ivr-recording_stopped.wav"/>
<prompt phrase="Recording paused." filename="ivr-recording_paused.wav"/>
@ -445,37 +468,14 @@
<prompt phrase="...has been answered." filename="ivr-has_been_answered.wav"/>
<prompt phrase="...has been removed." filename="ivr-has_been_removed.wav"/>
<prompt phrase="No questions in queue." filename="ivr-no_questions_in_queue.wav"/>
<prompt phrase="This conference is in Q and A mode." filename="conference/conf-conference_is_in_qna_mode.wav"/>
<prompt phrase="Q and A mode..." filename="conference/conf-qna_mode.wav"/>
<prompt phrase="...is now on." filename="ivr/ivr_is_now_on.wav"/>
<prompt phrase="...is now off." filename="ivr/ivr_is_now_off.wav"/>
<prompt phrase="Entry sound..." filename="conference/conf-entry_sound.wav"/>
<prompt phrase="Exit sound..." filename="conference/conf-exit_sound.wav"/>
<prompt phrase="The PIN you entered is below the minimum length." filename="voicemail/vm-pin_below_minimum_length.wav"/>
<prompt phrase="The minimum PIN length is..." filename="voicemail/vm-minimum_pin_length_is.wav"/>
<prompt phrase="This phone is not allowed to make external calls." filename="ivr-phone_not_make_external_calls.wav"/>
<prompt phrase="I.D. number..." filename="ivr-id_number.wav"/>
<prompt phrase="To skip these instructions..." filename="ivr-skip_instructions.wav"/>
<prompt phrase="Hang up the call without pressing a key to discard the recording." filename="ivr-hangup_to_discard.wav"/>
<prompt phrase="...or press..." filename="ivr-or_press.wav"/>
<prompt phrase="For English, press..." filename="ivr-for_english_press.wav"/>
<prompt phrase="Hyphen" filename="ascii/45.wav"/>
<prompt phrase="Exclamation point" filename="ascii/33.wav"/>
<prompt phrase="At" filename="ascii/64.wav"/>
<prompt phrase="Dollar sign" filename="ascii/36.wav"/>
<prompt phrase="Percent" filename="ascii/37.wav"/>
<prompt phrase="Ampersand" filename="ascii/38.wav"/>
<prompt phrase="Double quote" filename="ascii/34.wav"/>
<prompt phrase="Single quote" filename="ascii/39.wav"/>
<prompt phrase="Forward slash" filename="ascii/47.wav"/>
<prompt phrase="Underscore" filename="ascii/95.wav"/>
<prompt phrase="Backslash" filename="ascii/92.wav"/>
<prompt phrase="Tilde" filename="ascii/126.wav"/>
<prompt phrase="Equal sign" filename="ascii/61.wav"/>
<prompt phrase="Colon" filename="ascii/58.wav"/>
<prompt phrase="Semicolon" filename="ascii/59.wav"/>
<prompt phrase="Caret" filename="ascii/94.wav"/>
<prompt phrase="Pipe" filename="ascii/124.wav"/>
<prompt phrase="Your call cannot be completed as dialed." filename="ivr-call_cannot_be_completed_as_dialed.wav"/>
<prompt phrase="Please check the number and try again." filename="ivr-please_check_number_try_again.wav"/>
<prompt phrase="Failure reason is..." filename="ivr-failure_reason_is.wav"/>
@ -489,6 +489,8 @@
<prompt phrase="Normal unspecified" filename="ivr-normal_unspecified.wav"/>
<prompt phrase="Incompatible destination" filename="ivr-incompatible_destination.wav"/>
<prompt phrase="Normal clearing" filename="ivr-normal_clearing.wav"/>
<!-- The following phrases still need to be recorded -->
</ivr>
<misc>

View File

@ -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)

View File

@ -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:

View File

@ -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"

View File

@ -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:
<extension name="sound file tester">
<condition field="destination_number" expression="^((8|16|32|48)000)(.*)$">
<action application="lua" data="sound_test.lua $3 $1"/>
<action application="hangup"/>
</condition>
</extension>
Note the syntax of the destination number: <rate><type>
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

View File

@ -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
};