Call object is created when an outbound call is initiated or when an inbound call is received. Use the Call API to initiate outbound calls, retrieve call details, control ongoing calls, and build custom call flows.
The Call Object
Attributes
Unique identifier for the call.
Caller ID used to initiate the call.
Number to which the call was initiated.
Direction of the call. Values:
outbound, inbound.Timestamp when the call was answered. Format:
yyyy-MM-dd HH:mm:ssTimestamp when the call ended. Format:
yyyy-MM-dd HH:mm:ssTimestamp when the call was initiated. Format:
yyyy-MM-dd HH:mm:ssDuration of the call in seconds.
The duration of the call in seconds.
The billed duration of the call in seconds. May differ from
bill_duration depending on the billing interval.Total amount charged for the call.
Per-minute rate based on the destination number.
UUID of the A-leg of the call.
Reason the call was hung up. See hangup causes
Integer code for the hangup cause.
Entity that triggered the hangup. Values:
Caller, Callee, Plivo, API Request, Answer XML, Error, Unknown.STIR/SHAKEN attestation info. Values:
Verified, Not Verified, Not Applicable. Read moreIP address from which the call request originated.
URI of the requested resource.
Example Call Object
Billing
Plivo bills for voice calls based on the answered call duration.When Billing Starts
| Scenario | Billing |
|---|---|
| Call answered | Billing starts when the call is answered. Minimum charge is 60 seconds (1-minute increment). |
| Call not answered | No charge. Unanswered calls (busy, no answer, rejected) are not billed. |
| Call failed | No charge. Failed calls due to network issues or invalid numbers are not billed. |
| Voicemail detected | Billed if the call is answered (even by voicemail). Use machine detection to hang up on voicemail. |
Understanding CDR Fields
bill_duration: Actual call duration in secondsbilled_duration: Duration rounded to billing increment (typically 60 seconds)total_amount: Charge for the call based onbilled_duration×total_rate
Inbound calls to Plivo numbers are billed when answered. Outbound calls are billed when the destination answers. If a call is forwarded via
<Dial>, both legs (A-leg and B-leg) are billed separately once each is answered.Create a Call
Initiate an outbound call to a PSTN number or SIP endpoint. You can make simultaneous bulk calls by specifying multiple destinations.Arguments
Caller ID phone number in E.164 format (e.g.,
14157654321).Destination number(s) or SIP URI(s). Use
< to separate multiple destinations (max 1000).URL called when the call is answered. Must return valid Plivo XML.
HTTP verb for
answer_url. Default: POST.URL notified when the call starts ringing.
HTTP verb for
ring_url. Default: POST.URL notified when the call is hung up.
HTTP verb for
hangup_url. Default: POST.Invoked if
answer_url fails after 3 retries or 60s timeout.HTTP verb for
fallback_url. Default: POST.Sets caller name (up to 50 characters).
Sends DTMF digits after call is connected. Use
w (0.5s wait) or W (1s wait).If
true, sends send_digits during pre-answer. Default: false.Max duration of call in seconds. Default:
14400 (4 hours).Max duration (in seconds) from start of ringing to hangup.
Detect machine on answer. Values:
true, hangup.Time in ms to detect machine. Default:
5000. Range: 2000–10000.Callback URL for asynchronous machine detection.
HTTP verb for
machine_detection_url. Default: POST.Callbacks
ring_url parameters
ring_url parameters
| Parameter | Type | Description |
|---|---|---|
From | string | The from number used as the caller ID. |
To | string | The destination that’s called. |
RequestUUID | string | Unique identifier for the request. |
CallUUID | string | The identifier of the call. |
Direction | string | The direction of the call (outbound). |
Event | string | Event that triggered this notification (Ring). |
CallStatus | string | Status of the call (ringing). |
SessionStart | string | Timestamp when early media started (UTC). |
STIRAttestation | string | Attestation assigned to the call by Plivo. |
answer_url / fallback_url parameters
answer_url / fallback_url parameters
| Parameter | Type | Description |
|---|---|---|
From | string | The from number used as the caller ID. |
To | string | The destination that’s called. |
CallerName | string | Name of the caller (if SIP call). |
RequestUUID | string | Unique identifier for the call. |
CallUUID | string | The identifier of the call. |
Direction | string | Direction of the call (outbound). |
Event | string | Event that triggered this notification (StartApp). |
STIRVerification | string | STIR/SHAKEN verification status. |
CallStatus | string | Status of the call (in-progress). |
SessionStart | string | Timestamp when early media started (UTC). |
hangup_url parameters
hangup_url parameters
| Parameter | Type | Description |
|---|---|---|
From | string | The from number used as the caller ID. |
To | string | The destination that’s called. |
RequestUUID | string | Unique identifier for the call. |
CallUUID | string | The identifier of the call. |
Direction | string | Direction of the call (outbound). |
Event | string | Event that triggered this notification (Hangup). |
CallStatus | string | Status of the call (completed). |
StartTime | string | Timestamp when the call was initiated. |
AnswerTime | string | Timestamp when the call was answered. |
EndTime | string | Timestamp when the call ended. |
Response
Retrieve a Call
Get the call detail record (CDR) of a specific call.Arguments
No arguments required.Response
List All Calls
Retrieve details of all completed calls. Maximum 20 results per request.Arguments
Filter by the number from which calls were made.
Filter by the destination number of the call.
Filter by direction. Values:
inbound, outbound.Filter by billed duration. Supports variants:
bill_duration__gt, bill_duration__gte, bill_duration__lt, bill_duration__lte.Filter by end time. Format:
YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. Supports variants: end_time__gt, end_time__gte, end_time__lt, end_time__lte.Filter by hangup cause code.
Filter by hangup source. Values:
customer, carrier, zentrunk.Filter by STIR/SHAKEN status. Values:
Verified, Not Verified, Not Applicable.Number of results to return. Max: 20. Default: 20.
Number of items to skip for pagination.
Only calls from the last 90 days can be retrieved. If no
end_time filter is specified, Plivo searches the last 7 days. The maximum search range is 30 days.Response
Retrieve a Live Call
Get details of a specific ongoing call.Response
List All Live Calls
Retrieve IDs of all ongoing calls.Response
List All Queued Calls
Retrieve IDs of all queued calls. Maximum 20 results per request.Response
Hang Up a Call
Hang up an ongoing call or cancel a queued outbound call.If
call_uuid is not specified, all ongoing calls in the account will be disconnected.Response
Transfer a Call
Transfer an in-progress call to fetch and execute XML from a different URL. This enables you to change call behavior asynchronously—for example, to play music while a call is on hold, queue calls, or transfer calls.Arguments
Which leg(s) to transfer. Values:
aleg, bleg, both.URL to fetch XML from for the A leg. Required if
legs is aleg or both.HTTP verb for
aleg_url. Default: POST.URL to fetch XML from for the B leg. Required if
legs is bleg or both.HTTP verb for
bleg_url. Default: POST.Response
Record a Call
- Start Recording
- Stop Recording
Start recording an active call.
Arguments
Max recording duration in seconds. Default:
60.Recording format. Values:
mp3, wav. Default: mp3.Set to
auto for automated transcription.URL to receive transcription results.
URL invoked when recording ends.
HTTP verb for
callback_url. Default: POST.Recording channel. Values:
mono, stereo. Default: mono.Transcription is available only in English and limited to calls with duration greater than 500ms and less than 4 hours, with file size under 2GB.
Callback URL parameters
Callback URL parameters
| Parameter | Type | Description |
|---|---|---|
api_id | string | The API ID returned by the Record API. |
record_url | string | URL where the recorded file can be accessed. |
call_uuid | string | The call UUID of the recorded call. |
recording_id | string | The recording ID. |
recording_duration | integer | Recording duration in seconds. |
recording_duration_ms | integer | Recording duration in milliseconds. |
recording_start_ms | integer | Start time of recording (epoch ms). |
recording_end_ms | integer | End time of recording (epoch ms). |
Response
Play Audio
- Start Playing
- Stop Playing
Play an audio file during an active call. Supports
.mp3 and .wav files.Arguments
URL or comma-separated URLs to
.mp3 or .wav files.Max playback length in seconds.
Call leg to play audio. Values:
aleg, bleg, both. Default: aleg.If
true, audio plays indefinitely. Default: false.If
true, call and audio are mixed. If false, participants can’t hear each other during playback. Default: true.Response
Speak Text
- Start Speaking
- Stop Speaking
Speak text during an active call using text-to-speech.
Arguments
Text to be spoken.
Voice type. Values:
MAN, WOMAN. Default: WOMAN.Language code. Default:
en-US.Call leg. Values:
aleg, bleg, both. Default: aleg.If
true, text repeats until stopped. Default: false.If
true, call and speech are mixed. Default: true.Supported Languages
Supported Languages
| Language | Code | Available Voices |
|---|---|---|
| Arabic | arb | WOMAN only |
| Chinese Mandarin | cmn-CN | WOMAN only |
| Danish (Denmark) | da-DK | WOMAN, MAN |
| Dutch (Netherlands) | nl-NL | WOMAN, MAN |
| English (Australia) | en-AU | WOMAN, MAN |
| English (India) | en-IN | WOMAN only |
| English (UK) | en-GB | WOMAN, MAN |
| English (US) | en-US | WOMAN, MAN |
| French (Canada) | fr-CA | WOMAN only |
| French (France) | fr-FR | WOMAN, MAN |
| German (Germany) | de-DE | WOMAN, MAN |
| Hindi (India) | hi-IN | WOMAN only |
| Italian (Italy) | it-IT | WOMAN, MAN |
| Japanese (Japan) | ja-JP | WOMAN, MAN |
| Korean (South Korea) | ko-KR | WOMAN only |
| Portuguese (Brazil) | pt-BR | WOMAN, MAN |
| Portuguese (Portugal) | pt-PT | WOMAN, MAN |
| Russian (Russia) | ru-RU | WOMAN, MAN |
| Spanish (Mexico) | es-MX | WOMAN only |
| Spanish (Spain) | es-ES | WOMAN, MAN |
| Spanish (US) | es-US | WOMAN, MAN |
Response
Send DTMF
Send DTMF digits on an active call. Use this to programmatically navigate external IVR systems or interact with automated phone menus.Common Use Cases
- Navigate external IVRs: When your call connects to a bank, support line, or other automated system that prompts “Press 1 for sales, 2 for support…”
- Enter PINs or account numbers: Automatically input credentials when connecting to voicemail or secure systems
- Automated testing: Test your own IVR flows programmatically
Arguments
Digits to send over the call.
Call leg to send DTMF. Values:
aleg, bleg. Default: aleg.- aleg: The first party (caller). Use when sending digits to an outbound call you initiated.
- bleg: The second party (callee). Use when sending digits to a call connected via
<Dial>.