REST Communications Markup Language Overview
The REST Communications Markup Language represents a set of instructions you can use to tell CPaaS what to do when you receive an incoming call or SMS.
When someone makes a call or sends an SMS to one of your CPaaS numbers#, CPaaS will look up the URL associated with that phone number and make a request to that URL. CPaaS will read RCML instructions at that URL to determine what to do: record the call#, play a message for the caller#, prompt the caller to press digits on their keypad#, etc.
For example, the following will say a short message#, and then record the caller’s voice:
<?xml version="1.0" encoding="UTF-8"?> <Response> <Say voice="woman">Please leave a message after the tone.</Say> <Record maxLength="20" /> </Response>
RCML is similar to HTML.Only one RCML document is rendered to the caller at once#, but many documents can be linked together to build complex interactive voice applications.
Calls from a CPaaS number to an outside number are controlled using RCML in the same manner as incoming calls.The initial URL for the call is provided as a parameter to the CPaaS REST API request you make to initiate the call.
How CPaaS Interacts with Your Application
CPaaS Request
The way CPaaS passes data to you application depends on the request method for the given URI. If the request method is GET then the data is passed in the query string or the part after the question mark.If the request method is POST then the data is sent a multi-part form data just like when a browser submits a form.
CPaaS Voice Request.Any time CPaaS makes a request to you applications it will include the following data as request parameters.
Request Parameters
Parameter | Description |
---|---|
CallSid |
The unique identifier for this call.You can use the |
AccountSid |
Your account id. |
From |
The phone number of the originator of the call. |
To |
The phone number of the call recipient. |
CallStatus |
The status of the call.The possible values are |
ApiVersion |
The version of the CPaaS API used to handle this call. |
Direction |
The direction of the call. The possible values are inbound, outbound-api and outbound-dial. |
CallerName |
The caller ID for the caller in the case of inbound calls. |
CPaaS Response
In your response to the request from CPaaS you want to provide RCML that will instruct CPaaS on how to handle the current call.
MIME Types. CPaaS supports the MIME types described in the table below.
Supported MIME Types
Parameter | Description |
---|---|
text/xml, application/xml |
CPaaS interprets the returned document as an XML instruction set. |
When your application returns the RCML document the root element of the document must always be <Response> or the parser will complain. |
+IMPORTANT: Your application should return properly XML escaped RCML document.