[asterisk-users] Basic GotoIf question

Markus universe at truemetal.org
Sat Aug 25 02:08:25 CDT 2012


Hi all,

on Asterisk 1.4.21 I'm trying to block, that means directly hang up on, 
several inbound caller ID's like this:

exten => 5555,1,GotoIf($["${CALLERID(num)}" != "6666"]?pass)
exten => 5555,n,GotoIf($["${CALLERID(num)}" != "7777"]?pass)
exten => 5555,n,GotoIf($["${CALLERID(num)}" != "8888"]?pass)
exten => 5555,n,Hangup
exten => 5555,n(pass),Set... everything from here on works.

When I'm calling with caller ID 6666 I get hung up. When I'm calling 
from 7777 or 8888 I get connected.

That means on the first GotoIf match the remaining GotoIf's are ignored. 
How can I avoid that?

I'm a bit surprised, because "Example 3" at 
http://www.voip-info.org/wiki/view/Asterisk+cmd+GotoIf shows that it 
should actually be working.

A few more questions - the doc link that I just mentioned shows:

" GotoIf(condition?label1[[:label2]) "

What is the [[ before :label2? There are two opening square brackets, 
but just one ] closing? Is that a typo?

Also, the doc shows:

" GotoIf(condition?[label1]:label2) "

Why is label1 in square brackets and label2 isn't?

I'm confused. :)

Thanks so much!
Markus




More information about the asterisk-users mailing list