Call Recording Extraction API
GET Method
Kaleyra.io offers an API to download and extract the call recording from the detailed report available in the Kaleyra platform. These recordings get generated during the voice call and stored in the cloud (Amazon S3 bucket).
To extract the call recording you have to generate the report with the recording details from the Kaleyra platform and then extract the recording through API.
Extracting the recording
To extract the recording, perform the following steps:
Request Format
You can obtain the recording ID of the recording you want to access/download from the report using the steps in Generating the Report with the Recording Details.
Base URL
<https://api.kaleyra.io/v1/><SID>
To extract the recording, use the following voice/recordings endpoint.
curl -X POST '<URL>/v1/{}SID/voice/recordings?id={{id}}' \
-H 'Content-Type: <CONTENT_TYPE>' \
-H 'api-key: <API_KEY>' \
-d 'id=<RECORDING_ID>' \
-d 'validity=<VALIDITY>' \
-d 'download=<DOWNLOAD>'
Provide the details listed in the Parameters and Variable section.
Parameters and Data Types
Following is the list of parameters and data types supported:
Parameter | Data Types | Description | Example | Mandatory |
---|---|---|---|---|
SID | String | Account SID (Security Identifier). | HXXXXXXX071US | True |
CONTENT_TYPE | String | The format in which the data is sent. | application/x-www-form-urlencoded | True |
API_KEY | Alphanumeric | API key generated from Kaleyra.io account. | Axxxxxxxxxxxxx3 | True |
RECORDING_ID | UTF8 string | Unique ID for each recorded call. | 1xxxxx8axxxxgiu587== | True |
VALIDITY | Numeric | Resource validity in minutes, applicable to the link resulted over API response. Example - If validity is set as 10, the link accessed at 10:00 AM using the API will remain valid till 10:10 AM. The default validity time is 5 minutes | 60 | False |
DOWNLOAD | Numeric | Flag to control the downloaded resource as follows: 1 - Redirects the API request to the signed AWS link with 301 status. 0 - JSON response containing singed AWS link. | 0 | False |
Response Format
This section provides you with the success and failure JSON response format for different scenarios. Refer to the below sections for more information:
Sample Success Response
Basic successful response with id, validity, and no download flag
{
"code": "RBC3XXX",
"message": "Request successfully executed!",
"data": {
"link": "http://aws.s3.com/xyz/link/limited/to/5/minutes"
},
"error": {}
}
Basic successful response with id, validity, and download flag, redirects you to resource link with MP3/WAV file. The successful response contains an Amazon S3 bucket link.
Sample Failure Response
Basic call recording extraction response with an invalid ID
If your response fails due to an invalid ID, please re-execute the command providing a valid ID.
{
"code": "RBC31XX",
"message": "Invalid Id",
"data": [
"id" : "abcd1234==",
"validity" : "5",
"download" : "0"
],
"error": {
"id": "Invalid id"
}
}
When valid ID accessed after the maximum limit
Consider accessing a valid ID after 6 months. If your response fails due to exceeding the maximum limited time for a valid ID, please re-execute the command providing a valid ID within the maximum limit.
{
"code": "RBC31XX",
"message": "Id Expired",
"data": [
"id" : "abcd1234==",
"validity" : "5",
"download" : "0"
],
"error": {
"id": "Id Expired"
}
}
Sample Request
The following code is a sample request:
curl -X POST '<URL>/v1/{}SID/voice/recordings?id=1xxxxxxxx8axxxxxxxxgiu587==' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'api-key: Axxxxxxxxxxxxxxxxxxxxxxxxxxxx3aexxxxxxxx31' \
-d 'id=1xxxxxxxx8axxxxxxxxgiu587==' \
-d 'validity=10' \
-d 'download=<DOWNLOAD>'
HTTP Status Code and Response Code
For more information regarding the HTTP Status Codes and Response Codes, refer to Voice Error Codes.
Updated 11 months ago