SetAccount Example.

Comment on Asterisk cmd SetAccount
Joined: Mon 04 of Apr, 2005

SetAccount Example.

Posted:Mon 04 of Apr, 2005 (17:29 UTC)
Here is an example of how to ask for a billing or AccountCode after someone has dialed a number.

I use this for a Bank that needs to back charge for LongDistance calls. The Code is not authenticated, but can be easily. If there is no code, then the default 999 is entered.


exten => s,1,DigitTimeout(6)
exten => s,2,ResponseTimeout(10)
exten => s,3,Wait(4)
exten => s,4,Read(accountcode,billing-3digit,3)
exten => s,5,GotoIf($["${accountcode}" = ""]?macro-account_calls,s,10)  ;Jump to set account at 999 if nothing entered
exten => s,6,SetAccount(${accountcode})
exten => s,7,Goto(s,12) ;if accountcode is not empty jump to end.
exten => s,10,SetAccount(999)
exten => s,12,NoOp(AccountCode=${accountcode} DialOut=${ARG1})
exten => s,13,Wait(2)
exten => s,13,Playback(pls-wait-connect-call)
exten => s,14,Macro(dialout,${ARG1})