> -----Original Message-----
> From: [email protected] [mailto:asterisk-users-
> [email protected]] On Behalf Of Joseph
> Sent: Friday, June 14, 2013 2:25 PM
> To: [email protected]
> Subject: [asterisk-users] GotoIf($["${CALLERID(number)}
> 
> I'm trying to to to "dial1" if caller id match:
> but dial plan execute  220,n(dial1) regardless
> 
> exten => 220,n,GotoIf($["${CALLERID(number)}" = "7804792668"]?dial1)
> exten =>
> 220,n(dial1),Dial(${sales_support}&${accounting}&${family},25,m(penguin)w
> )
> exten => 220,n,
> 
> I was under impression that if condition is met it will jump to  "n(label)" no
> comma in between
> but dial plan is executing it regardless.
> 
> --
> Joseph
> 
> --

You're correct in that GotoIf($[CONDITION]?label) will jump to the indicated 
label if the condition is true.

However, without being told to go somewhere else when the condition is false, 
Asterisk will keep going at the next priority of the current extension.

So, since your dialplan is something like:

exten => 220,3,GotoIf(...)
exten => 220,4(dial1),Dial(...)
exten => 220,5,...

When Asterisk sees the Goto as true, it jumps to the label dial1, which happens 
to be priority 4 (or whatever it actually is).  When Asterisk sees the Goto as 
false, it's not being told to do anything, so it moves on from priority 3, to 
the next available priority -- which happens to be 4.

If you want Asterisk to terminate the call when the condition of your Goto 
isn't matched, then you could change your dialplan to something like...

exten => 220,n,GotoIf($["${CALLERID(number)}" = "7804792668"]?dial1:hangup,1)
exten => 
220,n(dial1),Dial(${sales_support}&${accounting}&${family},25,m(penguin)w
)
exten => 220,n,...

exten => hangup,1,Hangup()

Or, you could of course jump anywhere else and do anything else with the call 
you want to.


Thank you,

Noah Engelberth
MetaLINK Technologies

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to