API : PBX : Audio Get
Introduction
Audios can be played back to a caller. An audio item consists of metadata (name, length, owner) and a link to the audio on the audio servers.
This request will return the the specified audio (metadata, not the actual audio).
Request
| URL | https://api.telecomx.dk/pbx/audio/AUDIO_ID |
| Method | GET |
| Access level | PERSONAL, VIEWER, MANAGER, OWNER, RESELLER, ADMIN. |
| Param | AUDIO_ID | Id of the audio (24 hex-char string). |
| Query | links | [optional] True to add playback links to each item for all the available audio versions. |
| expand | [optional] True to expand usedBy id's into _id/type/number/name objects. |
Query example
https://api.telecomx.dk/pbx/audio/1234567890ABCDEF12345678
https://api.telecomx.dk/pbx/audio/1234567890ABCDEF12345678?links=true&expand=true
Response
| Json object |
| _id | Id | Unique ID of the audio. |
| usedBy | Array | Array of Id's of dialplan items that uses the audio. |
| name | String | Human readable name of the audio. |
| length | Number | Length of the audio in seconds. |
| employee | Id | Optional id of employee audio belongs to and can only be used/seen by. |
Note that properties holding no value may be omitted from the object.
Example
{
_id: '1234567890123457890ABCD',
usedBy: ['123457890123457890AAAA','12345678901234567890AAAB'],
name: 'Welcome greeting 08:00-12:00',
length: 15,
employee: null
}
Example - links=true
{
_id: '1234567890123457890ABCD',
usedBy: ['123457890123457890AAAA','12345678901234567890AAAB'],
name: 'Welcome greeting 08:00-12:00',
length: 15,
employee: null,
mp3: 'https://audio.telecomx.dk/12345678901234567890ABCD.mp3?token=789789789456456123121564',
wav: 'https://audio.telecomx.dk/12345678901234567890ABCD.wav?token=789789789456456123121564',
alaw: 'https://audio.telecomx.dk/12345678901234567890ABCD.alaw?token=789789789456456123121564',
ulaw: 'https://audio.telecomx.dk/12345678901234567890ABCD?.ulawtoken=789789789456456123121564',
gsm: 'https://audio.telecomx.dk/12345678901234567890ABCD.gsm?token=789789789456456123121564',
m4a: 'https://audio.telecomx.dk/12345678901234567890ABCD,m4a?token=789789789456456123121564',
sln16: 'https://audio.telecomx.dk/12345678901234567890ABCD.sln16?token=789789789456456123121564',
highmp3: 'https://audio.telecomx.dk/12345678901234567890ABCD.high.mp3?token=789789789456456123121564',
lowmp3: 'https://audio.telecomx.dk/12345678901234567890ABCD.low.mp3?token=789789789456456123121564',
g722: 'https://audio.telecomx.dk/12345678901234567890ABCD.g722?token=789789789456456123121564'
Example- expand=true
{
_id: '1234567890123457890ABCD',
usedBy: [
{
_id: '123457890123457890AAAA',
type: 'EXTENSION',
number: '201',
name: 'Donald Duck'
},
{
_id: '12345678901234567890AAAB',
type: 'QUEUE',
number: '410',
name: 'Support queue'
}
],
name: 'Welcome greeting 08:00-12:00',
length: 15,
employee: null
}
Playback of audio files
Audio files can be played back by composing a url like this:
https://audio.telecomx.dk/<AUDIO-ID><SUFFIX>?token=<TOKEN>
https://audio.telecomx.dk/<AUDIO-ID>/<FILENAME><SUFFIX>?token=<TOKEN>
| Property | Description |
| AUDIO-ID | Id of the audio item (_id). |
| SUFFIX | Format to get the file in - see list below. |
| FILENAME | To enforce download instead of browser playback, supply a filename. |
| TOKEN | Current users token see login page. |
| Suffix | Description |
| alaw | 64Kbit 8KHz A-Law raw mono |
| ulaw | 64Kbit 8KHz Mu-LAw raw mono |
| mp3 | 128Kbit MP3 mono/stereo |
| wav | 8-256Kbit Microsoft wave mono/stereo |
| gsm | 13Kbit 8KHz GSM mono |
| m4a | 128Kbit Apple AAC in m4a container mono/stereo |
| sln16 | 16Kbit wideband signed linear mono |
| high.mp3 | 256Kbit MP3 mono/stereo |
| low.mp3 | 8Kbit MP3 mono |
| g722 | 16Kbit wideband mono |
Errors
| Error code | Message | Description |
| 403 | access_denied | Insufficient access level |
| 404 | id | Audio not found |
| 500 | internal_error | <Unspecified> |