Hardware Reference
In-Depth Information
What's the Standard?
Here's the bad news about SIP and VoIP applications:
there's not a standard approach to them yet. They all offer
slightly different services, though the basics of making
calls, sending SMS messages, recording calls, and reading
touchtones are available most everywhere. Each server
and each commercial provider has a different approach
to providing an application programming interface (API)
for its service. The markup you learn here for Twilio won't
apply when you're building an application using another
service like Tropo, Google Voice, or any of the dozens of
other providers out there.
You'll also need the URL of your Arduino server from
the previous project. For example, if your server is
at 63.118.45.189 , the address for this project will be
http://63.118.45.189/voice.xml . Log in to your Twilio
account and go to the dashboard. There, you'll be given
a sandbox phone number and passcode. The phone
number will connect you to Twilio's gateway. The gateway
will connect you to an HTTP server whose address you
provide (give it the one above). Once you've done that, it's
time to write an XML file for the server, and to modify the
sketch so it will respond as needed. Figure 10-11 shows the
dashboard panel.
There are four questions that can help you choose which
tool to use for any project:
A Brief Introduction to XML
XML , or eXtensible Markup Language , is a general markup
language used by many web and database services.
XML allows you to describe nearly anything in machine-
readable form. XML is made up of tags that begin and
end with < and > . Tags describe elements , which can be
any concept you want to label. Elements can have subele-
ments; for example, a <body> might have <paragraph>
subelements, marked up like so:
• Does it offer the features I need?
• Is it available in my area?
• Is it simple to use?
• Will it work with my existing tools?
For this application, I chose Twilio because its markup
language, TwiML, is very simple. Also, Twilio's examples
make it clear how to separate the markup language from
another server-based language, like PHP or Ruby. Every-
thing happens through GET or POST. Twilio has excellent
PHP examples, but you don't need them to get started.
Its debugger is useful, and its technical support is good
as well. It lacks features that other services have—like the
ability to get the audio level while recording, or speech-
to-text conversion—but, on the whole, the benefits of its
simplicity outweigh any of the missing features.
<body>
<p>This is the content of the paragraph</p>
</body>
To complete this project, you'll need an account on www.
twilio.com . You can build and run this project with a free
account, or you can use a paid account. If you use the free
account, you will have to enter a passcode in addition to
the phone number every time you call, and you'll only be
able to support one application at a time. For this intro-
duction, that's enough.
Figure 10-11
The Twilio dashboard. Enter the URL for your
Arduino server in the Voice URL box.
 
Search WWH ::




Custom Search