[asterisk-users] Pattern Extension not working in Dialplan

Steve Edwards asterisk.org at sedwards.com
Sun Sep 7 18:18:29 CDT 2014


Please don't top-post.

> On Sun, Sep 7, 2014 at 1:41 PM, Anurag Rana <anuragrana31189 at gmail.com> wrote:

> I created a dummy dialplan  where I ask the user to enter the age. 
> 
> [macro-age]
> exten => s,1,Background(my/age)      ;;Play recorded message to enter age
> exten => s,n,WaitExten(10)                 
> exten => _XX,1,Set(AGE=${EXTEN})    ;; this line is not executing, instead dialplan is terminating with error given below.
> exten => s,n,NoOp(${AGE})
> exten => s,n,GotoIf($[${LEN(${AGE})} > 0]?notEmpty)
> exten => s,n,Goto(s,1)
> exten => s(notEmpty),n,Background(my/thank-you)
> exten => s,n,Wait(1)

On Sun, 7 Sep 2014, John Kiniston wrote:

> The first issue I see is you are attempting to insert your pattern match 
> in the middle of your 's' extension, That's going to break your 's' 
> extension. The second issue is that you are matching on XX which will 
> match two digits, You need to match on _X instead if you are attempting 
> to match on the number 8.
> 
> I recommend you look into 'read' instead of trying to do a pattern 
> match.

A pattern match is a reasonable method. I use pattern matching more often 
that the read() application. Try both and see which meets your needs 
better.

Are you really defining a 'macro' or is that just the (misleading) name 
you chose for your context. Personally, I use gosub() more, but again, 
try both :)

I suggest you try 'dialplan show macro-age' to see how Asterisk is 
interpreting your dialplan. I suspect it is not what you expect.

In specific, your ordering of '_xx' in the middle of 's' is odd. This 
would disrupt the value of the priority in older versions of Asterisk, but 
it appears that it does work in modern (I'm using 11) versions.

Also, a label ('notEmpty') belongs to a priority, not an extension.

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000


More information about the asterisk-users mailing list