Hello, I need to write a script which prompts the callee to type a number, and then read it back to them as confirmation: ======= extensions.conf [robocall] ;Expect 10-digit number excluding final #, 2 tries, 20s time-out exten => s,n(nbr2call),Read(NBR2CALL,please-type-number,10,,2,20) exten => s,n,GotoIf($[${LEN(${NBR2CALL})} != 10]?end) ;exten => s,n,SayDigits(${NBR2CALL}) exten => s,n,SayNumber(${NBR2CALL}) exten => s,n(end),Hangup() ======= Besides the fact that my Asterisk setup only has US sound files in /var/lib/asterisk/sounds/digits/, I was wondering how to get Asterisk to read back the number the French way, ie. digits are read by pairs to the exception of the leading tuple that always starts with 0. For instance, a landline number in Paris like 01 42 92 81 00 is read "zero-one, forty-two, ninety-two, eighty-one, zero-zero", where I assume Americans would read all the digits individually ("zero, one, four, two, etc.") Has someone already looked into this and knows how to solve it? Thank you.
Faisal Hanif
2011-Mar-08 12:31 UTC
[asterisk-users] [1.4] Reading phone number the French way?
When you compile asterisk you can select multiple language files by using "make menuselect" additionally you find lot of free sources on internet for language files. Simply create a folder with language short-code in sounds and then set channel's language variable to that short-code. -----Original Message----- From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Gilles Sent: Tuesday, March 08, 2011 5:22 PM To: asterisk-users at lists.digium.com Subject: [asterisk-users] [1.4] Reading phone number the French way? Hello, I need to write a script which prompts the callee to type a number, and then read it back to them as confirmation: ======= extensions.conf [robocall] ;Expect 10-digit number excluding final #, 2 tries, 20s time-out exten => s,n(nbr2call),Read(NBR2CALL,please-type-number,10,,2,20) exten => s,n,GotoIf($[${LEN(${NBR2CALL})} != 10]?end) ;exten => s,n,SayDigits(${NBR2CALL}) exten => s,n,SayNumber(${NBR2CALL}) exten => s,n(end),Hangup() ======= Besides the fact that my Asterisk setup only has US sound files in /var/lib/asterisk/sounds/digits/, I was wondering how to get Asterisk to read back the number the French way, ie. digits are read by pairs to the exception of the leading tuple that always starts with 0. For instance, a landline number in Paris like 01 42 92 81 00 is read "zero-one, forty-two, ninety-two, eighty-one, zero-zero", where I assume Americans would read all the digits individually ("zero, one, four, two, etc.") Has someone already looked into this and knows how to solve it? Thank you. -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Richard Kenner
2011-Mar-08 12:47 UTC
[asterisk-users] [1.4] Reading phone number the French way?
> exten => s,n(nbr2call),Read(NBR2CALL,please-type-number,10,,2,20) > > For instance, a landline number in Paris like 01 42 92 81 00 is read > "zero-one, forty-two, ninety-two, eighty-one, zero-zero", where I > assume Americans would read all the digits individually ("zero, one, > four, two, etc.")Maybe something like: exten => s,n,SayDigits(${NBR2CALL:0:1}) exten => s,n,SayNumber(${NBR2CALL:2:2}) exten => s,n,SayNumber(${NBR2CALL:4:2}) exten => s,n,SayNumber(${NBR2CALL:6:2}) exten => s,n,SayNumber(${NBR2CALL:8:2}) Or make changes in say.conf.
On Tue, 08 Mar 2011 13:22:18 +0100, Gilles <codecomplete at free.fr> wrote:>I need to write a script which prompts the callee to type a number, >and then read it back to them as confirmation:Apparently, the right way to read a phone number back to the user is not to use SayNumber() (which might be OK for US-style reading) but rather Playback(<prefix>:<number>,say), which will then rely on say.conf For instance: ======= extensions.conf exten => 2222,1,Set(NBR2CALL=0142928100) ;exten => 2222,n,SayNumber(${NBR2CALL}) exten => 2222,n,Playback(phone:${NBR2CALL},say) ======= Using this almost works: ======= say.conf _pho[n]e:0[1-9]XXXXXXXX => num:${SAY:0:1}, num:${SAY:1:1}, num:${SAY:2:2}, num:${SAY:4:2}, num:${SAY:6:2}, num:${SAY:8:2} ======= The remaining problem is when a couple starts with a zero, eg. 01 (should be read "zero one"): In this case, Asterisk ignores the leading zero and simply pronounces the second digit ("one") Does someone know of a trick so that the pattern handles couples that have a leading zero? Thank you.
Dave Cotton
2011-Mar-10 12:18 UTC
[asterisk-users] [1.4] Reading phone number the French way?
On 10/03/11 12:55, Gilles wrote:> On Tue, 08 Mar 2011 13:22:18 +0100, Gilles<codecomplete at free.fr> > wrote: >> I need to write a script which prompts the callee to type a number, >> and then read it back to them as confirmation: > > Apparently, the right way to read a phone number back to the user is > not to use SayNumber() (which might be OK for US-style reading) but > rather Playback(<prefix>:<number>,say), which will then rely on > say.conf > > For instance: > ======= extensions.conf > exten => 2222,1,Set(NBR2CALL=0142928100) ;exten => > 2222,n,SayNumber(${NBR2CALL}) exten => > 2222,n,Playback(phone:${NBR2CALL},say) > ======> > Using this almost works: > ======= say.conf > _pho[n]e:0[1-9]XXXXXXXX => num:${SAY:0:1}, num:${SAY:1:1}, > num:${SAY:2:2}, num:${SAY:4:2}, num:${SAY:6:2}, num:${SAY:8:2} > ======> > The remaining problem is when a couple starts with a zero, eg. 01 > (should be read "zero one"): In this case, Asterisk ignores the > leading zero and simply pronounces the second digit ("one") > > Does someone know of a trick so that the pattern handles couples that > have a leading zero? >Look at the GotoIf statement for example exten => _9X.,1,GotoIf($["${EXTEN:1:2}" = "00"]?ft) exten => _9X.,n,GotoIf($["${EXTEN:1:2}" = "08"]?ft) exten => _9X.,n,GotoIf($["${EXTEN:1:2}" = "06"]?ft) exten => _9X.,n,GotoIf($["${EXTEN:1:1}" = "3"]?ft) exten => _9X.,n,GotoIf($["${EXTEN:1:1}" = "1"]?ft) exten => _9X.,n,GotoIf($["${TMP:0:2}" != "OK"]?ft) exten => _9X.,n, ... exten => _9X.,n(ft), ... DC
On Thu, 10 Mar 2011 13:18:41 +0100, Dave Cotton <dcotton at linuxautrement.com> wrote:>Look at the GotoIf statement for exampleThanks Dave for the tip, but I found that I needed to change a pattern that was already in say.conf: ======[fr](date-base,digit-base) ;BAD _[n]um:0. => num:${SAY:1} _[n]um:0X => num:${SAY:0:1}, num:${SAY:1:1} ... ;regular phone numbers : landlines and cellphones ;_pho[n]e:0[1-9]XXXXXXXX => num:${SAY:0:1}, num:${SAY:1:1}, num:${SAY:2:2}, num:${SAY:4:2}, num:${SAY:6:2}, num:${SAY:8:2} ====== If I got it right, the way say.conf works, is that it reads the whole say.conf to make a list of the different patterns. Then, when reading a prefix+number, it reads the patterns on the right side and tries to find if it furthers matches another pattern. In the example above, "_[n]um:0X" will match "num:${SAY:6:2}", which will read the two digits as expected, ie. without ignoring a leading zero. Thank you.