[asterisk-users] Matching *, + and # in the dialplan

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Fri Oct 17 11:41:46 CDT 2008


On Friday 17 October 2008 10:15:22 Olivier wrote:
> 2008/10/17 John Todd <jtodd at digium.com>
>
> > At 5:46 PM +0200 2008/10/16, Olivier wrote:
> > >Is Incomplete() application an acceptable work around for ISN ?
> >
> > It is impossible to determine the full sequence of digits for an ISN
> > number ahead of time (well, I shouldn't say "impossible" because one
> > could create a really nasty hack...) because the number of digits
> > isn't known until the user indicates they are done dialing.  To
> > determine if the subscriber and/or the ITAD are valid, one must
> > perform a lookup and possibly a connection attempt to the remote
> > system for determination.
> >
> > Both the subscriber number (the stuff to the left of the "*") and the
> > ITAD number (the stuff to the right of the "*") are not bounded by a
> > particular pattern.  Therefore, it is not reasonable to create
> > regexps other than "does this string contain at least one but maybe
> > more digits, followed by the "*" sign, followed by at least one but
> > maybe more digits".
> >
> > So, 1234*256 is a valid ISN sequence, as is 12345*2567.  (Though only
> > the first one of the two is actually active at the moment.)
> >
> > See http://www.freenum.org/ for more details on what makes up an ISN.
> > It's free to participate, and Asterisk incorporates ISN-style dialing
> > as a default in the ENUMLOOKUP routines.  Accepting inbound calls is
> > easy as well - it's just SIP inbound calling, no magic there.
> >
> > JT
>
> Writing this :
>
> exten => _XXX*,1,Incomplete()
> exten => _XXXX*,1,Incomplete()
> exten => _XXXXX*,1,Incomplete()
>
> would work to catch 3 to 5 digits private extensions, but it would remains
> difficult to catch the ITAD number, right ?

There's no need to do anything like that.  You're not seeing the
possibilities:

exten => _X.,1,Set(main=${CUT(EXTEN,*,1)})
exten => _X.,n,Set(itad=${CUT(EXTEN,*,2)})
exten => _X.,n,GotoIf($[${itad}"=""]?incomplete) ; or some other test
exten => _X.,n,Dial(...)
exten => _X.,n+1000(incomplete),Incomplete()

-- 
Tilghman



More information about the asterisk-users mailing list