Introduction to Twilio – Cloud Communication

Twilio Comunication
Twilio Comunication
Twilio Comunication

Twilio Comunication

Twilio is the company which provides services for developers and the services in which twilio deals are: APIs for text messaging, VoIP, Voice in the cloud etc. Twilio is not providing any final end product which users can use but twilio is providing products i.e. APIs for the developers so that they can implement the add-on functionalities like communication based functionalities (Text Messages on registration, Text message or Voice call on forget password, Voice Internet Protocol services & etc.) into their applications.

Work flow of Twilio – Developer signs up on twilio for using it’s services, chooses a virtual local number on his own, to send or receive text or voice messages. Then the developer maps this virtual phone number with the “Request URL” and this URL will instruct twilio how to control the content of the phone call received on this virtual number. The developer defines the set of instructions which twilio would follow while receiving or making phone calls on virtual local number.

These set of instruction includes:

  • <say></say> – Informs the customer or a user with set of words written in <say> tag. For example: In case of online shopping website after placing an order you receives an automated call from e-commerce company “Thanks for placing an order with us. Hope you have enjoyed shopping with us. Thanks”

For example:

<?xml version="1.0" encoding="UTF-8"?>
<!-- page located at http://exampleurl.com/voicemail_record.xml -->
<Response>
<Say>Thanks for placing an order with us. Hope you have enjoyed shopping.</Say>
</Response>
  • <play></play> – Play will play a pre-recorded audio file when the user will connect to the virtual local number.

For example:

<?xml version="1.0" encoding="UTF-8"?>
<!-- page located at http://exampleurl.com/voicemail_record.xml -->
<Response>
<Play>http://URL of the Music File/music.mp3</Play>
</Response>
  • <gather></gather> – Gather tag/verb will allow the user to input his/her information. You can say that “Gather” collects the information from the caller/user.

For example – When a caller calls on some toll-free number, he gets some options during call like: Press 1 for “English”, Press 2 for “Hindi”, Press 3 for “German”. This means that the “gather” tag is asking a response from caller.

  • <record></record> – records the caller’s voice and returns to you the URL of a file containing the audio recording. It’s the same when you call on some number and sometimes if the person is busy the voice mail box says “Leave a message after a beep.”

For example:

<?xml version="1.0" encoding="UTF-8"?>
<!-- page located at http://exampleurl.com/voicemail_record.xml -->
<Response>
<Say>
Please leave a message after the beep.
Press star when finished.
</Say>
<Record
action="http://exampleurl.com/handle_Recording.php"
method="GET"
maxLength="20"
finishOnKey="*"
/>
<Say>I did not receive any response. Please Try again</Say>
</Response>
  • <reject></reject> – Reject tag/verb will reject an incoming call/calls on your number which will help you to block unwanted calls on your number.

Example:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Reject reason="busy" />
</Response>
  • <dial></dial> – Dial tag/verb will connect the current caller with the another number. If the system will get the busy tone, or if the called party will not pick the call, or if the number doesn’t exist, the “Dial” tag/verb will finish.

Example:

<?xml version="1.0" encoding="UTF-8"?>
<!-- page located at http://exampleurl.com/dial_callstatus.xml -->
<Response>
<Dial action="/handleDialCallStatus.php" method="GET">
415-123-4567
</Dial>
<Say>I am unreachable</Say>
</Response>

In this example provide an action URL and method. Now when <Dial> ends, Twilio will submit a request to the action URL with the parameter ‘DialCallStatus’. If nobody picks up, ‘DialCallStatus’ will be ‘no-answer’. If the line is busy, ‘DialCallStatus’ will be ‘busy’. If the called party picks up, ‘DialCallStatus’ will be ‘completed’. If a conference is successfully dialed, ‘DialCallStatus’ will be ‘answered’. If an invalid phone number was provided, ‘DialCallStatus’ will be ‘failed’.

 

Refer to URL for more deep knowledge on Dial tag/verb:

https://www.twilio.com/docs/quickstart/php/twiml/connect-call-to-second-person

You may also like...

Leave a Reply