Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connecting an OBi (OBi202) to Twilio SIP?

Tags:

twilio

sip

I am looking to connect Twilio SIP to an OBi202 endpoint. It seems like it would be easy considering the Twilio SIP support and the OBi is a SIP endpoint...

I found the settings for the RTP port range, server, and credential information, but beyond that I am stuck and cannot connect. Can anyone provide some guidance for connecting an OBi to Twilio?

Edit: I did manage to figure out the inbound routing, although as Devin said, it requires a third party. I setup a free account with iptel.org. They provide registration and allowed me to connect my OBi to their pure SIP service. Using the verbs I can dial incoming calls to my Twilio numbers directly to my Obi! I am still testing, but appears to work great so far.

Edit: I have played around with the iptel service for outgoing. I can successfully pass a SIP call from my OBi to Twilio, but then I get a bit stuck. I seem to get double charged for the incoming SIP call to Twilio, then the for the outgoing redirect does not seem to work. I will post more details once I debug further...

like image 824
ryanj Avatar asked Dec 07 '13 17:12

ryanj


2 Answers

Twilio evangelist here.

AFAIK, today there is no way to have an Obi receive an inbound SIP call directly from Twilio.
In order for Twilio to know where to send a SIP call to, the Obi needs to have registered with some SIP registration server, and Twilio does not provide registration today.

Another evangelist on my team (Jon Gottfried) wrote a blog posts that shows how use an Obi and a RaspberryPi running RasPBX to get Twilio to make a SIP call to the Obi.

As far as making outbound calls from the Obi into Twilio I've actually not tried this with the Obi. If the Obi can make a direct IP call (not requiring registration) then this should be possible. I've done this using XLite, a freeware softphone.

If you can figure out how to make outbound callswith the Obi, I'd love to hear how you did it.

Hope that helps.

like image 160
Devin Rader Avatar answered Oct 03 '22 09:10

Devin Rader


Twilio added SIP Registration as a feature in October 2016.

https://www.twilio.com/blog/2016/10/introducing-sip-registration.html

Incoming Calls

SIP Registration allows you to connect a SIP device in order to receive INCOMING calls to your number. Basically your device is "registered" with twilio so that twilio knows your device exists and can ring it when there is an incoming call.

To get incoming calls working, you should login to twilio, have a phone number and configure a SIP domain under "Programmable Voice":

  • Add a SIP Domain (e.g. mysipdomain.sip.twilio.com).
  • Add a user/credential to that sip domain

Twilio SIP Domain Config

Note that you can use either mysipdomain.sip.us1.twilio.com or mysipdomain.sip.twilio.com. Obitalk defaults to the former but the twilio UI shows the latter. Both work for now.

Login to the obitalk dashboard and configure one of the available SP on your Obihai box to use Twilio.

  • Enter your twilio sip domain (e.g. mysipdomain)
  • Provide the sip username and password that you configured in twilio as part of the sip domain.
  • save

Obitalk Config for Twilio SIP registration

The obitalk dashboard should show successful sip registration for the SP you configured and you should be able to dial your Twilio number and have your SIP phone ring.

Outgoing Calls

In order to handle outgoing calls from your SIP registered phone, you need to provide a URL under "Voice Configuration" under the SIP Domain in Twilio. When your SIP registered device tries to make an outgoing call, Twilio will ask this URL for instructions on what to do.

This is the harder part because you need to host a small web application somewhere for twilio to talk to (no twimlet available as of today). The web application itself can be quite simple if all we want to do is parse the request and tell twilio to <Dial> the requested number. If you are doing any international dialing you should make sure you have enabled these countries in your account.

Here is one opensource application you can use for this purpose. https://github.com/timbeyers/sip2pstn-simpledial

I have a quick and dirty php implementation that I prefer (due to the ease of hosting on almost any cheap shared hosting plans).

https://gist.github.com/mattpr/9ed8f97f0a7a184c17da99a3d2463e7a

like image 26
mattpr Avatar answered Oct 03 '22 11:10

mattpr