Skip to main content
A 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

string
Unique identifier for the call.
string
Caller ID used to initiate the call.
string
Number to which the call was initiated.
string
ISO 3166-1 alpha-2 country code of the caller number. Example: US.
string
ISO 3166-1 alpha-2 country code of the destination number. Example: US.
string
Direction of the call. Values: outbound, inbound.
string
Timestamp when the call was answered. Format: yyyy-MM-dd HH:mm:ss
string
Timestamp when the call ended. Format: yyyy-MM-dd HH:mm:ss
string
Timestamp when the call was initiated. Format: yyyy-MM-dd HH:mm:ss
integer
Duration of the call in seconds.
integer
Time the call spent ringing before being answered, in seconds.
integer
The duration of the call in seconds.
integer
The billed duration of the call in seconds. May differ from bill_duration depending on the billing interval.
string
Total amount charged for the call.
string
Per-minute rate based on the destination number.
string
UUID of the A-leg of the call.
string
UUID of the conference this call was part of. null if the call did not join a conference.
string
Reason the call was hung up. See hangup causes
integer
Integer code for the hangup cause.
string
Entity that triggered the hangup. Values: Caller, Callee, Plivo, API Request, Answer XML, Error, Unknown.
string
STIR/SHAKEN attestation info. Values: Verified, Not Verified, Not Applicable. Read more
string
STIR/SHAKEN attestation level assigned to the call. Values: A, B, C. Read more
string
IP address from which the call request originated.
string
URI of the requested resource.

Example Call Object


Billing

Plivo bills for voice calls based on the answered call duration.

When Billing Starts

Understanding CDR Fields

  • bill_duration: Actual call duration in seconds
  • billed_duration: Duration rounded to billing increment (typically 60 seconds)
  • total_amount: Charge for the call based on billed_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.
See Voice Pricing for current per-minute rates.

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

string
required
Caller ID phone number in E.164 format (e.g., 14157654321).
string
required
Destination number(s) or SIP URI(s). Use < to separate multiple destinations (max 1000).
string
required
URL called when the call is answered. Must return valid Plivo XML.
string
HTTP verb for answer_url. Default: POST.
string
URL notified when the call starts ringing.
string
HTTP verb for ring_url. Default: POST.
string
URL notified when the call is hung up.
string
HTTP verb for hangup_url. Default: POST.
string
Invoked if answer_url fails after 3 retries or 60s timeout.
string
HTTP verb for fallback_url. Default: POST.
string
Sets caller name (up to 50 characters).
string
Sends DTMF digits after call is connected. Use w (0.5s wait) or W (1s wait).
boolean
If true, sends send_digits during pre-answer. Default: false.
integer
Max duration of call in seconds. Default: 14400 (4 hours).
integer
Max duration (in seconds) from start of ringing to hangup.
string
Detect machine on answer. Values: true, hangup.
integer
Time in ms to detect machine. Default: 5000. Range: 200010000.
string
Callback URL for asynchronous machine detection.
string
HTTP verb for machine_detection_url. Default: POST.
string
Custom SIP headers in key=value format, separated by commas. Headers are prefixed with X-PH- on the outbound INVITE by default. When the originating leg uses SIP authentication, headers are forwarded bare (without the X-PH- prefix). Headers with reserved prefixes (PH-, Plivo, FS-, SipAuth, ZT-, Twilio) and the name ClientRegion are silently dropped. See SIP Authentication for details.
string
SIP digest authentication username. Used when calling a SIP URI that requires authentication (the remote provider responds with 401/407 challenge). Only accepted when to is a SIP URI. Must be provided together with sip_auth_password. See SIP Authentication.
string
SIP digest authentication password. 8-128 characters, must include uppercase, lowercase, and digit. Required when sip_auth_username is provided. Credentials are never logged, never included in CDR data, and never sent to your callback URLs.
Outbound auth outcomes:
integer
Maximum time in seconds to ring the destination before timing out.
string
UUID of the parent call, used for call routing and tracking.
string
Auth ID of the parent account.
boolean
When true, returns an error if the parent call is not found. Default: false.
string
Type of call. Values: voice, whatsapp_voice. Default: voice. When set to whatsapp_voice, the call is placed as a WhatsApp voice call. See WhatsApp Calling for details.
string
Delimiter character for separating multiple destination numbers in bulk calls. Default: <.

Advanced Machine Detection Parameters

These parameters provide fine-grained control over answering machine detection behavior. They work in conjunction with the machine_detection parameter above.
integer
Maximum duration of speech in milliseconds to analyze before making a determination. Range: 10006000.
integer
Duration of initial silence in milliseconds before the call is classified. Range: 200010000.
integer
Maximum number of words to listen for before making a determination. Range: 210.
integer
Maximum duration of the initial greeting in milliseconds to analyze. Range: 10005000.
integer
Duration of silence in milliseconds after speech that indicates end of greeting. Range: 5005000.
integer
Total time in milliseconds allotted for machine detection analysis. Range: 10045000.

Callbacks

Response

string
Status of the request. Returns call fired on a successful call creation request.
string
Unique identifier for the request.
string
Unique identifier for the API request.

