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) The wisdom of this group is much appreciated. This is an example only. I know the code will display both NoOp lines if the name and number is the same. Regards David Klaverstyn -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20120905/77b5e1f7/attachment.htm>
David Klaverstyn wrote:> > exten => s,1,GotoIf($["${CALLERID(name)}" = "${CALLERID(num)}"]?:3) >exten => s,1,NoOP(${CALLERID(name)}) exten => s,n,NoOP(${CALLERID(num)}) Will probably give you some clues. Doug -- Ben Franklin quote: "Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety."
By definition you are doing if not equal go to 3. Gotoif($[condition]?[true]:false). Look at your CLI output and you will see the evaluation of the condition as 1 or 0. From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of David Klaverstyn Sent: Wednesday, September 05, 2012 4:31 AM To: Asterisk Users Mailing List - Non-Commercial Discussion (asterisk-users at lists.digium.com) Subject: [asterisk-users] Help with GotoIf Command 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) The wisdom of this group is much appreciated. This is an example only. I know the code will display both NoOp lines if the name and number is the same. Regards David Klaverstyn -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20120905/27be04c5/attachment.htm>
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>
Hi All, Thanks for all your suggestions. It turns out that the CID Name was sent with a space at the end of the number and that is why there was never a match. Regards David. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20120910/1b2ec3cd/attachment.htm>
Hi, This is exactly why it is very important and wise to attach CLI verbose logs and other traces so the real issue gets resolved quicker than making all the people figure out the possibilities. BR Sammy On Mon, Sep 10, 2012 at 7:52 AM, David Klaverstyn <david at klaverstyn.com.au>wrote:> Hi All,**** > > ** ** > > Thanks for all your suggestions. It turns out that the CID Name was sent > with a space at the end of the number and that is why there was never a > match.**** > > ** ** > > Regards**** > > David.**** > > ** ** > > -- > _____________________________________________________________________ > -- 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 >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20120910/daad358c/attachment.htm>