When a phone call comes in to FreeSWITCH, Plivo makes an HTTP request to the Answer URL . In your response to that request you can tell Plivo how to control the call.

Your web app at the Answer URL should respond to Plivo’s request with RESTXML. Plivo Elements can be categorized as follows: the parent element and the other children elements.

Plivo RESTXML Interpreter

When Plivo recieves the RESTXML, it executes the elements in order from top to bottom. As an example, the following RESTXML snippet announces “This is Plivo Framework” to the caller before playing Trumpet.mp3 and hanging up.

1
2
3
4
5
<?xml version="1.0" encoding="UTF-8" ?>  
<Response> 
    <Speak>This is Plivo Framework</Speak>
    <Play>http://www.plivo.org/sounds/Trumpet.mp3</Play>
</Response>

Plivo Elements are case-sensitive. For example, using <speak> instead of <Speak> will result in an error. Attribute names are also case sensitive and “camelCased.”

The Parent <Response> Element

The parent element of Plivo’s RESTXML is the <Response> element. All children elements must be nested within this element. Any other structure is considered invalid.

Example:
1
2
3
4
<?xml version="1.0" encoding="UTF-8" ?>  
<Response> 
    <Speak>This is Plivo Framework</Speak>
</Response>

Please refer Plivo Elements for more details.

Comments are closed.