Here at Liquidstate HQ, we seem to get more than our fair share of silent and nuisance calls. We've already signed up for the Telephone Preference Service, but that's only applicable for calls originating from within the UK. So, after a bout of insomnia, I decided to take matters into my own hands.
Update: I've fixed a cut and paste error with the OBI110 configuration after feedback from Steve in the comments. If you've been struggling to get this working, then hopefully this helps!
Enter the OBi110, a Voice Server Bridge and Telephone Adapter that can effectively join your existing analogue Plain Old Telephone Service (POTS) with a modern Voice-Over-IP (VOIP) solution. From there, with the help of FreePBX/Asterisk, you can gain complete control of both incoming and outgoing calls.
This post will document my initial configuration to use the OBi110 with FreePBX running on a Raspberry Pi to filter incoming calls based on Caller ID (as well as the time of day). The OBi110 and FreePBX are both capable of soooo much more, but we'll leave that for a future post!
NOTE! This is my initial configuration - it's not perfect yet and will no doubt change over time as I learn more about the OBi110 and FreePBX.
Call Workflow
When someone calls us and we are able to determine their number via Caller ID, we direct the call through to the analogue telephone attached to the OBi110. If we cannot determine a number, the caller is asked to enter their phone number. Assuming they do, this will then be forwarded through to the analogue phone (with the caller ID set to the number the caller has provided).
Additionally, if someone calls us out of hours (23:00 - 07:30), then we ask them if they wish to continue the call then to press 1. If they do so, then the above call flow based on Caller ID will apply.
Requirements
You’ll need an OBi110, a Raspberry Pi with case, power supply and a 4GB SD Card. You'll also need two Ethernet cables and a 4-core telephone cable to connect both devices to your home network (router) and the OBi110 to your phone line. I sourced my components from Amazon and eBay.
Configure your Raspberry Pi
Download RasPBX from here and install it into your SD Card. Detailed instructions for writing can be found here. Copying the image to the memory card could take up to half an hour.
Now, fit the SD Card to the Pi and connect it to your network with an Ethernet cable and power it up. After a couple of minutes, “ssh in-to” the Pi (ssh [email protected]
). The root password is raspberry
. At this point, if you have familiarity with Ubuntu or Debian Linux distributions, you should feel pretty comfortable. Next, configure a static IP address for your Pi; you will do the same for the OBi110 later so they can talk to each other, and you can talk to them. In this blog post, my Raspberry Pi is configured on 192.168.1.98
and my OBi110 is on 192.168.1.253
.
Update to the latest version of Asterisk (and apply OS upgrades) by running:
raspbx-upgrade
This could take an hour or so (don’t forget to type “y” when you are asked to continue).
Reboot your Pi to verify it’s IP and connectivity.
Set the correct time on the Raspberry Pi
SSH back into your Raspberry Pi and run the following command to configure the correct timezone for your area and confirm the time and date is correct.
[email protected]:~# dpkg-reconfigure tzdata
Current default time zone: 'Europe/London'
Local time is now: Sat Nov 8 21:38:28 GMT 2014.
Universal Time is now: Sat Nov 8 21:38:28 UTC 2014.
Connect the OBi110
Plug in your OBi110 to power and your network/router using an ethernet cable. Plug your standard analogue phone into the PHONE
port on the OBi110 and your POTS line into the LINE
port on the OBi1110. You should be able to make and receive calls as-if the OBi110 wasn’t present. If this is not true, then do-not proceed. Check the OBi110 FAQ or the Administration Guide.
Update the OBi110 firmware
To check and apply the latest firmware, dial `***6` on the phone handset connected to the `PHONE` port and follow the voice prompts. The OBi110 will connect to the Internet, check for the latest firmware and give you the option (1) to install it. It should only take a minute or two.Configure the OBi110
Like the Pi, the OBi110 obtains its IP address via DHCP by default. To find out its current IP address, pick up the phone and dial ***1
. You will hear a pre-recorded message that reads out the current IP address. Enter the address into your browser: http://xxx.xxx.xxx.xxx
, where the X’s are the OBi110′s IP address. The default username is "admin" and the password is also “admin”.
NOTE: As changes are made on each page to the OBi110, they must be saved by pressing the “submit” button on the bottom of each page BEFORE navigating to another page. Once all the pages have been configured, press the “Reboot” button in the upper right corner to activate the changes.
Static IP Address
Change the following settings to configure a static IP address for your OBi110 device. Below are the settings that I used, but you should set these appropriately for your home network. I use Google's public DNS servers for name resolution (8.8.8.8
and 8.8.4.4
).
System Management:
Network Settings:
Internet Settings:
<strong>Addressing Type: Static
IPAddress: 192.168.1.253
SubnetMask: 255.255.255.0
DefaultGateway: 192.168.1.254
DNSServer1: 8.8.8.8
DNSServer2: 8.8.4.4
Time Configuration
By default, the OBi110 is configured to automatically update its time from the Internet, but I had to change the timezone to suit my locale.
System Management:
Network Settings:
Time Service Settings:
LocalTimeZone: GMT +00:00 (London,Lisbon)
Configure the OBi110 as an FXO Port
We want configure the OBi110 so that any incoming calls are routed to the RasPBX software running on our Raspberry Pi (connected via Voice Service SP2).
Physical Interfaces
Line Port
Line Port
InboundCallRoute: SP2
RingDelay: 3500 (delay in ms the Obi 110 will allow the phone to ring before giving up on waiting for Caller ID)
DialDigitOnTime: 100 (speed up your dialling by reducing the time in ms each digit tone is played for during dialling)
DialDigitOffTime: 100 (speed up your dialling by reducing the delay in ms between each digit when dialling)
Physical Interfaces
Line Port
PSTN Disconnection Detection
SilienceTimeThreshold: 600 (increase the number of seconds of silence permitted before disconnecting a call)
Now lets configure Voice Service SP2:
Voice Services
SP2 Service
SP2 Service
X-ServProvProfile: B
X_InboundCallRoute: LI
X_KeepAliveEnable: checked
SIP Credentials:
AuthUserName: OBITRUNK1
AuthPassword: TRUNKPW (change this!)
URI: [email protected] (replace with the IP address of your Raspberry Pi)
Now configure the ITSP Profile that SP2 uses (Profile B):
Service Providers
ITSP Profile B
SIP
SIP
Proxy Server: 192.168.1.98 (change to the IP of your Raspberry Pi)</pre>
X_SpoofCallerID: checked</pre>
X_AccessList: 192.168.1.98 (change to the IP of your Raspberry Pi)
Configure the OBi110 to allow RasPBX to "call out" to the telephone
Service Providers
ITSP Profile A
SIP
SIP
Proxy Server: 192.168.1.98 (change to the IP of your Raspberry Pi)
X_UseRefer: checked
X_AccessList: 192.168.1.98 (change to the IP of your Raspberry Pi)
Voice Services
SP1 Service
SP1 Service
X_InboundCallRoute: PH
SIP Credentials:
AuthUserName: 01310000000 (your home phone number)
AuthPassword: EXTENSIONPW (change this!)
URI: [email protected] (replace the first part with your home phone number)
Calling Features
MaxSessions: 5
MWIEnable: checked
X_VMWIEnable: checked
MessageWaiting: unchecked
Reboot
Now, go back through each of the pages and ensure that your remembered to submit your changes on each page!
Once you're happy, press the reboot
button in the upper right corner to activate the changes.
Configure FreePBX on your Raspberry Pi
Enter the address into your browser: “http://xxx.xxx.xxx.xxx”, where the X’s are the Raspberry Pi′s IP address and select FreePBX Administration on the resulting web page. The default username is admin
with password admin
.
Configure Trunk
Connectivity:
Trunks:
Add SIP Trunk
General Settings:
Trunk Name: OBITRUNK1
Outbound CallerID: 01310000000 (replace with your home phone number
CID Options: Allow Any CID
Outgoing Settings:
Trunk Name: OBITRUNK1
PEER Details:
username=OBITRUNK1
secret=TRUNKPW (must match what you entered on OBi110 SP2 SIP Credentials)
host=dynamic
type=friend
context=from-trunk
qualify=yes
dtmfmode=rfc2833
canreinvite=no
disallow=all
allow=ulaw
Configure Outbound Route
Connectivity:
Outbound Routes
Add Route
General Settings:
Route Name: Outbound
Route CID: <blank>;
Route Password: <blank>;
Route Type: <unchecked>
Trunk Sequence For Matched Routes:
0: OBITRUNK1
Add an extension
Applications:
Extensions:
Add Extension
Device: Generic SIP Device
User Extension: 01310000000 (change to your home phone number - must match OBi110 SP1 URL)
Display Name: Analogue Phone
CID Num Alias: <blank>
SIP Alias: <blank>
Device Options
secret: EXTENSIONPW (this must match OBi110 SP1 SIP Credentials)
Configure Night Time IVR
This auto attendant shall play a recorded message if someone calls after hours and asks them to press '1' to continue. In Asterisk you need to install Time Conditions
module. In the FreePBX Administration control panel, select Admin -> Module Admin. Click the Check Online
button, then click on the Time Conditions
module and select Install
. Next, click the Process
button at the top right to do the actual install. (This also might be a good time to update any out-of-date modules you might have).
Now, lets configure the actual IVR in FreePBX:
Applications:
IVR:
IVR General Settings:
IVR Name</strong>: prompt
IVR Description</strong>: <blank>
IVR Options (DTMF):
Announcement: PressOneToCallThisNumber
Direct Dial: Extensions
Timeout: 10
Invalid Retries: 0
Invalid Recording: None
Invalid Destination: Terminate Call - Hangup
Timeout Retries: 0
Timeout Retry Recording: Default
Append Announcement on Retry: unchecked
Timeout Recording: None
Timeout Destination: Terminate Call - Play SIT Tone (Zapateller)
Return to IVR after VM: unchecked
IVR Entries:
Ext: 1
Destination: Extensions - <01310000000>
Return: unchecked
Admin
System Recordings:
Built-In Recordings:
Select System Recording: en/vm-tocallnum
Name this recording: PressOneToCallThisNumber
Files:
en/vm-tocallnum
Applications:
Announcements
Add Announcement
General Settings:
Description: nightwarning
Recording: PressOneToCallThisNumber
Repeat: disable
Allow Skip: no
Return to IVR: yes
Don't Answer Channel: yes
Destination after playback:
IVR: prompt
Applications:
Time Groups
Add Time Group
<>Description: daytime
<>Time to start: 07:30
<>Time to finish: 22:00
<>Week day start: Monday
<>Week day finish: Sunday
<>Month day start: 1
<>Month day finish: 31
<>Month start: January
<>Month finish: December
Applications:
Time Conditions
Add Time Condition
Time condition name: daytime
Time group: daytime
Destination if time matches:
Extensions: <0131000000>
Destination if time does not match:
Announcements: <nightwarning>
Configure Inbound Route
Connectivity:
Inbound Routes
Add Route
General Settings:
Description: Inbound
DID Number: <blank>
CallerID Number: <blank>
Route CID: <blank>
Privacy:
Privacy Manager: Yes
Max attempts: 1
Min Length: 7
Set Destination:
Time Conditions: daytime