Call Recordings

These endpoints give access to the call recordings of your account: browse them as a hierarchy (year / month / day / direction), download or delete individual recordings, retrieve a recording directly from a call id received in a callback, and pause the recording in the middle of a call. To find the calls matching a recording file name, see the CDR section.

Get recordings list

This endpoint allows you to get a list of your call recordings and their duration in seconds (or null for directories). The recordings are listed by year, month, day, call direction.

The legacy behaviour of that endpoint (when you request without any header) is to give you the list formatted in HTML. Using that HTML view, you can use your browser to access the recordings or you can use a web crawler like wget and download all your recordings in a batch.

GET https://api.ubity.com/recordings

Parameter Description
key Your Ubity API key
# Using the wget

wget -r -np -c "https://api.ubity.com/recordings?key=KKKK"

# Example using headers
curl -H "Accept: application/json;version=0" "https://api.ubity.com/recordings?key=KKKK"
{
  "api_key": "KKKK",
  "code": 200,
  "diagnostic": "Success",
  "names": [
    [
      "https://api.ubity.com/recordings/2017?key=KKKK",
      "2017",
      null
    ],
    [
      "https://api.ubity.com/recordings/2018?key=KKKK",
      "2018",
      null
    ]
  ],
  "stamp": "2018-02-15 11:27",
  "title": "",
  "url": "https://api.ubity.com/recordings?key=KKKK",
  "version": 0
}
# Using headers and specific day and direction
% curl -H "Accept: application/json;version=0" "https://api.ubity.com/recordings/2018/02/15/out?key=KKKK"
{
  "api_key": "KKKK",
  "code": 200,
  "diagnostic": "Success",
  "names": [
    [
      "https://api.ubity.com/recordings/2018/02/15/out/42_20180215105055_15551112222_vgw99-1518709855.9602776.mp3?key=KKKK",
      "42_20180215105055_15551112222_vgw99-1518709855.9602776.mp3",
      123
    ],
    [
      "https://api.ubity.com/recordings/2018/02/15/out/43_20180215105055_15551113333_vgw99-1518709855.9602776.mp3?key=KKKK",
      "43_20180215105055_15551113333_vgw99-1518709855.9602776.mp3",
      456
    ],
  ],
  "stamp": "2018-02-15 11:31",
  "title": "2018/02/15/out",
  "url": "https://api.ubity.com/recordings/2018/02/15/out?key=KKKK",
  "version": 0
}

Get one recording from that list

You can just follow the URL available in the list. (headers are not needed)

curl "https://api.ubity.com/recordings/2018/02/15/out/43_20180215105055_15551113333_vgw99-1518709855.9602776.mp3?key=KKKK" --output recording.mp3

Delete one recording from that list

You can just follow the URL available in the list. (headers are not needed), and use the method DELETE.

curl -X DELETE "https://api.ubity.com/recordings/2018/02/15/out/43_20180215105055_15551113333_vgw99-1518709855.9602776.mp3?key=KKKK"

Get a specific call recording from an ID

In some cases, you would want to download a recording from an ID received from a callback. This endpoint allows your application to retrieve the recording of a specific call using its callid. The response is the actual MP3 file, with a Content-Type: audio/mpeg header.

GET https://api.ubity.com/recording

Parameter Description
key Your Ubity API key
callid The call's unique identifier string
curl "https://api.ubity.com/recording?key=KKKK&callid=vgw99-9518705130.2593504" --output recording.mp3

Delete a specific call recording from an ID

In some cases, you would want to delete a recording from an ID received from a callback. This endpoint allows your application to delete the recording of a specific call using its callid.

DELETE https://api.ubity.com/recording

Parameter Description
key Your Ubity API key
callid The call's unique identifier string
curl -X DELETE "https://api.ubity.com/recording?key=KKKK&callid=vgw99-9518705130.2593504"

Check if a call recording actually exists

Your application might want to know if a call recording exists before exposing it to the user (eg: if it's a web application). This endpoint allows your application to tell if a recording exists for a specific call.

GET https://api.ubity.com/recording_exists

Parameter Description
key Your Ubity API key
callid The call's unique identifier string
curl -H "Accept: application/json;version=0" "https://api.ubity.com/recording_exists?key=KKKK&callid=vgw99-9518705130.2593504"
{
  "api_key": "KKKK",
  "code": 200,
  "diagnostic": "Success",
  "exists": true,
  "mode": "normal",
  "stamp": "2018-02-15 12:03",
  "url": "https://api.ubity.com/recording_exists?key=KKKK&callid=vgw99-9518705130.2593504",
  "version": 0
}

Pause recording while on call

You may want to pause recording while on call temporarily (for example when somebody is about to say their credit card number).

GET https://api.ubity.com/pause_recording

Parameter Description
key Your Ubity API key
extension extension with an active call
state 1 for pause 0 for unpause

Tested scenarios are:

  • Incoming call to extension
  • Outgoing call from extension
  • Blind or assisted transfer to extension
curl -H "Accept: application/json;version=0" "https://api.ubity.com/pause_recording?key=KKKK&extension=42&state=1"
{
  "api_key": "KKKK",
  "code": 200,
  "details": {
    "SIP/xxxxxxx-xxxxxxx": {
      "reason": "",
      "success": true
    }
  },
  "diagnostic": "Success",
  "mode": "normal",
  "stamp": "2018-09-26 09:03",
  "url": "https://api.ubity.com/pause_recording?key=KKKK&extension=42&state=1",
  "version": 0
}%