开发者

Twilio Rest API call making help..

I tried reading the REST api for call making over and over again but this really makes no sense to me....I cant understand what to do...

Before I had a sequential dialing app in php using Twilio's TwimML now using the rest api I am very confused....I would put the call handle url into the phone section now I have ABSOLUTELY no idea of where to ge开发者_StackOverflow社区t started or what to do, where to find the calls resource uri they are talking about or even how to execute my script and whether I can still use my php script or not I am really confused...


There's two interaction scenarios with Twilio that are handled by the REST API and TwiML. The REST API is for when you want to tell us to initiate an action and TwiML is for when we alert you to something happening so you can tell us what to do.

Let me first explain what REST is in the context of Twilio. REST is a way of describing what URLs contain which data (also called resources) and the operations you can perform on that data. For example you can access /2010-04-01/Accounts/AC12345 to access the Account Instance resource for the account with a SID (string ID) of AC12345. An instance resource returns a representation (in JSON or XML) of a single instance of a given resource. We also have List resources like /2010-04-01/Accounts/AC12345/Calls that return a list of instance resources.

To initiate a new outbound call you need to add a Call instance to the Calls list or in other words, post a call to the call list (which we then transmogrify into an actual phone call or text message). You do that by making an HTTP POST request to the /Calls resource with the data for the new call you want to create (To, From, Url, etc). The URL you specify points to a publicly-accessible URL that returns TwiML which we retrieve from you and use to control the call.

The TwiML API is for when we need to know from you how to handle something. In the case of calls, we access your TwiML when either an incoming call is received (sent to the Voice URL on the phone number called) OR an outbound call that you initiated is answered by the recipient. In both cases, when the call is answered, we access the URL specified and step through the TwiML commands until they run out, ending the call.

Resources:

  • About REST http://www.twilio.com/docs/api/rest/
  • About TwiML http://www.twilio.com/docs/api/twiml/
  • Quickstart (walks through sending and receiving both SMS and voice calls) http://www.twilio.com/docs/quickstart/
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