

Build a Twilio Hard Phone with SIP from Twilio, Raspberry Pi, and Asterisk - jonmarkgo
http://www.twilio.com/blog/2013/03/build-a-twilio-hard-phone-with-sip-from-twilio-raspberry-pi-asterisk-freepbx-and-the-obihai-obi100.html

======
car
So many moving parts and cables. Raspberry Pi, an old phone, FreePBX,
Asterisk, Obi100. Let's outcomplex the POTS.

Seriously, how about you show us how to register an Android phone with your
SIP service?

~~~
sologoub
Don't think Twilio has SIP registration, but they do have Android SDK for
Twilio Client that will do the trick.

~~~
RobSpectre
Yeah, this would definitely be the way to go for an Android device. Use the
SDK examples to build a little dialer and use the ACTION_CALL intent, and it
works great for outbound as well.

Docs and download are here - <http://www.twilio.com/docs/client/android>

~~~
josh2600
Rob, are you guys looking to do SIP Reggie soon? I imagine it's gotta be
coming at some point (I don't know why you guys don't do it now except for the
obvious pain point of network overhead from all that registration traffic).

~~~
RobSpectre
We're pretty stoked on what we have planned for our SIP roadmap, but staying
true to our discipline of announcing features only when they ship.

SIP From Twilio is all we have to report right now.

------
swalberg
Why is Asterisk in the mix? If you call a SIP URI directly from Twilio, can't
you land it directly on the ATA?

~~~
superuser2
Voicemail, 7-digit dial (most SIP providers only take 10), forwarding,
filtering, etc.

Twilio could theoretically handle these things for you, but they're typically
handled in a PBX.

~~~
swalberg
Hm, maybe I should have been more specific. Given that this is an interesting
hack to get a PSTN call to an analogue set through Twilio, why did they bother
with the SIP proxy?

~~~
superuser2
I'm not sure I understand your question, but I think it's because the ATA
(like most modern/cheap ATAs) only speaks SIP.

------
taliban
Now to figure out how to make this work with a rotary phone...

~~~
RobSpectre
That would be hilarious.

~~~
swalberg
Wouldn't it just work? The FXS port will generate the 90VAC/20Hz signal and
the device plugged into it interprets that as an incoming call.

You guys only support termination through SIP, not origination, so the
dialling mechanism doesn't matter. And if you did want to do origination, the
ATA just has to understand pulse dialling.

~~~
RobSpectre
Yeah - I think it would. Going to eBay a fierce looking red one from the
sixties and going to give it a spin.

~~~
stcredzero
Keep it under a glass cake cover by a bust of William Shakespeare. Next up:
installing firepoles DIY.

------
francesca
awesome! I love seeing Twilio devs using "old" landline tech with the API. Way
to go!

~~~
jonmarkgo
Thanks! It was so satisfying to make a physical phone ring!

~~~
josh2600
Not to be pedantic, but what does Twilio help here? Aren't you kind of just
Jerryrigging Twilio onto an Asterisk install?

Not that this isn't cool, I just don't understand what benefit you get from
having Twilio connected here. It seems like if you want to make a physical
phone ring you could take a time machine back to 2004 and achieve the same
thing using Asterisk, no?

Can you explain the benefit of integrating with Twilio instead of using just
plain ol' Asterisk?

Disclaimer: I work at 2600hz, the open-source cloud telecom company.

~~~
RobSpectre
Great question Josh. Big benefit here is being able to keep your voice
application logic in your own code instead of in Asterisk. Often we find in
business telephony applications, the really important information you want to
get to and from the user isn't in the phone server, but in the CRM app or help
desk app or support app that the phone server is trying to get to and from the
user. The closer data like account numbers or service tags or support tickets
is to the logic that directs your IVR tree or call queue, the easier it is to
build experiences that delight users. Siloed telephony and business software
manifest themselves in ugly ways like having to repeat information to multiple
agents or waiting on hold while your account information is retrieved.

We think if the code that makes your customers happy and the code that makes
your phones ring can finally live in the same place, some pretty magical stuff
can happen.

~~~
josh2600
As always Rob, great answer :).

I think the part that made me scratch my head was the line where Jon said "It
was so satisfying to make a physical phone ring!" which is funny when you take
it out of context for a multitude of reasons. I hope you appreciated my quip
about time travel ;).

