Tag Archives: spa3102

Configuring the OBiHai OBi110 to replace a linksys spa-3102 as a google voice and pstn gateway using asterisk 1.4

If you were looking for how to configure the SPA-3102 with Asterisk 1.4 click here.

All the rage in the VOIP world is the Obihai obi110 voice gateway device, and while due largely to its native integration of google voice, I believe it’s because it does quite a bit for a very reasonable cost (Under $50 from here!). And while just good news for asterisk 1.8 users, this is great news for asterisk 1.4 and 1.6 users! The Obi110 is essentially a user friendly linksys spa-3102 with a slightly watered down interface, with the addition of native google voice support (and setup wizards!). It is somewhat less capable in functionality (no router feature, or independent trunking capabilities with asterisk, etc.) but for my purposes, I decided to give it a try to see if I could replace my spa-3102 and found out that it could quite easily.

The obi110

I have a simple asterisk 1.4 based setup with several extensions located around the world. The main goal is for my family to connect to my system using their iphones, computers, voip devices and make calls to the US and also to receive calls with local DID numbers to their extensions. My previous setup with the linksys spa-3102 allowed them to use my ooma device to call out as an outgoing trunk, however I wanted to see if I could add two trunks to my setup and give my users the flexibility of outgoing call redundancy if they so desired (choose to call out through GV or my Ooma).

Below is my guide for setting this up.

Pre-requisites:
-Network connectivity to the obi110 and ability to administer its local web admin page and setup through obitalk.com.
-Physically connected pstn service (ooma, telco) to the obi110 local Line port (Note: if line port is disconnected, the obi110 will report the lines as busy even if just calling out through GV when the SP2 local dialplan shown below is specified).
-Newest version of firmware on the obi110 (as of 03/21/11 version 1.1.0 (Build: 1892))

Configuration:
I found that it is much simpler to initially set up the obi110 through the obitalk.com portal and then to disable auto-provisioning and make customized changes to the web admin afterwards.

Google Voice Trunk setup – obitalk.com portal
1. Goto obi110 device portal after you have successfully registered your hardware to your user account on obitalk.com
2. Configure Voice services for Service Provider 1 and select Google voice
3. Enter in your google voice email and password.
4. Make sure to put a checkmark to make this provider the default Line to call out.
5. Click submit and wait for your ob110 to reboot

Asterisk Trunk setup – obitalk.com portal
1. While still logged into the Obitalk portal, configure the Voice service for Service Provider 2 as a generic service provider (this will essentially act as an extension to asterisk)
2. Enter in your asterisk server information
3. Click submit and wait for the obi110 to reboot.

Asterisk Service provider 2 Trunk

Configure Dialplan on Obi110 device and disable Auto Provisioning
Thats all there is to setting up obi110 trunks! Couldnt be easier right? Now for the small dialplan customizations to make the incoming and outgoing calls route properly.

1. Log into your obi110 device through its web admin (enter in the devices IP address in a web browser. default user/pass is admin/admin)
2. Disable Auto-Provisioning by expanding the System Management Tree on the left pane, then clicking on the Auto Provisioning link and set the Auto Provisioning Method to Disabled. Click submit and reboot (if not disabled, your changes will get overwritten).
3. Expand the Voice Services Tree to the left and click on the SP1 Service link
4. Under X_InboundCallRoute enter in SP2 and click on submit (this routes all calls coming in from GV to your asterisk extension).

Service Provider 1 Local Dialplan

5. Under the Voice Services Tree to the left, click on the SP2 Service link
6. Under X_InboundCallRoute enter in {>(xxx xxx xxxx):sp1},{>(1xxx xxx xxxx):li1}  and click on submit

Service Provider 2 Local Dialplan

