SIP
SIP
The <Sip> noun specifies a SIP URI to dial. You can use multiple <Sip> nouns within a <Dial> verb to simultaneously attempt a connection with many user agents at once. The first user agent to accept the incoming connection is connected to the call and the other connection attempts are canceled.
The Dial verb’s Sip noun lets you set up VoIP sessions by using SIP — Session Initiation Protocol. With this feature, you can send a call to any SIP endpoint. Set up your RCML to use the Sip noun within the Dial verb.
Currently, only one Sip noun may be specified per Dial, and the INVITE message may be sent to only one SIP endpoint. Also, you cannot add any other nouns (eg Number, Client) in the same Dial as the SIP. If you want to use another noun, set up a callback on the Dial to use alternate methods .
Noun Attributes
The <Sip>
noun supports the following attributes that modify its behavior:
Attribute Name | Allowed Values | Default Value | Description |
---|---|---|---|
url |
any url |
none |
call screening url |
timeout |
positive integer in seconds |
60 seconds |
call screening timeout |
method |
|
|
method for call screening url |
statusCallbackEvent |
|
initiated,ringing,answered,completed |
initiated,ringing,answered,completed |
Event triggers for status callback |
statusCallback |
any url |
none |
statusCallback url |
statusCallbackMethod |
|
|
url
The 'url' attribute allows you to specify a url for a RCML document that will run on the called party’s end, after she answers, but before the parties are connected. You can use this RCML to privately play or say information to the called party, or provide a chance to decline the phone call using <Gather> and <Hangup>. The current caller will continue to hear ringing while the RCML document executes on the other end. RCML documents executed in this manner are not allowed to contain the <Dial> verb. method
timeout
The 'timeout' allows you to specify the limit in seconds that call screening waits for the called party to accept the call. Default value 60 seconds
method
The 'method' attribute allows you to specify which HTTP method CPaaS should use when requesting the URL in the 'url' attribute. The default one is POST.
statusCallbackEvent
When dialing out to a SIP URI using <Dial>, an outbound call is initiated. The call transitions from the initiated state to the ringing state when the phone starts ringing. It transitions to the answered state when the call is picked up, and finally to the completed state when the call is over. With statusCallbackEvent, you can subscribe to receive webhooks for the different call progress events: initiated, ringing, answered, or completed for a given call.
The statusCallbackEvent attribute allows you to specify which events CPaaS should webhook on. You can specify multiple events by separating them with a comma: initiated,ringing,answered,completed
. If a statusCallback is provided and no status callback events are specified the completed event will be sent by default.
As opposed to creating an outbound call via the API, outbound calls created using <Dial> are initiated right away and never queued. The following shows a timeline of possible call events that can be returned and the different call statuses that a <Dial> leg may experience:
The <Sip> noun specifies a sip uri to dial. You can use multiple <Sip> nouns within a <Dial> verb to simultaneously attempt a connection with many sip uris at once. The first sip uri to accept the incoming connection is connected to the call and the other connection attempts are canceled.

Event | Description |
---|---|
initiated |
The |
ringing |
The |
answered |
The |
completed |
The |
Status Callback HTTP Parameters
The CPaaS parameters passed to your application in its asynchronous request to the StatusCallback URL include all parameters passed in a synchronous request to retrieve RCML when CPaaS receives a call to one of your numbers. The full list of Request Parameters can be found in the RCML Voice Request documentation.
When the call progress events are fired, the Status Callback request also passes these additional parameters:
Parameter | Description |
---|---|
CallDuration |
The duration in seconds of the just-completed call. Only present in the |
Timestamp |
The timestamp when the event was fired, given as UTC in RFC 2822 format. |
CallbackSource |
A string that describes the source of the webhook. This is provided to help disambiguate why the webhook was made. On Status Callbacks, this value is always |
SequenceNumber |
The order in which the events were fired, starting from |
ParentCallSid |
A unique identifier for the parent call. |
Call Screening HTTP parameters
When a call is answered, CPaaS passes the following parameters with its request to your screening URL (in addition to the standard RCML Voice request parameters). The full list of Request Parameters can be found in the RCML Voice Request documentation.
Examples
For an example of how to use the <Sip> noun see below.
<Response> <Dial> <Sip>sip:alice@127.0.0.1:5080</Sip> </Dial> </Response>
Authentication
Send username and password attributes for authentication to your SIP infrastructure as attributes on the Sip noun.
Request Parameters
Attribute Name | Values |
---|---|
username |
Username for SIP authentication. |
password |
Password for SIP authentication |
Authentication Example
<Response> <Dial> <Sip username="alice" password="secret">sip:alice@example.com</Sip> </Dial> </Response>
Custom headers
Send custom headers by appending them to the SIP URI — just as you’d pass headers in a URI over HTTP. For example:
<?xml version="1.0" encoding="UTF-8"?> <Response> <Dial> <Sip> sip:alice@example.com?mycustomheader=tata&myotherheader=toto </Sip> </Dial> </Response>
Character Limit
While the SIP URI itself must be under 255 chars, the headers must be under 1024 characters.
Transport
<?xml version="1.0" encoding="UTF-8"?> <Response> <Dial> <Sip> sip:alice@example.com;transport=tcp </Sip> </Dial> </Response>
Set a parameter on your SIP URI to specify what transport protocol you want to use. Currently, this is limited to TCP and UDP. By default, CPaaS sends your SIP INVITE over UDP. You can change this by using the transport parameter:
Complex Dial Examples
A more complex Dial, specifying custom settings as attributes on Dial, including call screening and setting the protocol to TCP.
<?xml version="1.0" encoding="UTF-8"?> <Response> <Dial record="true" timeout="10" hangupOnStar="true" callerId="bob" method="POST" action="/handle_post_dial"> <Sip method="POST" url="/handle_screening_on_answer"> sip:alice@example.com?customheader=foo </Sip> </Dial> </Response>