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 to receive INPUT calls to your number. Basically, your device is βregisteredβ with twilio, so twilio knows that your device exists and can call it when there is an incoming call.
To receive incoming calls, you must log in to twilio, specify the phone number and configure the SIP domain in the "Programmable Voice" section:
- Add a SIP domain (e.g. mysipdomain.sip.twilio.com).
- Add user / credentials to this sip domain

Please note that you can use either mysipdomain.sip.us1.twilio.com or mysipdomain.sip.twilio.com . Obitalk defaults to the former, but Twilio UI displays the latter. Both work for now.
Go to the obitalk toolbar and configure one of the available SPs on your Obihai box to use Twilio.
- Enter twilio sip domain (e.g.
mysipdomain ) - Provide the sip username and password that you configured in twilio as part of the sip domain.
- save

The obitalk toolbar should demonstrate successful sip registration for your configured SP, and you will be able to dial a Twilio number and have your SIP phone ring.
Outgoing calls
To handle outgoing calls from your registered SIP phone, you need to specify the URL in the Voice Configuration section of the SIP domain in Twilio. When your registered SIP device attempts to make an outgoing call, Twilio will ask the URL for instructions on what to do.
This is more complicated because you need to host a small web application somewhere for twilio to talk (there is currently no twimlet). The web application itself can be quite simple if all we want to do is parse the request and tell twilio in the <Dial> number requested. If you are making an international number, you must make sure that you include these countries in your account.
Here is one open source application that 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 paid hosting).
https://gist.github.com/mattpr/9ed8f97f0a7a184c17da99a3d2463e7a
mattpr
source share