Help Center / Developer / APIs / Call Channels
APIs
Call Channels in the API
The Channels API lists the calls that are active for an account, a user, or a device. Each active channel has a call id. With that id, a request can run a short list of commands on the channel, including hangup, transfer, and playing media. Use the list request that matches the owner you care about, then send the command to the call id the API returned.
On this page
About Call Channels
The Channels API allows queries to find active channels for an account, a user, or a device. Given a call-id for a channel, a limited set of commands can be executed against that channel (such as hangup, transfer, or play media).
List Channels for User
API
/v2/accounts/{ACCOUNT_ID}/users/{USER_ID}/channels
https://public-api.virtualpbx.com:8443/v2/accounts/{{account_id}}/users/{{user_id}}/channels
CURL Example
curl --location -g --request GET 'https://public-api.virtualpbx.com:8443/v2/accounts/{ACCOUNT_ID}/users/{USER_ID}/channels' \
--header 'X-Auth-Token: {AUTH_TOKEN}' \
--header 'Content-Type: application/json'
List Channels for Device
API
/v2/accounts/{ACCOUNT_ID}/devices/{DEVICE_ID}/channels
https://public-api.virtualpbx.com:8443/v2/accounts/{ACCOUNT_ID}/devices/{DEVICE_ID}/channels
CURL Example
curl --location -g --request GET 'https://public-api.virtualpbx.com:8443/v2/accounts/{ACCOUNT_ID}/devices/{DEVICE_ID}/channels' \
--header 'X-Auth-Token: {AUTH_TOKEN}' \
--header 'Content-Type: application/json'
Fetch a channel’s details
API
GET /v2/accounts/{ACCOUNT_ID}/channels/{UUID}
https://public-api.virtualpbx.com:8443/v2/accounts/{ACCOUNT_ID}/channels/{UUID}
CURL Example
curl --location -g --request GET 'https://public-api.virtualpbx.com:8443/v2/accounts/{ACCOUNT_ID}/channels/{UUID}' \
--header 'X-Auth-Token: {AUTH_TOKEN}' \
--header 'Content-Type: application/json'
Execute an application against a Channel
POST /v2/accounts/{ACCOUNT_ID}/channels/{UUID}
Shell
curl -v -X POST \
-H "Content-Type: application/json" \
-H "X-Auth-Token: {AUTH_TOKEN}" \
-d '{"data": {"action": "transfer", "target": "345", "takeback_dtmf": "*1", "moh": "media_id" }}' \
https://api.virtualpbx.net/v2/accounts/{ACCOUNT_ID}/channels/{UUID}
Available action values are transfer, hangup, break, callflow, and intercept.
Transfer
Shell
curl --location -g --request POST 'https://public-api.virtualpbx.com:8443/v2/accounts/{ACCOUNT_ID}/channels/{UUID}' \
--header 'X-Auth-Token: {AUTH_TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{
"data": {
"enabled": true,
"reties": 4
}
}'
| Key | Description | Type | Default |
|---|---|---|---|
leg | Defines which leg of the call to take action against | `string('self' | 'bleg')` |
target | Extension/DID to transfer the {UUID} | string() | |
transfer-type | What type of transfer to perform | `string('attended' | 'blind')` |
moh | Music on hold to play while transferring | string() |