Client

Noun Attributes

The <Client> noun supports the following attributes that modify its behavior:

Attribute Name

Allowed Values

Default Value

name

String

none

url

any url

none

method

GET, POST

POST

statusCallbackEvent

initiated, ringing, answered, completed

none

statusCallback

any url

none

statusCallbackMethod

GET, POST

POST

name

The 'name' attribute allows you to inform the client who will answer to a video call. This attribute should be used only when <Video> noun is nested, otherwise client’s name should be used as the value of the tag <Client>.

Client’s name without <Video> noun nesting

<Client>alice</Client>

Client’s name with <Video> noun nesting.

<Client name="alice">
    <Video enable=”true”></Video>
</Client>

This attribute may contain URI params to declare propietary SIP headers to be included in the outgoing INVITE message.

<Client>alice?X-Custom-Header1=1234&X-Custom-Header2=4321</Client>

url

The url attribute allows you to specify a URL for a RCML document that will run on the called party’s end, after the call is answered, 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 . The 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 verb’s method.

method

The 'method' attribute allows you to specify which HTTP method CallAPI should use when requesting the URL in the 'url' attribute. The default value is POST.

statusCallbackEvent

When dialing out to a Client 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 CallAPI should webhook on. To specify multiple events separate 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.

Compared 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 <Client> noun specifies a client identifier to dial. You can use multiple <Client> nouns within a <Dial> verb to simultaneously attempt a connection with many clients at once. The first client to accept the incoming connection is connected to the call and the other connection attempts are canceled.

Event

Description

initiated

The initiated event is fired when CallAPI starts dialing the call.

ringing

The ringing event is fired when the call starts ringing.

answered

The answered event is fired when the call is answered.

completed

The completed event is fired when the call is completed regardless of the termination status: busy, canceled, completed, failed, or no-answer. If no statusCallbackEvent is specified, completed will be fired by default.

statusCallback

The statusCallback attribute allows you to specify a URL for CallAPI to send webhook requests to on each event specified in the statusCallbackEvent attribute.

statusCallbackMethod

The statusCallbackMethod attribute allows you to specify which HTTP method CallAPI should use when requesting the URL in the statusCallback attribute. The default is POST.

9.3.3.2 Status Callback HTTP Parameters

The parameters CallAPI passes to your application in its asynchronous request to the StatusCallback URL include all parameters passed in a synchronous request to retrieve RCML when CallAPI receives a call to one of your CallAPI numbers. The full list of parameters and descriptions of each are in the RCML Voice Request documentation.

When the call progress events are fired, the Status Callback request also passes these additional parameters:

Parameter

Description

CallSid

A unique identifier for this call, generated by CallAPI. You can use the CallSid to modify the child call by POSTing to Calls/{CallSid} with a new RCML URL.

CallStatus

A descriptive status for the call. The value is one of queued, initiated, ringing, in-progress, busy, failed, or no-answer. See CallStatus for more details.

CallDuration

The duration in seconds of the just-completed call. Only present in the completed event.

Timestamp

The timestamp when the event was fired, formatted 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 call-progress-events.

SequenceNumber

The order in which the events were fired, starting from 0. Although events are fired in order, they are made as separate HTTP requests and there is no guarantee they will arrive in the same order.

Examples

Example 1: Dialing to a client

In this example, we want to connect the current call to a client named jenny. To connect the call to jenny, use a <Dial> verb with a <Client> noun nested inside.

<?xml version="1.0" encoding="UTF-8"?>
<Response>
   <Dial>
     <Client>Alice</Client>
   </Dial>
</Response>

Example 2: Simultaneous Dialing

You can use up to a total of ten <Number> and <Client> nouns within a <Dial> verb to dial multiple phone numbers and clients at the same time. The first person to answer the call will be connected to the caller, while the rest of the call attempts are hung up.

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Dial callerId="+19898XXXXXXX">
        <Number>123-321-4321</Number>
       <Client>jenny</Client>
       <Client>tommy</Client>
  </Dial>
</Response>

Example 3: Call Progress Events

In this case, we want to receive a webhook for each call progress event when dialing a Client using <Dial>.

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial>
        <Client
             statusCallbackEvent='initiated ringing answered completed'
             statusCallback='https://myapp.com/calls/events'
             statusCallbackMethod='POST'>
                                        thomas
         </Client>
</Dial>
</Response>

Example 4: Video call to Client

The following RCML dials to alice enabling video.

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Dial>
	    <Client name="alice">
	        <Video enable=”true”>
    	    </Video>
	    </Client>
    </Dial>
</Response>

Last updated