[asterisk-users] Dial plan inquiry using GotoIf()

Steve Murphy murf at parsetree.com
Wed Jun 6 09:20:47 CDT 2007


On Wed, 2007-05-30 at 20:05 -0400, Steve Finkelstein wrote:
> Thanks for the help on this thread all.
> 
> It would make sense if I write an AGI and incorporate a DB backend to
> check against numbers I want explicitly dropped. If anyone has such a
> utility, I'd love to -not- reinvent the wheel. Otherwise, I'll go whip
> it up and probably provide a web frontend for adding/removing numbers.
> 

You can still use the dialplan with the DB func to check incoming 
CID info. Also, the Dial() app has several options for call screening
and 
privacy; these would be performed when dialing your extension.

You can have Dial keep a DB of callers, and remember whether to always
just patch them right thru, play them a polite "go away and don't come
back",
or send them off to torture scripts, or just route them straight to VM.
And, Dial() will ask you what you want to do, on the first call. Read
thru the Dial doc you get with "core show application dial". There's
an option to store an intro from each caller, where it records in  a
sound file, who they say they are. I have several hundreds of these, and
play them as the
call comes in, so we know who's calling without having to run to a CID
display.
For those who have poor to no vision, this can be a cool feature.

murf


> - sf
> 
> C F wrote:
> > It fails because the right function is ${CALLERID(num)}
> > 
> > On 5/30/07, Steve Finkelstein <sf at 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 at fromlime:1] Macro("IAX2/lime-3",
> >> "forward|SIP/5609|15|5609|IAX2/limemed at lime/15164766201") in new stack
> >>     -- Executing [s at macro-forward:1] Zapateller("IAX2/lime-3",
> >> "answer|nocallerid") in new stack
> >>     -- Executing [s at macro-forward:2] PrivacyManager("IAX2/lime-3", "")
> >> in new stack
> >>     -- CallerID Present: Skipping
> >>     -- Executing [s at macro-forward:3] Wait("IAX2/lime-3", "1") in new
> >> stack
> >>     -- Executing [s at 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
> >>
> > _______________________________________________
> > --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
> > 
> > !DSPAM:1020,465db390179485209328925!
> > 
> _______________________________________________
> --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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3239 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20070606/84a35175/smime.bin


More information about the asterisk-users mailing list