Retrieve a Call

Get the call detail record (CDR) of a specific call.

Arguments

No arguments required.

Response

string
Timestamp when the call was answered. Format: yyyy-MM-dd HH:mm:ss
string
Unique identifier for the API request.
integer
The duration of the call in seconds.
integer
The billed duration of the call in seconds. May differ from bill_duration depending on the billing interval.
string
Direction of the call. Values: outbound, inbound.
integer
Duration of the call in seconds.
string
Unique identifier for the call.
string
Caller ID used to initiate the call.
integer
Integer code for the hangup cause.
string
Reason the call was hung up. See hangup causes
string
Entity that triggered the hangup. Values: Caller, Callee, Plivo, API Request, Answer XML, Error, Unknown.
string
Timestamp when the call was initiated. Format: yyyy-MM-dd HH:mm:ss
string
Number to which the call was initiated.
string
Total amount charged for the call.
string
Per-minute rate based on the destination number.
string
IP address from which the call request originated.

List All Calls

Retrieve details of all completed calls. Maximum 20 results per request.

Arguments

string
Filter by the number from which calls were made.
string
Filter by the destination number of the call.
string
Filter by direction. Values: inbound, outbound.
integer
Filter by billed duration. Supports variants: bill_duration__gt, bill_duration__gte, bill_duration__lt, bill_duration__lte.
string
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.
integer
Filter by hangup cause code.
string
Filter by hangup source. Values: customer, carrier, zentrunk.
string
Filter by STIR/SHAKEN status. Values: Verified, Not Verified, Not Applicable.
integer
Number of results to return. Max: 20. Default: 20.
integer
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

string
Unique identifier for the API request.
object
Pagination metadata: limit (results per page), offset (items skipped), total_count (total matching calls).
array
Array of call objects — see The Call Object.

Retrieve a Live Call

Get details of a specific ongoing call.

Response

string
Direction of the call. Values: outbound, inbound.
string
The from number used as the caller ID.
string
Status of the call (in-progress).
string
Unique identifier for the API request.
string
The destination that’s called.
string
Name of the caller.
string
Unique identifier for the call.
string
Timestamp when early media started (UTC).

List All Live Calls

Retrieve IDs of all ongoing calls.

Response

string
Unique identifier for the API request.
array
Array of call UUIDs of all ongoing calls.

List All Queued Calls

Retrieve IDs of all queued calls. Maximum 20 results per request.

Response

string
Unique identifier for the API request.
array
Array of call UUIDs of all queued calls.

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

string
Which leg(s) to transfer. Values: aleg, bleg, both.
string
URL to fetch XML from for the A leg. Required if legs is aleg or both.
string
HTTP verb for aleg_url. Default: POST.
string
URL to fetch XML from for the B leg. Required if legs is bleg or both.
string
HTTP verb for bleg_url. Default: POST.

Response

string
Status of the request. Returns call transferred on a successful transfer.
string
Unique identifier for the API request.

Record a Call

Start recording an active call.

Arguments

integer
Max recording duration in seconds. Default: 60.
string
Recording format. Values: mp3, wav. Default: mp3.
string
Transcription type. Values: auto, hybrid, manual. Default: auto.
string
URL to receive transcription results.
string
Format of the transcription report. Values: full, compact. Default: compact.
string
URL invoked when recording ends.
string
HTTP verb for callback_url. Default: POST.
string
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.

Response

string
URL where the recorded file can be accessed.
string
Status of the request. Returns call recording started on a successful request.
string
The recording ID.
string
Unique identifier for the API request.

Play Audio

Play an audio file during an active call. Supports .mp3 and .wav files.

Arguments

string
required
URL or comma-separated URLs to .mp3 or .wav files.
integer
Max playback length in seconds.
string
Call leg to play audio. Values: aleg, bleg, both. Default: aleg.
boolean
If true, audio plays indefinitely. Default: false.
boolean
If true, call and audio are mixed. If false, participants can’t hear each other during playback. Default: true.

Response

string
Status of the request. Returns play started on a successful request.
string
Unique identifier for the API request.

Speak Text

Speak text during an active call using text-to-speech.

Arguments

string
required
Text to be spoken.
string
Voice type. Values: MAN, WOMAN. Default: WOMAN.
string
Language code. Default: en-US.
string
Call leg. Values: aleg, bleg, both. Default: aleg.
boolean
If true, text repeats until stopped. Default: false.
boolean
If true, call and speech are mixed. Default: true.

Response

string
Status of the request. Returns speak started on a successful request.
string
Unique identifier for the API request.

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

string
required
Digits to send over the call.
string
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>.

Response

string
Status of the request. Returns digits sent on a successful request.
string
Unique identifier for the API request.

Cancel a Request

Cancel a pending or in-progress API request by its UUID.
string
required
Unique identifier of the request to cancel.

Response


Call Conversion

Post conversion or feedback data for a call.

Arguments

string
Timestamp of the conversion event.
string
Conversion status.

List Live Calls (V2)

Retrieve a list of live calls with enhanced response format.
Returns a list of active calls with additional metadata compared to the V1 live calls filter.