Home » Cellular Services » Taming the Condo Call Box with a Raspberry Pi & Asterisk

The Most Versatile VoIP Provider: FREE PORTING

Taming the Condo Call Box with a Raspberry Pi & Asterisk

If you live in an apartment complex or condominium with a call box to let visitors gain door access by calling your apartment, then today’s column is for you. The way almost all of these call boxes work is the management company programs your name, phone number, and apartment number into the call box after which a visitor can look up your name or enter your apartment number and the call box will call you. When you answer the call and press 9 on your phone, the apartment door will unlock momentarily allowing the visitor to enter the building. But what if you don’t answer the call and a delivery driver needs to drop off your check from Publisher’s Clearinghouse? Or suppose you or a significant other has gone jogging without a cellphone and locked yourself out of the building? Well, worry no more. With Asterisk and a $35 Raspberry Pi running Incredible PBX, you can conquer the call box and let anybody into the building without ever touching your phone. All you need is an access code.

We will assume that you have a functioning Incredible PBX server with at least one incoming phone number. If not, start here. Then provide the management company with your 10-digit DID to assign to the call box. Once it’s set up, use the call box to call yourself and review the call detail records on your PBX to decipher the callbox’s actual phone number.

You do NOT need a dedicated DID to answer Call Box incoming calls. Deploying the script below will tell Asterisk to intercept calls from the Call Box for special processing and pass the rest of your incoming calls to your DID’s preconfigured Inbound Route. When a Call Box call is detected by its CallerID Number, the script will prompt the visitor to enter a security code. If the code entered is valid, a DTMF tone simulating the pressing of 9 on your phone will be sent to the Call Box to open the door, and the visitor will be advised that the door is being unlocked. If the visitor enters an invalid access code three times in a row, Asterisk will hang up the call from the Call Box. Easy peasy!

Now let’s reconfigure your Asterisk PBX to manage incoming calls from the Call Box. You’ll need (1) the 10-digit DID that you provided to the management company for calls from the CallBox. (2) the 10-digit phone number that the Call Box uses to call you, and (3) a security PIN which the visitor must enter to gain door access. In the sample code below, (1) substitute your 10-digit DID for 8881234567 on the 14 lines (twice on lines 3 and 5), (2) substitute the Call Box 10-digit phone number for 9990000000 on line 4, (3) in line 7 replace 90210 with the security PIN you want visitors to enter to gain door access, and (4) enter your email address on line 11 replacing yourname@gmail.com so you’re notified when visitors arrive.

exten => 8881234567,1,Answer
exten => 8881234567,n,Wait(1)
exten => 8881234567,n,NoOp(*** Incoming call on 8881234567 DID ***)
exten => 8881234567,n,GotoIf($["${CALLERID(number)}" = "9990000000"]?BUZZMEUP)
exten => 8881234567,n,Goto(from-trunk,8881234567,1)
exten => 8881234567,n,Hangup
exten => 8881234567,n(BUZZMEUP),Authenticate(90210)
exten => 8881234567,n,Playback(access-granted)
exten => 8881234567,n,agi(picotts.agi,"The door is opening. Please come in.")
exten => 8881234567,n,SendDTMF(9,50,2000)
exten => 8881234567,n,system(echo "Condo door opened" | /usr/bin/mail -s ALERT yourname@gmail.com)
exten => 8881234567,n,Wait(3)
exten => 8881234567,n,Playback(goodbye)
exten => 8881234567,n,Hangup
exten => s,1,Hangup

Next, copy the edited code to the end of /etc/asterisk/extensions_custom.conf and reload your dialplan: asterisk -rx "dialplan reload".

Finally, using a browser, open the FreePBX GUI. Edit the trunk corresponding to your DID above and change the context to from-callbox. Also make certain you have an Inbound Route for your 10-digit DID to redirect non-CallBox calls to whatever destination is desired.

Now leave your building (with your key) and use the Call Box to test your new setup. Enjoy!

Originally published: Monday, April 5, 2021

Need help with Asterisk? Visit the VoIP-info Forum.


Special Thanks to Our Generous Sponsors

FULL DISCLOSURE: ClearlyIP, Skyetel, Vitelity, DigitalOcean, Vultr, VoIP.ms, 3CX, Sangoma, TelecomsXchange and VitalPBX have provided financial support to Nerd Vittles and our open source projects through advertising, referral revenue, and/or merchandise. As an Amazon Associate and Best Buy Affiliate, we also earn from qualifying purchases. We’ve chosen these providers not the other way around. Our decisions are based upon their corporate reputation and the quality of their offerings and pricing. Our recommendations regarding technology are reached without regard to financial compensation except in situations in which comparable products at comparable pricing are available from multiple sources. In this limited case, we support our sponsors because our sponsors support us.

BOGO Bonaza: Enjoy state-of-the-art VoIP service with a $10 credit and half-price SIP service on up to $500 of Skyetel trunking with free number porting when you fund your Skyetel account. No limits on number of simultaneous calls. Quadruple data center redundancy. $25 monthly minimum spend required. Tutorial and sign up details are here.

The lynchpin of Incredible PBX 2020 and beyond is ClearlyIP components which bring management of FreePBX modules and SIP phone integration to a level never before available with any other Asterisk distribution. And now you can configure and reconfigure your new Incredible PBX phones from the convenience of the Incredible PBX GUI.

VitalPBX is perhaps the fastest-growing PBX offering based upon Asterisk with an installed presence in more than 100 countries worldwide. VitalPBX has generously provided a customized White Label version of Incredible PBX tailored for use with all Incredible PBX and VitalPBX custom applications. Follow this link for a free test drive!

Special Thanks to Vitelity. Vitelity is now Voyant Communications and has halted new registrations for the time being. Our special thanks to Vitelity for their unwavering financial support over many years and to the many Nerd Vittles readers who continue to enjoy the benefits of their service offerings. We will keep everyone posted on further developments.