jeremywillden
Guru
- Joined
- Feb 22, 2008
- Messages
- 152
- Reaction score
- 0
To go along with Ward's re-write of the Stealth Autoattendant, I re-wrote the anonymous call rejection contexts he had previously written and updated them for PiaF. I also made some effort to simplify integration with your dialplan so there is minimal scripting and most of the hooks are inside of FreePBX. (Most of the rewrite had to do with deprecated commands in the newest Asterisk code base .) Here goes:
Add this to the bottom of your /etc/asterisk/extensions_custom.conf, and change the extension number on Line 12 (bolded below) to match the extension of your main ring group (or main extension):
[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)}" = ""]?who-r-u,s,1)
exten => s,5,GotoIf($["foo${CALLERID(num)}" = "foo"]?who-r-u,s,1)
exten => s,6,GotoIf($["${CALLERID(name):0:9}" = "Anonymous"]?who-r-u,s,1)
exten => s,7,GotoIf($["${CALLERID(name):0:7}" = "Unknown"]?who-r-u,s,1)
exten => s,8,GotoIf($["${CALLERID(num):0:7}" = "Private"]?who-r-u,s,1)
exten => s,9,GotoIf($["${CALLERID(name):0:7}" = "Private"]?who-r-u,s,1)
exten => s,10,GotoIf($["${CALLERID(num):0:10}" = "Restricted"]?who-r-u,s,1)
exten => s,11,GotoIf($["${CALLERID(num):0:4}" = "PSTN"]?who-r-u,s,1)
exten => s,12,Dial(Local/99@from-internal)
exten => s,13,Hangup
Don't forget to change the extension in line 12 above to the number of your main ring group (or main extension!).
Next, add below this, still in /etc/asterisk/extensions_custom.conf (change your mailbox in line 7 to the main voicemail extension in your system):
[who-r-u]
exten => s,1,Background(privacy-unident)
exten => s,2,Background(vm-rec-name)
exten => s,3,Wait(2)
exten => s,4,Record(/tmp/asterisk-stranger:gsm|5|15)
exten => s,5,Background(pls-hold-while-try)
exten => s,6,Goto(ext-park,70,1)
exten => s,7,VoiceMail(105@default)
exten => s,8,Playback(goodbye)
exten => s,9,Hangup
[ext-park]
exten => 70,1,Answer
exten => 70,2,SetMusicOnHold(default)
exten => 70,3,Set(CALLERID(num)=100)
exten => 70,4,Set(CALLERID(name)=Parked Call Info)
exten => 70,5,ParkAndAnnounce(silence/4:asterisk-friend:/tmp/asterisk-stranger:vm-isonphone:at-following-numberARKED|40|local/99@from-internal|who-r-u,s,7)
exten => 70,6,Hangup
In case you missed it above, don't forget to change line 7 above to reflect your main voicemail extension number (mine is 105) and the extension in 70,5.
Save your changes and re-read configs.
Now, to make this easy to integrate into your system, go to FreePBX and add a new CUSTOM extension (any extension number you want, I used 95, and I use the extension name PrivacyManager) and under Device Options, set the dial string to:
Local/s@from-external-custom
This directs any call to this extension to the script we put in the extensions_custom.conf file. Any call to this extension without a valid callerid gets sent through Ward's interrogation procedure, making the caller record their voice and then parking their call so you can decide to answer (or not).
Save the extension (click submit). Now go to your inbound routes, and for any trunk that you want to screen, set the inbound route destination to the new PrivacyManager extension.
I bet Ward's already working on re-writing this, and may be ready to post it on nerdvittles any day now, but I just couldn't wait.
Enjoy!
Jeremy
Add this to the bottom of your /etc/asterisk/extensions_custom.conf, and change the extension number on Line 12 (bolded below) to match the extension of your main ring group (or main extension):
[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)}" = ""]?who-r-u,s,1)
exten => s,5,GotoIf($["foo${CALLERID(num)}" = "foo"]?who-r-u,s,1)
exten => s,6,GotoIf($["${CALLERID(name):0:9}" = "Anonymous"]?who-r-u,s,1)
exten => s,7,GotoIf($["${CALLERID(name):0:7}" = "Unknown"]?who-r-u,s,1)
exten => s,8,GotoIf($["${CALLERID(num):0:7}" = "Private"]?who-r-u,s,1)
exten => s,9,GotoIf($["${CALLERID(name):0:7}" = "Private"]?who-r-u,s,1)
exten => s,10,GotoIf($["${CALLERID(num):0:10}" = "Restricted"]?who-r-u,s,1)
exten => s,11,GotoIf($["${CALLERID(num):0:4}" = "PSTN"]?who-r-u,s,1)
exten => s,12,Dial(Local/99@from-internal)
exten => s,13,Hangup
Don't forget to change the extension in line 12 above to the number of your main ring group (or main extension!).
Next, add below this, still in /etc/asterisk/extensions_custom.conf (change your mailbox in line 7 to the main voicemail extension in your system):
[who-r-u]
exten => s,1,Background(privacy-unident)
exten => s,2,Background(vm-rec-name)
exten => s,3,Wait(2)
exten => s,4,Record(/tmp/asterisk-stranger:gsm|5|15)
exten => s,5,Background(pls-hold-while-try)
exten => s,6,Goto(ext-park,70,1)
exten => s,7,VoiceMail(105@default)
exten => s,8,Playback(goodbye)
exten => s,9,Hangup
[ext-park]
exten => 70,1,Answer
exten => 70,2,SetMusicOnHold(default)
exten => 70,3,Set(CALLERID(num)=100)
exten => 70,4,Set(CALLERID(name)=Parked Call Info)
exten => 70,5,ParkAndAnnounce(silence/4:asterisk-friend:/tmp/asterisk-stranger:vm-isonphone:at-following-numberARKED|40|local/99@from-internal|who-r-u,s,7)
exten => 70,6,Hangup
In case you missed it above, don't forget to change line 7 above to reflect your main voicemail extension number (mine is 105) and the extension in 70,5.
Save your changes and re-read configs.
Now, to make this easy to integrate into your system, go to FreePBX and add a new CUSTOM extension (any extension number you want, I used 95, and I use the extension name PrivacyManager) and under Device Options, set the dial string to:
Local/s@from-external-custom
This directs any call to this extension to the script we put in the extensions_custom.conf file. Any call to this extension without a valid callerid gets sent through Ward's interrogation procedure, making the caller record their voice and then parking their call so you can decide to answer (or not).
Save the extension (click submit). Now go to your inbound routes, and for any trunk that you want to screen, set the inbound route destination to the new PrivacyManager extension.
I bet Ward's already working on re-writing this, and may be ready to post it on nerdvittles any day now, but I just couldn't wait.
Enjoy!
Jeremy