[asterisk-users] Help with GotoIf Command

Warren Selby wcselby at selbytech.com
Wed Sep 5 09:57:34 CDT 2012


On Wed, Sep 5, 2012 at 4:30 AM, David Klaverstyn <david at klaverstyn.com.au>wrote:

> Hi All,****
>
> ** **
>
> For some reason I can’t get this GotoIf statement to work.  Even if the
> name and number are the same it jumps to line 3.  I’ve tried with and
> without the quotes around each variable.****
>
> ** **
>
> exten => s,1,GotoIf($["${CALLERID(name)}" = "${CALLERID(num)}"]?:3)****
>
> exten => s,2,NoOp(they are the Same)****
>
> exten => s,3,NoOp(they are different)****
>
> ** **
>
>
>
You need to verify if the {CALLERID(num)} can actually match what your
{CALLERID(name)} looks like.  More than likely, the (num) has some sort of
brackets around it, such as < >, or perhaps it's starting with a +.  You
can try to use the FILTER function on it, to strip away any additional
characters that you don't want to see or try to match on.

exten => s,1,GotoIf($["${CALLERID(name)}" =
"${FILTER(0123456789,${CALLERID(num)}}"]?:3)


That is, if you're just looking for numeric callerid.  If you also want to
account for extra characters, you can add those to the first part of the
filter.


-- 
Thanks,
--Warren Selby, dCAP
http://www.SelbyTech.com <http://www.selbytech.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20120905/132b42b8/attachment.htm>


More information about the asterisk-users mailing list