Dropping incoming calls without a Callerid


Would it be possible to block incomming calls on a ZAP channel with no caller id and perhaps divert them to a message explaining we can only accept the call with a valid callerid?



From the wiki change to suit your needs


; This example checks for blank caller ID or 800 numbers.
; Callers from 800 numbers (usually telemarketers) or those
; with no caller ID are asked to press 1 to speak with me.
exten => s,1,NoOp(${CALLERID}) ; log callerID string
; check for callerID. If none, make them hit 1.
exten => s,2,GotoIf($["${CALLERIDNUM}" = “”]?s|1000)
; If 800 number, make them hit 1.
exten => s,3,GotoIf($["${CALLERIDNUM:0:3}" = “877”]?s|1000)
exten => s,4,GotoIf($["${CALLERIDNUM:0:3}" = “800”]?s|1000)
; OK, we have valid caller ID and it’s not an 800 number.
; Let’s ring our phones now:
exten => s,5,Dial(SIP/604&SIP/602,25,tr)
exten => s,1000,Background(press1tospeaktome)

Yes. Gotoif() can be used and ${CALLERIDNUM} compared with ""
or ${LEN(${CALLERIDNUM})} > 3 number must be longer than 3 digit

Thanks :smiley:

why not just use PrivacyManager()? I had to make some customizations because a number of telemarketers have UNAVAILABLE or OUT OF AREA instead of blank. here is what i did:

; Special tweaks we do for incoming calls.  AAH doesn't allow invocation
; of privacy manager for PSTN calls, or invocation of zapateller, so we
; "roll our own" here.  Also, for inbound PSTN calls, wait 3 seconds in
; case it's a fax call (to allow nv_detect_background) to redirect the
; call to fax context if so.  Also, asterisk providers seem to send odd
; strings like 'asterisk' or 'UNKNOWN' when CID is blocked - check for
; that and null out both strings if so.  Telemarketers often seem to
; use UNAVAILABLE or OUT OF AREA, but sadly, there is sometimes trailing
; spaces, so trim those off.  Any legitimate caller will get a chance to
; provide his real CID via Privacy Manager

exten => s,1,Answer
exten => s,n,Wait(3)
exten => s,n(blacklisted),LookupBlacklist(j)
exten => s,n,Set(foo=${CALLERID(name)})
exten => s,n,Set(foo=${CUT(foo, ,1)})
exten => s,n,GotoIf($["${foo}" = "UNKNOWN"]?fixup_cid)
exten => s,n,GotoIf($["${foo}" = "PRIVATE"]?fixup_cid)
exten => s,n,GotoIf($["${foo}" = "OUT OF AREA"]?fixup_cid)
exten => s,n,GotoIf($["${foo}" != "UNAVAILABLE"]?check_cid)
exten => s,n(fixup_cid),SetCallerID(,)
exten => s,n(check_cid),Zapateller(nocallerid)
exten => s,n(privacyfailure),PrivacyManager
exten => s,n,LookupCIDName
exten => s,n,Goto(timeconditions,3,1)
exten => s,privacyfailure+101,Congestion
exten => s,blacklisted+101,SetCallerID(,)
exten => s,n,Zapateller(nocallerid)
exten => s,n,Congestion

unfortunately, i can’t just check for UNAVAILABLE and such, because asterisk presents the string with trailing spaces, so i trim those off. if it’s any of the suspect names, i nuke the caller id and then invoke privacy manager, so they will be prompted to enter their number. note: real telemarketers will never get this far, since zapateller() will play the disconnect tone and their autodialer will hang up.

you could also try the PrivacyManager() application. If there is no caller id it will play a message and require them to manually dial in their caller id.

that is in fact what i do. my point was: many telemarketers do provide a canned CID like UNAVAILABLE, and privacy manager will not block those.