Have code. Will travel.

Obi110 ATA settings

We now move on to installing the Obi110 Analog Telephone Adapter (ATA). An ATA allows us to interface a regular PSTN phoneline or a phone handset over a network connection, and convert that signal into SIP packets for Asterisk. This particular ATA has three ports: FXS, FXO and ethernet.

Without getting into too much detail, an FXO port is the PSTN side of the call, and the FXS port is the handset side. 3CX has a nice explanation if you wanna know more.

You can configure the Obi from a web interface. If you need to find out your Obi's IP, plug in a phone handset to the PHONE port in the back and dial "***1" and listen. The Obi should playback the IP it was assigned. Enter this IP into your web browser, and you'll be at the OBi admin login page.

The default login username is 'admin', and the password is also 'admin.' Login to the Obi and go to "System Management" -> "Auto Provisioning" on the left side navigation bar. You'll see an option titled "Method" on the right side screen. Uncheck the box next to it (you must do this in order to change any settings. Quite annoying). Change the option to "Disabled."

Whenever you make changes to a settings page, you must scroll down and hit "Submit" or your changes won't be saved.

This tells the Obi to not reset itself every time it is rebooted, meaning it will actually "save" the changes you make (?).

Now we need to set the Obi's IP to static, as it's a network resource and we don't want it's IP changing on us randomly. In the left side navbar, go to "System Management" -> "Network Settings", and on the main screen titled "Internet Settings", uncheck default and select "Static."

Then follow suit with the rest of the IP options and fill out the subnet, gateway, etc.

Your 'gateway' value is just whatever the IP address is, but the last number being ".1" instead of whatever your IP is. The 'DNS' values can be '8.8.8.8' and '8.8.4.4'. Those are just google DNS servers, so they're cool. Submit your changes on this page to save.

Voice Services - SP1 Service

Voice Services: SP1 Service: SP1 Service:

X_ServProvProfile: A - sometimes this is the default, if just leave it

AuthUserName: PhoneHandset

AuthPassword: the "secret" value we set in sip.conf for the PhoneHandset endpoint

MaxSessions: 10

MWIEnable: Checked

X_VMWIEnable: Checked

MessageWaiting: Unchecked, but undefaulted

Submit changes to save.

Voice Services - SP2 Service

Navigate to

Voice Services: SP2 Service: SP2 Service:

Uncheck defaults and enter the following:

X_ServProvProfile: B

X_InboundCallRoute: LI

AuthUserName: PhoneLine

AuthPassword: the "secret" value we set in sip.conf for the PhoneLine endpoint

Submit changes to save.

Physical Interfaces - Phone Port

Navigate to:

Physical Interfaces: Phone Port

Uncheck defaults and enter the following:

Primary Line: SP1 Service

StarCodeProfile: None

Submit and save changes.

Service Providers - ITSP Profile B

Navigate to:

Service Providers ITSP Profile B General

Uncheck defaults and enter the following:

DTMFMethod: InBand

then move onto:

Service Providers ITSP Profile B SIP

Uncheck defaults and enter the following:

Proxy Server: IP address of RPi Asterisk server

X_SpoofCallerID: Checked

X_AccessList: IP address of RPi Asterisk server

Submit changes to save.

Physical Interfaces - Line Port

Navigate to:

Physical Interfaces: Line Port: Line Port

Uncheck defaults and enter the following:

InboundCallRoute: SP2(5555555555) - replace "5555555555" with phone number of the line attached to the Obi ATA

RingDelay: 3500

Submit changes and save.

Confirm ATA is registered to Asterisk

We should now have our Obi ATA tied into the Asterisk server.

If you navigate to "Status" -> "System Status", you should see SP1 and SP2 server connection status menus saying the ports are talking to the Asterisk server. Here's what that looks like:

Using the Asterisk debug console

We have now tied our phoneline into our Asterisk server. This is where the build gets interesting.

Asterisk is now sitting between our phoneline and our phone, which means we can apply all sorts of programming logic to incoming calls - read caller ID, use Text-to-Speech engines on live calls, etc.

Part of using Asterisk effectively is debugging call flows from the Asterisk console. Login to your RPi and open up the asterisk console with the following command:

sudo asterisk -rvvvvv

This starts the Asterisk console in "verbose" mode, meaning it shows the most debug output during a call.

So let's test to see if our Asterisk server is processing calls through the ATA we just configured. We will test two cases: calls coming into the phoneline, and dialing out from the phone attached to the ATA.

Bust out your cell phone and call the number of the line attached to the ATA. Watch the console light up as the call hits the system.

Notice the text on the debug console "in PhoneLine context" on the second line. This means the system "caught" the call coming in on the PhoneLine endpoint and is handling it in the dialplan defined in the PhoneLine section of extensions.conf.

Good. We can catch calls coming in from the FXO port. Now let's two quick tests on the phone set.

Dial your cell number or some other number on the phone handset attached to the ATA. I dialed "222."

Now notice the second line. It says "in PhoneHandset extension" now.

This means Asterisk caught the dialing on the other endpoint and is processing it in the PhoneHandset part of the dialplan, also called the PhoneHandset context.

After both calls are caught in Asterisk, we see their caller ID and then Asterisk hangs up the call.

To check if the OBI ATA is configured correctly from the Asterisk side, enter this command at the Asterisk debug console:

sip show peers

Asterisk should report 2 peers, one monitored and one unmonitored.

Once you have finished the Obi configuration, reboot the Obi for settings to take affect. It's also a good idea to restart the Asterisk server so it can register the ATA.

sudo /etc/init.d/asterisk restart

Asterisk hanging up on the call doesn't mean your system is broken. Quite the opposite. We told Asterisk to do this. In our simple dialplan example, we have Asterisk answer the call, display the caller ID on the console, and then hang up.

This simple example demonstrates the control that Asterisk gives you when configured correctly.

We're very close to doing some advanced call processing in Asterisk and blocking robocalls. But before we progress to that, we must first go over the building blocks of Asterisk that allow us to build more complex dialplans.