import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')

response = client.calls.list(
    limit=5,
    offset=0, )
print(response)
{
"api_id": "8299d094-dc72-11e5-b56c-22000ae90795",
"meta": {
"limit": 20,
"next": null,
"offset": 0,
"previous": null,
"total_count": 4
},
"objects": [
{
    "answer_time": "2022-10-12 21:57:47+05:30",
    "api_id": "52cd2e1d-2bfd-11ec-a7bd-0242ac110005",
    "bill_duration": 1,
    "billed_duration": 1,
    "call_direction": "outbound",
    "call_duration": 1,
    "call_state": "ANSWER",
    "call_uuid": "5607532d-5037-4066-befc-a8b40218dd4f",
    "conference_uuid": null,
    "end_time": "2022-10-12 21:57:47+05:30",
    "from_number": "+12025551111",
    "hangup_cause_code": 8011,
    "hangup_cause_name": "Invalid Answer XML",
    "hangup_source": "Error",
    "initiation_time": "2022-10-12 21:57:40+05:30",
    "parent_call_uuid": null,
    "resource_uri": "/v1/Account/MA2025RK4E639VJFZAGV/Call/5607532d-5037-4066-befc-a8b40218dd4f/",
    "stir_verification": "Not Applicable",
    "to_number": "sip:sam9461399937766203278@phone.plivo.com",
    "total_amount": "0.01667",
    "total_rate": "1.00000",
    "Stir_attestation":"A",
    "voice_network_group": "",
    "source_ip": "92.168.0.1"
},
{
    "answer_time": "2022-10-12 21:57:47+05:30",
    "api_id": "52cd2e1d-2bfd-11ec-a7bd-0242ac110005",
    "bill_duration": 1,
    "billed_duration": 1,
    "call_direction": "outbound",
    "call_duration": 1,
    "call_state": "ANSWER",
    "call_uuid": "5607532d-5037-4066-befc-a8b40218dd4f",
    "conference_uuid": null,
    "end_time": "2022-10-12 21:57:47+05:30",
    "from_number": "+12025551111",
    "hangup_cause_code": 8011,
    "hangup_cause_name": "Invalid Answer XML",
    "hangup_source": "Error",
    "initiation_time": "2022-10-12 21:57:40+05:30",
    "parent_call_uuid": null,
    "resource_uri": "/v1/Account/MA2025RK4E639VJFZAGV/Call/5607532d-5037-4066-befc-a8b40218dd4f/",
    "stir_verification": "Not Applicable",
    "to_number": "sip:sam9461399937766203278@phone.plivo.com",
    "total_amount": "0.01667",
    "total_rate": "1.00000",
    "Stir_attestation":"A",
    "voice_network_group": "",
    "source_ip": "92.168.0.1"
}
]
}

This method lets you retrieve details of all completed calls. The maximum number of results that you can fetch with a single API call is 20.

API Endpoint

GET
https://api.plivo.com/v1/Account/{auth_id}/Zentrunk/Call/

Arguments

All of these optional arguments let you filter which calls you retrieve details for.

Column NameDescription
from_numberThe number from which the calls were made. You can filter by the exact number or prefix.
to_numberThe destination number of the call. You can filter by the exact number or prefix.
call_directionDirection of the call.
Allowed values: inbound, outbound.
bill_durationBilled duration of the call in seconds. Can be filtered with:
bill_duration, bill_duration__gt, bill_duration__gte, bill_duration__lt, bill_duration__lte.
end_timeTimestamp when the call ended. Accepts format: YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. Can be filtered with:
end_time, end_time__gt, end_time__gte, end_time__lt, end_time__lte.
hangup_cause_codeHangup cause code used to filter calls. See the list of hangup causes.
hangup_sourceSource that caused the hangup.
Allowed values: customer, carrier, zentrunk.
limitLimits the number of returned results. Maximum is 20.
Default: 20.
offsetNumber of items to skip before returning results. Used for pagination.
stir_verificationIndicates STIR/SHAKEN verification status.
Allowed values:
- Verified: Caller ID verified (Attestation A)
- Not Verified: Uncertain/Not verified (Attestation B or C)
- Not Applicable: STIR/SHAKEN not applicable (e.g. non-US calls).

Calls made only in the last 90-days can be retrieved via APIs.

You can combine these filters to get call detail records that were added during a particular time range.

If you don’t use the end_time filter when you search, Plivo uses a search window of the last seven days from the current date. Alternatively, you can use end_time__[lt|lte] and end_time__[gt|gte] to search a range of times for CDRs of up to 30 days of search boundary. If the provided range exceeds the 30-day boundary, the API will return a 400 response code, signaling an error.

Timestamp values need to be specified as UTC.

Returns

Returns the call objects that match the filters specified in the request.

import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')

response = client.calls.list(
    limit=5,
    offset=0, )
print(response)
{
"api_id": "8299d094-dc72-11e5-b56c-22000ae90795",
"meta": {
"limit": 20,
"next": null,
"offset": 0,
"previous": null,
"total_count": 4
},
"objects": [
{
    "answer_time": "2022-10-12 21:57:47+05:30",
    "api_id": "52cd2e1d-2bfd-11ec-a7bd-0242ac110005",
    "bill_duration": 1,
    "billed_duration": 1,
    "call_direction": "outbound",
    "call_duration": 1,
    "call_state": "ANSWER",
    "call_uuid": "5607532d-5037-4066-befc-a8b40218dd4f",
    "conference_uuid": null,
    "end_time": "2022-10-12 21:57:47+05:30",
    "from_number": "+12025551111",
    "hangup_cause_code": 8011,
    "hangup_cause_name": "Invalid Answer XML",
    "hangup_source": "Error",
    "initiation_time": "2022-10-12 21:57:40+05:30",
    "parent_call_uuid": null,
    "resource_uri": "/v1/Account/MA2025RK4E639VJFZAGV/Call/5607532d-5037-4066-befc-a8b40218dd4f/",
    "stir_verification": "Not Applicable",
    "to_number": "sip:sam9461399937766203278@phone.plivo.com",
    "total_amount": "0.01667",
    "total_rate": "1.00000",
    "Stir_attestation":"A",
    "voice_network_group": "",
    "source_ip": "92.168.0.1"
},
{
    "answer_time": "2022-10-12 21:57:47+05:30",
    "api_id": "52cd2e1d-2bfd-11ec-a7bd-0242ac110005",
    "bill_duration": 1,
    "billed_duration": 1,
    "call_direction": "outbound",
    "call_duration": 1,
    "call_state": "ANSWER",
    "call_uuid": "5607532d-5037-4066-befc-a8b40218dd4f",
    "conference_uuid": null,
    "end_time": "2022-10-12 21:57:47+05:30",
    "from_number": "+12025551111",
    "hangup_cause_code": 8011,
    "hangup_cause_name": "Invalid Answer XML",
    "hangup_source": "Error",
    "initiation_time": "2022-10-12 21:57:40+05:30",
    "parent_call_uuid": null,
    "resource_uri": "/v1/Account/MA2025RK4E639VJFZAGV/Call/5607532d-5037-4066-befc-a8b40218dd4f/",
    "stir_verification": "Not Applicable",
    "to_number": "sip:sam9461399937766203278@phone.plivo.com",
    "total_amount": "0.01667",
    "total_rate": "1.00000",
    "Stir_attestation":"A",
    "voice_network_group": "",
    "source_ip": "92.168.0.1"
}
]
}