Hi all, I'm looking for some rudimentary insight on GotoIf() which seems to be failing on me in my dial plan. All I basically wish to do is block a particular caller. Sounds easy enough, but my ternary operator/plan currently is not properly being implemented. Can anyone spot where I'm being a momo? All extensions get forwarded to the following macro: [macro-forward] ; arg1 = phone number ; arg2 = timeout ; arg3 = extension (voicemail) ; arg4 = mobile number exten => s,1,Zapateller(answer|nocallerid) exten => s,2,PrivacyManager exten => s,3,Wait(1) exten => s,4,GotoIf($[${CALLERID(number)} = "15552221313"]?15:5) exten => s,5,GotoIf($[${LEN(${CALLERID(number)})} = 4]?6:8) exten => s,6,AGI(didextlookup.agi|${CALLERID(number)}) exten => s,7,Set(CALLERID(number)=${didlookup}) exten => s,8,GotoIf($[${LEN(${CALLERID(number)})} = 10]?9:10) exten => s,9,Set(CALLERID(number)=1${CALLERID(number)}) exten => s,10,Dial(${ARG1},${ARG2}) exten => s,11,GotoIf($[${EXISTS(${ARG4})}]?11:12) exten => s,12,Dial(${ARG4},${ARG2}) exten => s,13,Voicemail(u${ARG3}) exten => s,14,Playback(vm-goodbye) exten => s,15,HangUp exten => s,105,HangUp As you can tell, exten => s,4,GotoIf($[${CALLERID(number)} "15552221313"]?15:5) is what I recently added. Here's what I see in the CLI logs: -- Executing [5609@fromlime:1] Macro("IAX2/lime-3", "forward|SIP/5609|15|5609|IAX2/limemed@lime/15164766201") in new stack -- Executing [s@macro-forward:1] Zapateller("IAX2/lime-3", "answer|nocallerid") in new stack -- Executing [s@macro-forward:2] PrivacyManager("IAX2/lime-3", "") in new stack -- CallerID Present: Skipping -- Executing [s@macro-forward:3] Wait("IAX2/lime-3", "1") in new stack -- Executing [s@macro-forward:4] GotoIf("IAX2/lime-3", "0?15:5") in new stack -- Goto (macro-forward,s,5) It evaluates to false, hence goes to s,5. I keep dialing from that particular number (the one in the example is clearly masked as a false CID), and verified it's showing up as that number on callerID. Also one last question. Say I need to add more numbers to block in the future, is there an easier way to do this than renumbering my entire macro? Renumbering everything is just begging for a typo which can effectively render my dial plan broken. Thank you kindly, everyone! - sf
It fails because the right function is ${CALLERID(num)} On 5/30/07, Steve Finkelstein <sf@stevefink.net> wrote:> Hi all, > > I'm looking for some rudimentary insight on GotoIf() which seems to be > failing on me in my dial plan. All I basically wish to do is block a > particular caller. Sounds easy enough, but my ternary operator/plan > currently is not properly being implemented. Can anyone spot where I'm > being a momo? > > All extensions get forwarded to the following macro: > > [macro-forward] > ; arg1 = phone number > ; arg2 = timeout > ; arg3 = extension (voicemail) > ; arg4 = mobile number > exten => s,1,Zapateller(answer|nocallerid) > exten => s,2,PrivacyManager > exten => s,3,Wait(1) > exten => s,4,GotoIf($[${CALLERID(number)} = "15552221313"]?15:5) > exten => s,5,GotoIf($[${LEN(${CALLERID(number)})} = 4]?6:8) > exten => s,6,AGI(didextlookup.agi|${CALLERID(number)}) > exten => s,7,Set(CALLERID(number)=${didlookup}) > exten => s,8,GotoIf($[${LEN(${CALLERID(number)})} = 10]?9:10) > exten => s,9,Set(CALLERID(number)=1${CALLERID(number)}) > exten => s,10,Dial(${ARG1},${ARG2}) > exten => s,11,GotoIf($[${EXISTS(${ARG4})}]?11:12) > exten => s,12,Dial(${ARG4},${ARG2}) > exten => s,13,Voicemail(u${ARG3}) > exten => s,14,Playback(vm-goodbye) > exten => s,15,HangUp > exten => s,105,HangUp > > As you can tell, exten => s,4,GotoIf($[${CALLERID(number)} > "15552221313"]?15:5) is what I recently added. > > Here's what I see in the CLI logs: > > -- Executing [5609@fromlime:1] Macro("IAX2/lime-3", > "forward|SIP/5609|15|5609|IAX2/limemed@lime/15164766201") in new stack > -- Executing [s@macro-forward:1] Zapateller("IAX2/lime-3", > "answer|nocallerid") in new stack > -- Executing [s@macro-forward:2] PrivacyManager("IAX2/lime-3", "") > in new stack > -- CallerID Present: Skipping > -- Executing [s@macro-forward:3] Wait("IAX2/lime-3", "1") in new stack > -- Executing [s@macro-forward:4] GotoIf("IAX2/lime-3", "0?15:5") in > new stack > -- Goto (macro-forward,s,5) > > It evaluates to false, hence goes to s,5. I keep dialing from that > particular number (the one in the example is clearly masked as a false > CID), and verified it's showing up as that number on callerID. > > Also one last question. Say I need to add more numbers to block in the > future, is there an easier way to do this than renumbering my entire > macro? Renumbering everything is just begging for a typo which can > effectively render my dial plan broken. > > Thank you kindly, everyone! > > - sf > _______________________________________________ > --Bandwidth and Colocation provided by Easynews.com -- > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >
On 5/30/07, Steve Finkelstein <sf@stevefink.net> wrote:> I'm looking for some rudimentary insight on GotoIf() which seems to be > failing on me in my dial plan.<snip>> exten => s,4,GotoIf($[${CALLERID(number)} = "15552221313"]?15:5)It's the quotes that are messing it up... what you probably want is: exten => s,4,GotoIf($["${CALLERID(number)}" = "15552221313"]?15:5) Also, the CallerID number probably doesn't have the 1 on the front (depending on whether or not your upstream provider sends the 1).> Also one last question. Say I need to add more numbers to block in the > future, is there an easier way to do this than renumbering my entire > macro? Renumbering everything is just begging for a typo which can > effectively render my dial plan broken.Yes, you can use the 'n' priority, and use labels to mark the priorities you want to jump to from your GotoIf()s. -Jared
You could also use the cid syntax in the extension exten => s/ObnoxiousCallerId,1,Goto(getlost) On 5/30/07, Steve Finkelstein <sf@stevefink.net> wrote:> Hi all, > > I'm looking for some rudimentary insight on GotoIf() which seems to be > failing on me in my dial plan. All I basically wish to do is block a > particular caller. Sounds easy enough, but my ternary operator/plan > currently is not properly being implemented. Can anyone spot where I'm > being a momo? > > All extensions get forwarded to the following macro: > > [macro-forward] > ; arg1 = phone number > ; arg2 = timeout > ; arg3 = extension (voicemail) > ; arg4 = mobile number > exten => s,1,Zapateller(answer|nocallerid) > exten => s,2,PrivacyManager > exten => s,3,Wait(1) > exten => s,4,GotoIf($[${CALLERID(number)} = "15552221313"]?15:5) > exten => s,5,GotoIf($[${LEN(${CALLERID(number)})} = 4]?6:8) > exten => s,6,AGI(didextlookup.agi|${CALLERID(number)}) > exten => s,7,Set(CALLERID(number)=${didlookup}) > exten => s,8,GotoIf($[${LEN(${CALLERID(number)})} = 10]?9:10) > exten => s,9,Set(CALLERID(number)=1${CALLERID(number)}) > exten => s,10,Dial(${ARG1},${ARG2}) > exten => s,11,GotoIf($[${EXISTS(${ARG4})}]?11:12) > exten => s,12,Dial(${ARG4},${ARG2}) > exten => s,13,Voicemail(u${ARG3}) > exten => s,14,Playback(vm-goodbye) > exten => s,15,HangUp > exten => s,105,HangUp > > As you can tell, exten => s,4,GotoIf($[${CALLERID(number)} > "15552221313"]?15:5) is what I recently added. > > Here's what I see in the CLI logs: > > -- Executing [5609@fromlime:1] Macro("IAX2/lime-3", > "forward|SIP/5609|15|5609|IAX2/limemed@lime/15164766201") in new stack > -- Executing [s@macro-forward:1] Zapateller("IAX2/lime-3", > "answer|nocallerid") in new stack > -- Executing [s@macro-forward:2] PrivacyManager("IAX2/lime-3", "") > in new stack > -- CallerID Present: Skipping > -- Executing [s@macro-forward:3] Wait("IAX2/lime-3", "1") in new stack > -- Executing [s@macro-forward:4] GotoIf("IAX2/lime-3", "0?15:5") in > new stack > -- Goto (macro-forward,s,5) > > It evaluates to false, hence goes to s,5. I keep dialing from that > particular number (the one in the example is clearly masked as a false > CID), and verified it's showing up as that number on callerID. > > Also one last question. Say I need to add more numbers to block in the > future, is there an easier way to do this than renumbering my entire > macro? Renumbering everything is just begging for a typo which can > effectively render my dial plan broken. > > Thank you kindly, everyone! > > - sf > _______________________________________________ > --Bandwidth and Colocation provided by Easynews.com -- > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >