问题
Let's say I need to implement a callback service on a website. I'm curious if it's possible to develop it using Twilio.
For example, if a website visitor provides his mobile phone number from one side, from another side I have a manager using his web CRM application. Is it possible to:
- Make a call (using WebRTC?) to a manager
- When the manager replies the incoming call, call to the website visitor (on his mobile phone)
- Connect both sides together
I know there are lots of ready-to-use callback services, I'm just curious how it works under the hood.
回答1:
Twilio developer evangelist here.
This is a feature we call Click to Call. Here's how it would work with Twilio:
- The visitor provides his number through a form on the site
- Generate a call to the manager using the Twilio REST API
- When the call connects to the manager, dial the visitor.
- This is achieved using TwiML
- Whent the call connects, Twilio makes an HTTP request to a URL you provide in step 2
- That URL needs to respond with TwiML, which is a subset of XML to tell Twilio what to do with the call
- In this case the TwiML would be to <Dial> the visitors number
- When the visitor answers the two are connected
This is a high level view of it, we also have a tutorial walking you through Click to Call with Twilio (this is the Python version, but there are others available too) which I recommend you take a look at.
Let me know if this helps at all.
来源:https://stackoverflow.com/questions/41232238/callback-service-on-the-website-using-twilio