[asterisk-users] GotoIf($["${CALLERID(number)}

Joseph syscon780 at gmail.com
Fri Jun 14 17:32:12 CDT 2013



On 06/14/13 18:43, Noah Engelberth wrote:
>> -----Original Message-----
>> From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-
>> bounces at lists.digium.com] On Behalf Of Joseph
>> Sent: Friday, June 14, 2013 2:25 PM
>> To: asterisk-users at lists.digium.com
>> 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

Thanks Noah, you are correct; I knew I'm missing some logic here.

The correct way of doing it was to have only one line pointing to internal existing extension:
exten => 220,n,GotoIf($["${CALLERID(number)}" = "7804792668"]?internal,222,1)

and if the condition is not true, the dial plan will keep continue on.

-- 
Joseph



More information about the asterisk-users mailing list