Having the logic separate from the delivery may make sense for some
applications and might not for others. We wrestle with clients all the time
that want various elements of the platform either directly under their control
or as far away as humanly possible. There's usually little rhyme or reason to
understanding which components are supposed to go where or for what reason,
but that's Telecom in a nutshell. When dealing with large carriers, the
question of what goes in the firewall, and what stays out, is a complete
mystery until right before you ink the contract.

To be fair, your point about siloed telephony and business software does ring
a tad hollow when you talk about Twilio which is essentially a silo for
business logic of a different color, right?

Once again, I do really enjoy these chats :D. I also admire the hard work your
team does writing these blogs which I point to as a great example of developer
evangelism. Your team does a great job of getting out there and showing off
the tech. I especially like the edge case stuff, like jamming Asterisk onto a
Raspberry pi and connecting it to an obihai ;).

~~~
RobSpectre
I'm not sure the answers I have are always great, but really appreciate your
praise of the devangel crew at Twilio. I'm very lucky to work with them.

Re: silos - You know, when it comes to all this cloud buzzword stuff, it
definitely can feel like a shell game. Like you are moving a headache from one
area to another for the sake of staying technologically trendy. But, I think a
lot like you in the sense that the technical details matter.

In the case of an API play like Twilio, your logic stays in your app and that
logic instructs how the call or SMS through a very simple interface. We don't
host or hold anything for you - we just make the process of you telling us
what to do as easy as we possibly can using the tools you already have.

APIs that are thoughtfully designed and carefully crafted are silobusters -
they erase the painful demarcation lines of our software making the limits on
what is possible less about how one piece of code talks to another, but why.

------
koobe
What do you need twilio, raspi and asterisk for?

You just need an ATA and a sip account like callcentric.

~~~
RobSpectre
SIP From Twilio will send to any SIP solution you have, this was just a neat
hack with one of our favorite hardware platforms.

------
masonhensley
What's with this on the blog background?

"SECURITY WARNING: Please treat the URL above as you would your password and
do not share it with anyone."

~~~
jonmarkgo
Weird, I have no idea. Thanks for pointing it out...will check into it

~~~
tkahn6
Seems to be a Facebook thing.

~~~
RobSpectre
It was - bug with our social widget. Corrected now.

------
newman314
As a different configuration, I'm looking for a free solution that would let
me dial 800 numbers from a VoIP connected home phone.

I dial into a lot of conference calls and this would be an awesome setup. Just
wondering if anyone else has tackled such a config yet?

~~~
r4vik
I'm pretty sure sipgate supports free 800 calls

------
eddieroger
Where was this seven years ago when I had all the pieces of a decent Asterix
server, minus the SIP provider? I had such plans then, but never got the last
leg of the journey done. I wonder if my Sipura 1000 still works...

------
silasb
What would be slick is if you did a soft phone on the RPi and skipped the ATA.
Then connect the speaker, mic, keypad directly to the phones old internals.

~~~
jonmarkgo
That's a great idea - perhaps for my next post! I liked the idea of the ATA
though since it's more of a proof of concept on how to interface Twilio with
an older phone system.

------
pla3rhat3r
Could this be deployed using OpenVBX?

~~~
jonmarkgo
Potentially, though you may need to hack up a SIP module yourself.

------
ajaimk
I thought the whole purpose of Twilio was to not use Asterisk. Just saying.
Great tech.

------
huslage
This is ridiculously easy with Tropo. You plug in an ATA, register it and it
works. We did this with an ATA to Rural India that forwarded local calls from
a toll-free number to Tropo for an IVR. Works a treat. No computer needed.

What a waste of time with this Twilio garbage.

~~~
stevelaz
True that, Tropo just needs a marketing team like Twillio has and the this
would be more obvious to others...

------
KarneAsada
Can't wait to resurrect my SI football phone!

~~~
RobSpectre
Think I'm going to go with this:

[http://www.amazon.com/Crosley-Black-Candlestick-Phone-
CR64/d...](http://www.amazon.com/Crosley-Black-Candlestick-Phone-
CR64/dp/B0002Z2U6A/ref=sr_1_4?ie=UTF8&qid=1363813735&sr=8-4&keywords=novelty+phone)

~~~
tankbot
I have an old Lego phone collecting dust somewhere that sprang instantly to
mind when reading this. Great post!

