Get call history
Overview
To get the call history for the account, make the GET request to /accounts/{accountSID}/calls.
The results can be narrowed by specifying filtering parameters.
Request example
The following example demonstrates getting call logs.
curl –X GET https://api.apifonica.com/v2/accounts/{accountSID}/calls \ -u {accountSID}:{authToken}
Response example
{ "limit": 20, "prev": null, "next": "https://api.apifonica.com/v2/accounts/{accountSID}/calls?next=4771", "calls": [ { "call_sid": "{callSID}", "parent_call_sid": "{callSID}", "created": "Fri, 21 Apr 2017 13:01:25 +0000", "account_sid": "{accountSID}", "from": "358942417543", "to": "442038075273", "direction": "outbound", "status": "completed", "controller": "https://www.apifonica.com/maketestcall.xml", "method": "GET", "timeout": 15, "updated": "Fri, 21 Apr 2017 13:02:02 +0000", "started": "Fri, 21 Apr 2017 13:01:37 +0000", "ended": "Fri, 21 Apr 2017 13:01:43 +0000", "duration": 18, "price": 0.0294 "record_sid": "rec23ed4a82-b7ee-31ff-b8dc-c89ea90d6d82", "tag": "MyClient_1" "channel": "number" }, … ] }
Response parameters
Parameter |
Description |
limit |
A parameter describing how many records are returned per page. The default and maximum value is 20. |
prev |
URI to the previous page. |
next |
URI to the next page. |
calls |
A list of calls. |
calls/call_sid |
Call identifier. |
calls/parent_call_sid |
Identifier of the parent call leg |
calls/created |
Call creation date. 'dateFormat' => '"Thu, 07 Jul 2016 10:15:53 +0000"' |
calls/account_sid |
Account identifier. |
calls/from |
Caller’s phone number. |
calls/to |
Recipient’s phone number. |
calls/direction |
Call direction. Either inbound or outbound. |
calls/status |
Call status. One of the following: queued, initiated, ringing, answered, completed, no_answer, busy, rejected, failed, modified See the Call Status section for more details |
calls/controller |
URL which used to make a request for an XML controller file. |
calls/method |
Method used to make a request. |
calls/timeout |
The number of seconds to wait for the answer of the "to" number. Important! The period starts when you send the request to API |
calls/updated |
Updated date. |
calls/started |
Call begin date and time. 'dateFormat' => '"Thu, 07 Jul 2016 10:15:53 +0000"' |
calls/ended |
Call end date and time. 'dateFormat' => '"Thu, 07 Jul 2016 10:15:53 +0000"' |
calls/duration |
Duration of the call in seconds. |
calls/price |
Cost of the call in EURO cents. |
calls/record_sid |
System identifier associated with the record file. Notice: call status "completed" does not indicate that the recording is ready for downloading. It will be ready after record_sid is available. |
calls/tag |
Optional string field; can be used for custom filtering of the calls |
calls/channel |
The call channel. The possible values are "number" (for calling on local/mobile/SIP numbers), "viber" (for calling on Viber). |
Description |
A parameter describing how many records are returned per page. The default and maximum value is 20. |
Description |
URI to the next page. |
Description |
URI to the previous page. |
Description |
A list of calls. |
Description |
Call identifier. |
Description |
Call creation date. |
Description |
Account identifier. |
Description |
Recipient’s phone number. |
Description |
Caller’s phone number. |
Description |
Call direction. Either inbound or outbound. |
Description |
Call status. One of the following: queued, initiated, ringing, answered, completed, no_answer, busy, rejected, failed, modified. |
Description |
URL which used to make a request for an XML controller file. |
Description |
Method used to make a request. |
Description |
The number of seconds to wait for the answer of the "to" number. Important! The period starts when you send the request to API. |
Description |
Updated date. |
Description |
Call begin date and time. |
Description |
Call end date and time. |
Description |
Duration of the call in seconds. |
Description |
Cost of the call in USD cents. |
Description |
System identifier associated with the record file. Notice: call status "completed" does not indicate that the recording is ready for downloading. It will be ready after record_sid is available. |
Description |
Optional string field; can be used for custom filtering of the calls |
Description |
The call channel. The possible values are "number" (for calling on local/mobile/SIP numbers), "viber" (for calling on Viber). |
Response filtering
To narrow the response results, specify filtering parameters in the GET request.
Request example (with filtering)
The following curl request demonstrates getting a list of completed outbound calls.
curl –X GET https://api.apifonica.com/v2/accounts/{accountSID}/calls?direction=outbound&status=completed \ -u {accountSID}:{authToken}
Filtering parameters
Parameter |
Description |
limit |
A parameter describing how many records you want to return per page. The default and maximum value is 20. |
prev |
URI to the previous page. |
next |
URI to the next page. |
call_sid |
Call identifier. |
created_after |
Calls that were created after this date and time. 'dateFormat' => 'yyyy-mm-dd' |
created_before |
Calls that were created before this date and time. 'dateFormat' => 'yyyy-mm-dd' |
account_sid |
Account identifier. |
to |
Recipient’s phone number. |
from |
Caller’s phone number. |
direction |
Call direction. Either inbound or outbound. |
status |
Call status. One of the following: queued, initiated, ringing, answered, completed, no_answer, busy, rejected, failed, modified. |
tag |
Optional string field; can be used for custom filtering of the calls |
channel |
The call channel. The possible values are "number" (for calling on local/mobile/SIP numbers), "viber" (for calling on Viber) |
Description |
A parameter describing how many records you want to return per page. The default and maximum value is 20. |
Description |
URI to the previous page. |
Description |
URI to the next page. |
Description |
Call identifier. |
Description |
Calls that were created after this date and time. |
Description |
Calls that were created before this date and time. |
Description |
Account identifier. |
Description |
Recipient’s phone number. |
Description |
Caller’s phone number. |
Description |
Call direction. Either inbound or outbound. |
Description |
Call status. One of the following: queued, initiated, ringing, answered, completed, no_answer, busy, rejected, failed, modified. |
Description |
Optional string field; can be used for custom filtering of the calls |
Description |
number or viber |
Call Status
Call events online statuses.
Please note, that not of all these statuses can be catched by GET request
Parameter |
Description |
queued |
The call is ready and waiting in line before going out. |
initiated |
The call has been started |
ringing |
The call is currently ringing to the number "to". |
answered |
The call was answered and is currently in progress. |
completed |
The call was answered and has ended normally. |
no_answer |
The call ended without being answered. |
busy |
The caller received a busy signal. |
rejected |
The call was canceled while queued or ringing. |
failed |
The call could not be completed as dialed, most likely because the phone number was non-existent |
modified |
The call was modified by API function Modify live call |
Description |
The call is ready and waiting in line before going out. |
Description |
The call has been started |
Description |
The call is currently ringing to the number "to". |
Description |
The call was answered and is currently in progress. |
Description |
The call was answered and has ended normally. |
Description |
The call ended without being answered. |
Description |
The caller received a busy signal. |
Description |
The call was canceled while queued or ringing. |
Description |
The call could not be completed as dialed, most likely because the phone number was non-existent |
Description |
The call was modified by API function Modify live call. |