Working name based "Call Intercept" / "Privacy Manager"

zipeee
Posts: 72
Member Since:
2006-09-07

Hi Trixbox fans,

For those of you looking for a privacy manager setting that asks the caller with unknown/anonymous cid to record their name then ring an extension and says "press 1 to accept, 2 to send to voicemail, 3 to reject (play phone solictiation do not call message), I finally got it working on my TB system. I made a modified version of klingon888's "Call Intercept" / Privacy Manager that seems to work very well in my tb 2.0 implementation (should have no problem working on later versions. I'll put the code inserted and put notes and comments on the the bottom:

[from-external-custom]
exten => s,1,Zapateller(answer|nocallerid)
exten => s,2,Wait(1)
exten => s,3,SetMusicOnHold(default)
exten => s,4,GotoIf($["${CALLERID(num)}" = ""]?custom-screen,s,1)
exten => s,5,GotoIf($["foo${CALLERID(num)}" = "foo"]?custom-screen,s,1)
exten => s,6,GotoIf($["${CALLERID(name):0:9}" = "Anonymous"]?custom-screen,s,1)
exten => s,7,GotoIf($["${CALLERID(name):0:7}" = "Unknown"]?custom-screen,s,1)
exten => s,8,GotoIf($["${CALLERID(num):0:7}" = "Private"]?custom-screen,s,1)
exten => s,9,GotoIf($["${CALLERID(name):0:7}" = "Private"]?custom-screen,s,1)
exten => s,10,GotoIf($["${CALLERID(num):0:10}" = "Restricted"]?custom-screen,s,1)
exten => s,11,GotoIf($["${CALLERID(num):0:4}" = "PSTN"]?custom-screen,s,1)
exten => s,12,Dial(Local/1200@from-internal)
exten => s,13,Hangup

[custom-screen]
exten => s,1,Background(privacy-unident&privacy-screening-unidentified-calls)
exten => s,n,Background(vm-rec-name)
exten => s,n,Set(SCREEN_FILE=/tmp/${CALLERID(num)}-${EPOCH})
exten => s,n,Record(${SCREEN_FILE}.gsm|5|8)
exten => s,n,Wait(1)
;added step to discourage telemarketers etc!
exten => s,n,Playback(to-accept-recording&press-1) ;default is Allison - or you can record your own msg - pls press one to continue call
exten => s,n,Set(TIMEOUT(response)=10)
exten => s,n,WaitExten(10,)
;if no response after 10 secs, hang up
exten => s,n,Playback(sorry-youre-having-problems&goodbye)
exten => 1,1,Playback(privacy-please-stay-on-line-to-be-connected)
exten => 1,2,Dial(local/602@from-internal,20,mM(screen^${SCREEN_FILE})) ;replace with your extension or ringgroup to ring
exten => 1,3,Goto(s,25) ;goto VM if no one answers
exten => s,25,Background(vm-nobodyavail)
exten => s,26,Dial(Local/1201@from-internal) ;replace with your VM ext or misc app. number that routes call to wherever you want to go
exten => s,27,Hangup
exten => s,30,Playback(privacy-if-sales-call-contact-in-writing)
exten => s,31,Playback(goodbye)
exten => s,32,Hangup
exten => h,1,System(/bin/rm ${SCREEN_FILE}.gsm)

;if you have friends who like to block their number, give them a code like 7 to break thru screening at beginning of custom-screen when msg is playing
exten => 7,1,Background(pls-hold-while-try)
exten => 7,n,Goto(ext-group,602,1) ;replace with your ring grp to ring

[macro-screen]
exten => s,1,noop(${ARG1})
exten => s,n,Playback(priv-callpending)
exten => s,n,Playback(${ARG1})
exten => s,n,Wait(1)
;record your own msg - press 1 to connect, 2 to send to VM, 3 to play do not call msg
exten => s,n,Read(ACCEPT|custom/cust-screen-callee-options|1|2|10)
exten => s,n,Gotoif($[${ACCEPT} = 1] ?71) ;connect call
exten => s,n,Gotoif($[${ACCEPT} = 2] ?30) ;reject to vm
exten => s,n,Gotoif($[${ACCEPT} = 3] ?50) ;play pls do not call msg
exten => s,30,Set(MACRO_RESULT=GOTO:custom-screen^s^25)
exten => s,31,Goto(70)
exten => s,50,Set(MACRO_RESULT=GOTO:custom-screen^s^30)
exten => s,51,Goto(70)
exten => s,70,Playback(goodbye)
exten => s,71,System(/bin/rm ${ARG1}.gsm)
exten => h,1,System(/bin/rm ${ARG1}.gsm)

1. Privacy Manager built in to FreePBX needs to be turned OFF--It overrides this script.

2. This script should be put in the extention_custom.conf (at the bottom)

3. A custom extension needs to be created where all inbound calls pass through to be filtered and determined whether they qualify as anonymous.

a. In the example above, after passing through extension 95 filter, then if the call is anonymous, the call continues through the anonymous script. If it is NOT private or unknown, it bounces to misc. app 1200 extension which points it to my regular welcome IVR.

b. Extension 95 (or whatever you want to use) is a custom extension. In the properties, it must be set under the "This device uses custom technology" "dial" field to "Local/s@from-external-custom". This forwards all calls going into extension 95 into the privacy manager script logic.

3. on the "exten => s,26,Dial(Local/1201@from-internal) ;replace with your VM ext" I replaced my voicemail box with another misc. application that sends it off to an IVR that lets the caller choose which voicemail box to drop calls sent to voicemail If you want to set it directly to a voicemailbox instead of a misc. app like I did, it should instead look something like:exten => s,26,Goto(ext-local,${VM_PREFIX}200,1) ;replace with your VM ext (in this case it forwards to voicemailbox 200)

4. exten => 1,2,Dial(local/602@from-internal,20,mM(screen^${SCREEN_FILE})) ;replace your extension to ring
AND exten => 7,n,Goto(ext-group,602,1) ;replace with your ring grp to ring is the line

-- where you put your ring group to call and prompt you to accept/reject/send to vm. (Mine is 602 in this case).

5. On the line exten => s,n,Read(ACCEPT|custom/cust-screen-callee-options|1|2|10) , I made a custom recording: "cust-screen-callee-options" (without quotes) that plays back to the person answering the phone that says "Press 1 to accept, 2 to send to voicemail, 3 to accept the calls"

6. You can obviously replace the Allison prompts--use with whatever you want. If you want multiple prompts on the same line, put a "&" between each one.

7. If you want to get rid of the SID tones, remove the zapateller line at the beginning, and update accordingly although a lot of telemarketer systems look for this to remove the number from their list.

Cheers,
Zipeee