[asterisk-users] [1.4] Reading phone number the French way?

Dave Cotton dcotton at linuxautrement.com
Thu Mar 10 06:18:41 CST 2011


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



More information about the asterisk-users mailing list