Get the recording of a call
Это содержимое пока не доступно на вашем языке.
getCallRecording returns the MP3 recording of a call together with a few details of the call. Use it to fetch recordings into a CRM, a mobile app or an archive, or call it with include_data set to False to check whether a recording exists before you download it. Calls are recorded only when they pass through the recording media relay; see Set up call recording.
Any customer may call it. The root customer gets the recording of any call; other customers only of calls made by their own accounts or by their direct sub-customers. The method supports trusted mode with i_customer. It reads from the database replica, so a call that ended a few seconds ago may not be found yet.
Parameters
Section titled “Parameters”Send one of the four IDs. Use i_call when you have it; the others are looked up to find the call.
| Name | Type | Required | Description |
|---|---|---|---|
i_call |
int | one of | ID of the call, for example from searchCalls |
i_cdr |
int | one of | ID of the account record of the call, for example from getAccountCDRs |
i_cdrs_connection |
int | one of | ID of a vendor record of the call |
i_cdrs_customer |
int | one of | ID of a customer record of the call, for example from getCustomerCDRs |
include_data |
boolean | no | Default True. False returns the details only, without the MP3 |
When you send several IDs, a valid i_call wins; otherwise the IDs are tried in the order of the table and the first one that finds a call is used.
Returns
Section titled “Returns”The response has no result field.
| Name | Type | Description |
|---|---|---|
i_call |
int | ID of the call |
call_id |
string | SIP Call-ID of the call |
media_ip |
string | Address of the media server that holds the recording |
setup_time |
string | Setup time of the call, for example 2026-01-15 13:42:07 |
cli, cld |
string | The numbers of the call |
size |
int | Size of mp3_data in bytes; 0 with include_data set to False |
mp3_data |
base64 | The MP3 file. Missing with include_data set to False |
mp3_data is an XML-RPC base64 value: the raw bytes of the MP3 file, base64-encoded on the wire. The call() helper from the overview decodes it for you and returns bytes, so you write it to a file as it is.
Example
Section titled “Example”Check that the call has a recording, then save it:
info = call("getCallRecording", {"i_call": 8812345, "include_data": False})print(info["call_id"], info["setup_time"])
rec = call("getCallRecording", {"i_call": 8812345})with open(f"call-{rec['i_call']}.mp3", "wb") as f: f.write(rec["mp3_data"]) # bytes, already decodedprint(rec["size"], "bytes saved"){ "i_call": 8812345, "call_id": "5f0c2a91e7b34d18@192.0.2.10", "media_ip": "192.0.2.50", "setup_time": "2026-01-15 13:42:07", "cli": "442071234567", "cld": "442079460000", "size": 420864, "mp3_data": b"ID3\x04\x00...", # 420864 bytes}With a client that does not decode base64 values, such as plain xmlrpc.client.ServerProxy, mp3_data arrives as an xmlrpc.client.Binary; write rec["mp3_data"].data instead.
Errors
Section titled “Errors”| faultCode | faultString | Cause |
|---|---|---|
402 |
Must provide i_call, i_cdr, i_cdrs_connection or i_cdrs_customer. |
No ID was sent, or none of the IDs sent finds a call |
404 |
Recording not found or access denied. |
The call has no recording, or it belongs to none of your accounts and sub-customers. The two cases are not told apart on purpose |
500 |
Invalid media_ip metadata: <value>, Invalid call_id metadata: <value> |
The call record holds an address or Call-ID that cannot be used to fetch the file. Contact FlySIP support |
502 |
Media server returned HTTP <code>, Media server HTTP <code>: <reason>, Cannot fetch recording: <reason> |
The media server does not have the file, is unreachable or did not answer in 30 seconds |
Related
Section titled “Related”- Set up call recording
- Call records (CDRs): Play recording in the call records
- Search calls and explain a call:
has_recordingshows which calls have a recording