Start en samtale

PBX Cloud API

API is a way to manage your PBX Cloud from external softwares. It allows easy access to calls, phone status and more. It allows also to create, delete and edit records, even if in a limited way.

API can be used by using an API key generated in the Configuration/Settings page. Two kinds of keys can be generated, one allowing Read/Write access and one allowing only read-only operations.

The latest syntax for the operations can be retrieved here: 

Some usage examples (please note the URL can be slightly different then your account)



DIAL / Call an extension and then dial a number

https://portal.pbxcloud.eu/pbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=DIAL&source=402&dest=9922323232&tenant=DEMO&account=402-DEMO

This command returns a call id like:

Success|Originate successfully queued|15a4cfe6429054|

The call id can be used to retrieve the recording with

https://portal.pbxcloud.eu/pbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=recording&id=15a4cfe6429054

You can provide variables to the dial plan, by using the var parameter like:

https://portal.pbxcloud.eu/pbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=DIAL&source=402&dest=9922323232&tenant=DEMO&account=402-DEMO&var=callid%3D453131

%3D is the URL encoded equivalent of =

The variable will be available in the dial plan as "TENANTCODE-variable". In this example as DEMO-callid


AGENT / Pause agent from queue
https://portal.pbxcloud.eu/pbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=AGENT&action=PAUSE&queue=281&extension=104-DEMO&tenant=DEMO&pausereason=Breakfast


MEDIAFILE / Retrieve a media file by its ID
https://portal.pbxcloud.eu/pbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MEDIAFILE&tenant=DEMO&id=19&action=GETAUDIO&objectid=3619


VOICEMAIL
Get all voicemails for a tenant
https://portal.pbxcloud.eu/pbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=VOICEMAIL&tenant=DEMO&action=list


Get info about voicemails in a mailbox
https://portal.pbxcloud.eu/pbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=VOICEMAIL&tenant=DEMO&mailbox=102&action=messages


Get the binary audio for a message
https://portal.pbxcloud.eu/pbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=VOICEMAIL&tenant=DEMO&mailbox=102&action=message&msgid=1475685709-00000004


COUNTCALLS / Count the calls on a system
https://portal.pbxcloud.eu/pbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=COUNTCALLS


INFO

Get the cdr for a tenant in CSV format
https://portal.pbxcloud.eu/pbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=CDRS&format=csv&tenant=DEMO&start=2017-01-01&end=2017-02-01


Get the cdr for all tenants in CSV format
https://portal.pbxcloud.eu/pbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=CDRS&format=csv&tenant=%&start=2017-01-01&end=2017-02-01

Please note, when getting the CSV for a single tenant, the CSV format used is the tenant one, when getting the CSV for multiple tenants, the Admin format is used.


Get the queue log for a tenant in CSV format
https://portal.pbxcloud.eu/pbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=QUEUELOGS&format=csv&tenant=DEMO&start=2017-10-01&end=2017-12-01


ManageDB / Custom Destination Types

Getting the custom destination type list
https://portal.pbxcloud.eu/pbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=CUSTOMTYPES&tenant=DEMO&action=list


ManageDB / Custom Destinations

Getting the custom destination list
https://portal.pbxcloud.eu/pbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=CUSTOM&tenant=DEMO&action=list


Getting info for a custom destination
https://portal.pbxcloud.eu/pbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=CUSTOM&tenant=DEMO&action=get&objectid=67


Creating a custom destination

$config['cu_name']="Boss phone";
$config['cu_ct_id']=1;
$config['cu_param1']="3564732920";
$config['cu_param2']="INCOMINGDID";
$config['cu_param3']="30";

$url = "https://portal.pbxcloud.eu/pbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=add&object=custom&tenant=DEMO";
$resource = curl_init();
curl_setopt($resource, CURLOPT_URL, $url);
curl_setopt($resource, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($resource, CURLOPT_VERBOSE, true);
curl_setopt($resource, CURLOPT_POSTFIELDS, "jsondata=".urlencode(json_encode($config)));
$data = curl_exec($resource);
curl_close($resource);

print_r($data);


Updating a custom destination

$config['cu_name']="Boss private phone";
$config['cu_id']=286;
$config['cu_param1']="0636287454";

$url = "https://portal.pbxcloud.eu/pbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=update&object=custom&tenant=DEMO&objectid=286";
$resource = curl_init();
curl_setopt($resource, CURLOPT_URL, $url);
curl_setopt($resource, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($resource, CURLOPT_VERBOSE, true);
curl_setopt($resource, CURLOPT_POSTFIELDS, "jsondata=".urlencode(json_encode($config)));
$data = curl_exec($resource);
curl_close($resource);

print_r($data);


Vælg filer eller træk og slip filer
Nyttig?
Ja
Nej
  1. Rolf Warming

  2. Opslået
  3. Opdateret

Kommentarer