The above line in Step 6 routes any 10 digit calls out through GV (configured as SP1), and any 11 digit calls starting with 1 out through the local line port…In my case, through my ooma device). The reason you will need to do this is because unlike the spa-3102, there is no seperate interfacing for asterisk to trunk to the different Service providers which the obi110 can be configured. Instead, asterisk needs to send the dialed number in a way where the obi110 can then determine to which interface it will send its calls. In this case, I will have asterisk format the numbers to be only 10 digits if a user wants to call out through GV, and append a 1 to the 10 digit number if the user wants to call out through my ooma. Once asterisk does this and sends the number to the obi110, the obi110 will then direct the call accordingly depending on if there is a 1 in front of the number – a little hurdle, but easy enough to work around.

Double checking your Asterisk configuration settings
1. Under the Service Providers Tree to the left, click on the ITSP Profile B link
2. Make sure the settings are correct for the SIP and RTP sections. Most likely you will have to modify your RTP LocalPortMin and LocalPortMax settings to match your current asterisk RTP port range.

Thats all there is to configuring your local OBi110 device. The next steps are just to configure asterisk with the user you specified in the obitalk.com service provider 2 settings, and to create a dialplan which handles the numbers so that obi110 can route the calls appropriately.

Below is my user configuration for asterisk 1.4 so that the Obi110 can register to it. ‘gvtrunk’ is my username and ‘password’ is the password which I specified in my Service Provider 2 setup on the obitalk.com portal. Place this in your sip.conf or users.conf file.

[gvtrunk]
username = gvtrunk
fromuser = gvtrunk
secret = password
type = friend
disallow = all
allow = ulaw
allow = alaw
allow = gsm
context = gv-in
host = dynamic

Next we have to edit our extensions.conf file and to tell asterisk what to do with our calls. Below, any call the user makes whether be it 1XXX-XXX-XXXX or XXX-XXX-XXXX will be routed out to the obi110 and then through google voice. This is because I have asterisk removing the 1 digit the user has dialed so that the obi110 dialplan will route the 10 digit number to GV.

In this dialplan I also have any number with a 9 dialed before it sent out to the obi110 as a 1XXX-XXX-XXXX number. If the user has dialed a 9XXX-XXX-XXXX number without the 1, asterisk will append the 1 in front of the number to make it an 11 digit number so that the obi110 can route the call through the local line port (and out through my ooma).

_XXXX is needed because my internal extension numbers are 4 digits long. I need this so that any numbers longer than 4 digits go out appropriately and are not seen as internal extensions.

[ob110-out]
;make outgoing calls to gvtrunk with 10 digit dialing
exten => _XXXX.,1,Dial(SIP/${EXTEN}@gvtrunk,20)
exten => _XXXX.,n,Hangup()
exten => _XXXX.,n,Congestion
;make outgoing calls to gvtrunk with 11 digit dialing
exten => _1XXXX.,1,Dial(SIP/${EXTEN:1}@gvtrunk,20)
exten => _1XXXX.,n,Hangup()
exten => _1XXXX.,n,Congestion
;make outgoing calls to gvtrunk through ooma with 10 digit dialing
exten => _9XXXX.,1,Set(CHEXTEN=${EXTEN:1})
exten => _9XXXX.,n,Dial(SIP/1${CHEXTEN}@gvtrunk,20)
exten => _9XXXX.,n,Hangup()
exten => _9XXXX.,n,Congestion
;make outgoing calls to gvtrunk through ooma with 11 digit dialing
exten => _91XXXX.,1,Dial(SIP/${EXTEN:1}@gvtrunk,20)
exten => _91XXXX.,n,Hangup()
exten => _91XXXX.,n,Congestion

How to handle inbound calls from GV with Asterisk
The last thing we need to do is tell asterisk how to handle inbound calls from Google Voice. In my user setup above, I specified gv-in as the user context. This just tells asterisk where to go and how to handle the incoming calls from the obi110 device. Place this in your extensions.conf file and modify it accordingly.

[gv-in]
exten = s,1,answer
exten = s,n,wait(1)
exten = s,n,Dial(SIP/4000,20)
exten = s,n,wait(1)
exten = s,n,Voicemail(4000,u)
exten = s,n,Hangup

Above, I have all calls from GV calling my extension 4000. Just change it to your desired extension.

Thats all there is to it. It may look complicated, but the dirty work is done for you…Enjoy!