Proxyapi: Difference between revisions

From MiRTA PBX documentation
Jump to navigation Jump to search
No edit summary
No edit summary
Line 6: Line 6:


Some usage example examples:
Some usage example examples:
== DIAL / Call an extension and then dial a number ==
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=DIAL&source=402&dest=9922323232&tenant=DEVEL


== AGENT / Pause agent from queue ==
== AGENT / Pause agent from queue ==

Revision as of 14:38, 14 October 2017

Proxyapi is the way to manage your PBX 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.

Proxyapi can be used by each tenant 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 by proxyapi itself, like for example: https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=HELP

Some usage example examples:

DIAL / Call an extension and then dial a number

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=DIAL&source=402&dest=9922323232&tenant=DEVEL

AGENT / Pause agent from queue

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=AGENT&action=PAUSE&queue=281&extension=104-DEVEL&tenant=DEVEL

COUNTCALLS / Count the calls on a system

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=COUNTCALLS

INFO / Get the cdr for a tenant in CSV format

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=CDRS&format=csv&tenant=DEVEL&start=2017-01-01&end=2017-02-01

INFO / Get the cdr for all tenants in CSV format

https://demo.mirtapbx.com/mirtapbx/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

ManageDB / Custom Destination Types

Getting the custom destination type list

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=CUSTOMTYPES&tenant=DEVEL&action=list

ManageDB / Custom Destinations

Getting the custom destination list

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=CUSTOM&tenant=DEVEL&action=list

Getting info for a custom destination

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=CUSTOM&tenant=DEVEL&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://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=add&object=custom&tenant=DEVEL";
$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://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=update&object=custom&tenant=DEVEL&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);

ManageDB / Tenants

Getting the tenant list

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=TENANT&action=list

Getting info for a tenant

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=TENANT&action=get&objectid=1

Creating a tenant

$config['te_code']="RELAX";
$config['te_name']="Relax & entertainment";
$config['pk_start']=800;
$config['pk_end']=810;

$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=add&object=tenant";
$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 tenant

$config['te_id']="460";
$config['te_name']="Relax and entertainment";
$config['pk_end']=820;

$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=update&object=tenant&objectid=460";
$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);

ManageDB / Phones

Getting the phonet list

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=PHONES&action=list&tenant=DEVEL

Getting info for a phone

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=PHONES&action=get&objectid=182&tenant=DEVEL

Creating a phone

$config['ph_name']="George Basement";
$config['ph_mac']='AA:BB:CC:DD:EE:FF:00:11';
$config['ph_pm_id']=5;

$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=add&object=phones&tenant=DEVEL";
$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 tenant


$config['ph_name']="George Lower Basement";

$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=update&object=phones&objectid=207&tenant=DEVEL";
$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);