[asterisk-users] modifying a dialed exension before dialplan processing
Tilghman Lesher
tilghman at mail.jeffandtilghman.com
Sat Nov 17 09:57:28 CST 2007
On Saturday 17 November 2007 09:31:35 Brian J. Murrell wrote:
> On Fri, 2007-11-16 at 22:58 -0600, Eric "ManxPower" Wieling wrote:
> > exten => _0111NXXNXXXXXX,1,Goto(${EXTEN:4},1)
> >
> > exten => _NXXNXXXXXX,1,Dial(....
>
> Of course! Couldn't be any simpler. Almost!
>
> User dials 6135551212, phone sends 01116135551212, above rules processes
> as:
>
> Goto(6135551212,1)
>
> Fair enough.
>
> User dials 16045551212, phone sends 01116045551212, above rules process
> as:
>
> Goto(6045551212,1)
>
> Bzzzt. "You must dial a 1 before long distance calls".
>
> It's not as easy as just using "613" as a qualifier for LD or not, as
> some 613 is local, and some is not. Certainly, a list of rules such as:
>
> exten => _0111613abcXXXX,1,Goto(${EXTEN:4},1)
>
> Where there is one of those for every "abc" that is a local exchange
> followed by:
>
> exten => _0111NXXNXXXXXX,1,Goto(${EXTEN:3},1)
>
> would work, but that seems even more nasty than my original problem.
>
> Indeed, it seems I need to be able to do some sort of lookup into a
> database to see if "abc" is a local exchange or not (let's assume that I
> can populate a database with local exchanges).
func_odbc.conf
[ISLOCAL]
dsn=foo
read=SELECT COUNT(*) FROM localexchanges WHERE prefix='${ARG1:0:6}'
extensions.conf
exten => _011-1-NXX-NXX-XXXX,1,GotoIf(${ODBC_ISLOCAL(${EXTEN:4})}?
${EXTEN:4},1:${EXTEN:3},1)
--
Tilghman
More information about the asterisk-users
mailing list