[Asterisk-Users] Local vs. toll Dial Plan

Tzafrir Cohen tzafrir.cohen at xorcom.com
Mon Jun 5 22:33:53 MST 2006


On Mon, Jun 05, 2006 at 04:52:52PM -0700, Ira wrote:
> At 03:51 PM 6/5/2006, you wrote:
> >My talk of efficiency is not in code timing it is in readablity and
> >ability to make changes easily. If I could put all the exchanges in a
> >table or database and refer to them as valid in a particular instance
> >saying in one line or a macro in * if the exten I am dialing matches any
> >of these then do this.
> 
> Something like this might be useful.  And any hints about better ways 
> to accomplish this are very welcome.  The one thing I don't know off 
> hand is how many characters a variable can contain so you might need 
> a couple of instances of this to hold them all.
> 
> exten => s,n,set(EXCHANGES=310323805714)
> exten => s,n(begin),set(TEST=${EXCHANGES:0:3)
> exten => s,n,set(EXCHANGES=${EXCHANGES:3)
> exten => s,n,gotoif($["${TEST}" = ""]?passed)
> exten => s,n,gotoif($[${TEST} = ${EXTEN?3}:gotone]
> exten => s,n,gotoif($[${TEST} = ${EXTEN?1:3}:gotone]
> exten => s,n,goto(begin)

Why would you re-implement the dialplan logic in dialplan?

exten => 310323805714,1,NoOp
exten => 310324445714,1,NoOp
exten => 310323804444,1,NoOp
exten => 310323444714,1,NoOp

exten => _X.,2,; the rest of the dialplan

The block of NoOps for each "good" extension (or pattern of extensions)
is what you maintain in a separate file and #include or in a database.

-- 
Tzafrir Cohen      sip:tzafrir at local.xorcom.com
icq#16849755       iax:tzafrir at local.xorcom.com
+972-50-7952406           
tzafrir.cohen at xorcom.com  http://www.xorcom.com



More information about the asterisk-users mailing list