Suggestions

close search

Record calls

The workflow to create a recording is:

  1. Use the record SCCO action to record an active Call (app-to-phone, phone-to-app, phone-to-phone)
[
{
  "action": "record",
  "eventUrl": "https://example.com/recording",
  "format": "mp3",
},
{
  "action": "connect",
  "eventUrl": ["https://example.com/events"],

  "from": {
    "type": "internal",
    "number": "phone_number_1",
    "alias": "phone_number_1"
  },

  "to": {
    "type": "external", 
    "number": "phone_number_2", 
    "alias": "phone_number_2",
  }
}]

By default audio is recorded in mp3 format. Options are: mp3, wav

  1. When the Call is complete, information about the recording is sent to the webhook URL you set in the eventUrl option.
{
    "start_time": "1522657810286",
    "end_time": "1522657821413",
    "recording_url": "https://api.stringee.com/v1/call/recording/call-vn-1-7J19KD86GD-1522657804684",
    "call_id": "call-vn-1-7J19KD86GD-1522657804684",
    "project_id": 25,
    "type": "recording",
    "recordMessage": false
}
  1. Make a GET request using your JWT for authentication in order to retrieve the recording from recording_url.
<?php
// This will use the Stringee client library 
include_once './StringeeApi/StringeeCurlClient.php';
// 
$keySid = 'YOUR_KEYSID';
$keySecret = 'YOUR_KEYSECRET';

$curlClient = new StringeeCurlClient($keySid, $keySecret);
// the recording_url parameter from the recording event
$recording = 'RECORDING_URL'; 

$res = $curlClient->get($recording,15);
$content = $res->getContent();

header('Content-Type: Content-Type: application/octet-stream');
header("Content-disposition: attachment; filename=recoding.wav"); 
echo $content;

or

curl RECORDING_URL  -H "X-STRINGEE-AUTH: ACCESS_TOKEN" -H "Content-Type: application/json" --output record.mp3

Note: After your recording is complete, it is stored by Stringee for 30 days.