Proxyapi: Difference between revisions

From MiRTA PBX documentation
Jump to navigation Jump to search
No edit summary
 
(86 intermediate revisions by the same user not shown)
Line 3: Line 3:
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.
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
The latest syntax for the operations can be retrieved by proxyapi itself, like for example: https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=FwLjNxpSyN8tNKmD&reqtype=HELP


Some usage example examples:
Some usage example examples (please note the URL on the demo server is slightly different than on production servers - mirtapbx/pbx):
 
== INFO - SIMPLECDRS / Get the list of calls ==
 
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=SIMPLECDRS&tenant=DEVEL&calleridnum=103,104&start=2020-01-01&end=2020-12-31
 
== INFO - CDRS / Get the list of calls ==
 
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=CDRS&tenant=DEVEL&phone=103,104&start=2019-12-01&end=2022-12-31
 
If the amount of fields is too large and confusing, you can select the fields to return using a XML template defined in Configuration/Settings - XML Template and then use in the proxyapi request.
 
Let's name this XML template as Test_CSV
 
<pre>
{row_loop}{$uniqueid},{$ID},{$te_id},{$realsrc},{$lastdst},{$start},{$duration},{$answer},{$direction},{$direction},{$disposition}
{/row_loop}
</pre>
 
You can use as
 
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=CDRS&tenant=DEVEL&phone=103,104&start=2019-12-01&end=2022-12-31&format=xml&template=Test_CSV
 
== INFO - DIDS / Get the list of DIDs for one tenant ==
 
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=DIDS&tenant=DEVEL
 
== INFO - DIDS / Get the list of DIDs for all tenants ==
 
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=DIDS
 
== INFO - Flow / Get the state of a flow ==
 
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=FLOW&id=61&tenant=DEVEL
 
== INFO - Extension / Get the state of a extension ==
 
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=EXTSTATE&ext=500&tenant=DEVEL
 
== INFO - IVR Logs / Get the IVR logs ==
 
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&tenant=DEVEL&reqtype=INFO&info=IVRLOGS&format=json&start=2023-01-01&end=2024-12-31
 
== INFO - Variable / Get the value of a variable ==
 
https://devel.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=variable&id=61&tenant=DEVEL
 
== DND / Get the DND for an extension ==
 
https://devel.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&tenant=DEVEL&reqtype=DND&action=get&number=100
 
== DND /Set the DND for an extension ==
 
https://devel.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&tenant=DEVEL&reqtype=DND&action=set&number=100&value=on


== DIAL / Call an extension and then dial a number ==
== 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
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=DIAL&source=402&dest=9922323232&tenant=DEVEL&account=402-DEVEL
 
This command returns a call id like:
 
Success|Originate successfully queued|15a4cfe6429054|
 
The call id can be used to retrieve the recording with
 
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=recording&id=15a4cfe6429054
 
It will be contained in the "OriginateID" field in the cdr table
 
You can provide variables to the dial plan, by using the var parameter like:
 
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=DIAL&source=402&dest=9922323232&tenant=DEVEL&account=402-DEVEL&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 DEVEL-callid
 
== HANGUP / Hangup a call by extension ==
 
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=HANGUP&extension=103-DEVEL&tenant=DEVEL


== AGENT / Pause agent from queue ==
== 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
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=AGENT&action=PAUSE&queue=281&extension=104-DEVEL&tenant=DEVEL&pausereason=Breakfast
 
== AGENT / Get info for agent in all the queues ==
 
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=AGENT&action=LISTQUEUES&extension=104-DEVEL&tenant=DEVEL&format=json
 
== MEDIAFILE / Retrieve a media file by its ID ==
 
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MEDIAFILE&tenant=DEVEL&id=19&action=GETAUDIO&objectid=3619
 
== QUEUE / Get the list of agents ==
 
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=QUEUE&tenant=DEVEL&action=list&number=9200
 
== QUEUE / Add an agent to a queue ==
 
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=QUEUE&tenant=DEVEL&action=add&number=9200&extension=103
 
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=QUEUE&tenant=DEVEL&action=add&number=781&extension=107&paused=1&penalty=4
 
== SETTING ==
 
=== Get a tenant setting ===
 
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?tenant=DEVEL&key=trQ3LPb2x4z7UMcX&reqtype=SETTING&action=GET&tenant=DEVEL&code=VMAUTORECOVER
 
=== Set a tenant setting ===
 
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?tenant=DEVEL&key=trQ3LPb2x4z7UMcX&reqtype=SETTING&action=SET&tenant=DEVEL&code=VMAUTORECOVER&value=no


== VOICEMAIL ==
== VOICEMAIL ==
Line 28: Line 131:


https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=VOICEMAIL&tenant=DEVEL&mailbox=102&action=message&msgid=1475685709-00000004
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=VOICEMAIL&tenant=DEVEL&mailbox=102&action=message&msgid=1475685709-00000004
=== Mark a message as read ===
https://devel.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=VOICEMAIL&tenant=DEVEL&action=markread&msgid=1543267778-00000007
=== Mark a message as not read ===
https://devel.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=VOICEMAIL&tenant=DEVEL&action=markunread&msgid=1543267778-00000007


== COUNTCALLS / Count the calls on a system ==
== COUNTCALLS / Count the calls on a system ==


https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=COUNTCALLS
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=COUNTCALLS
== RECORDINGS / Get or play a recording ==
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=recording&id=srv02-1531779475.48&tenant=DEVEL
Based on your browser settings, you can force the browser to play the recording using the "playrecording" info parameter
== TRANSCRIPT / Get the transcript for a recording ==
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=trascript&id=srv02-1695552000.1043&tenant=DEVEL
== PHONEBOOKS ==
=== Search for an entry ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=PHONEBOOK&subreqtype=query&tenant=DEVEL&phonebook=Default&field=name&value=Ben
=== Add an entry ===
<pre>
<?php
$phonebook['NAME']="Ross";
$phonebook['PHONE1']="3564732920";
$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=PHONEBOOK&subreqtype=add&phonebook=Default&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, "values=".urlencode(json_encode($phonebook)));
$data = curl_exec($resource);
curl_close($resource);
print_r($data);
?>
</pre>
== FAX ==
=== Send a fax ===
<pre>
<?php
$postfields = array(
    'filename' => '@protected/FAXtestPage.pdf'
                    );
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=FAX&action=send&number=99397654321&source_number=123412345&tenant=DEVEL");
curl_setopt($ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$postResult = curl_exec($ch);
if (curl_errno($ch)) {
  print curl_error($ch);
}
curl_close($ch);
</pre>


== INFO ==
== INFO ==
Line 44: Line 216:


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
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://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=QUEUELOGS&format=csv&tenant=DEVEL&start=2017-10-01&end=2017-12-01
== Getting response paths results ==
=== Getting the latest one for a given Response Path ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=RESPONSEPATH&tenant=DEVEL&id=19&action=GETLAST
It returns something like:
<pre>
UniqueID|Type|Type ID|Value|Type Name|Value Name
srv02-1509806457.625|START|0|2017-11-04 15:41:01||
srv02-1509806457.625|CALLERID|0|Susan <1132555678>||
srv02-1509806457.625|VARIABLE|85|36985||
srv02-1509806457.625|VARIABLE|144|56896||
srv02-1509806457.625|QUEUE|281|||
srv02-1509806457.625|ANSWER|0|105-DEVEL||
srv02-1509806457.625|HANGUP|0|||
</pre>
=== Getting the latest one for a given Response Path for agent 104-DEVEL ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=RESPONSEPATH&tenant=DEVEL&id=19&action=GETLAST&filter=ANSWER&filterdata=104-DEVEL
=== Getting the latest one for a given Response Path for agent 104-DEVEL in xml format ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=RESPONSEPATH&tenant=DEVEL&id=19&action=GETLAST&filter=ANSWER&filterdata=105-DEVEL&format=xml
Based on the xml format shown in the manual, it returns something like:
<pre>
<?xml version="1.0">
<Result>
<Agent>105-DEVEL</Agent>
<Status>NOT ACTIVE</Status>
<Queue>supportQ</Queue>
<ClientID>1234</MemberNumber>
<OrderNumber>11223344</MemberNumber>
<Caller>Manuel <7171345678></Caller>
<VoiceFile>3619</VoiceFile>
</Result>
</pre>
= ManageDB =
Any ManageDB action requires an admin key


== ManageDB / Custom Destination Types ==
== ManageDB / Custom Destination Types ==
Line 100: Line 322:
print_r($data);
print_r($data);
</pre>
</pre>
== CDR / Get the userfield ==
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&tenant=DEVEL&reqtype=CDR&action=GET&field=userfield&uniqueid=srv02-1701011773.4670
== CDR / Update the userfield ==
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&tenant=DEVEL&reqtype=CDR&action=UPDATE&field=userfield&uniqueid=srv02-1701011773.4670&value=[custom]


== ManageDB / Tenants ==
== ManageDB / Tenants ==
Line 106: Line 336:


https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=TENANT&action=list
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=TENANT&action=list
Using a filter
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=r4p2xJwKut4fw9hs&reqtype=MANAGEDB&object=TENANT&action=list&filter=te_disabled=%27on%27


=== Getting info for a tenant ===
=== Getting info for a tenant ===
Line 134: Line 368:


<pre>
<pre>
$config['te_id']="460";
$config['te_name']="Relax and entertainment";
$config['te_name']="Relax and entertainment";
$config['pk_end']=820;
$config['pk_end']=820;
Line 152: Line 385:
== ManageDB / Phones ==
== ManageDB / Phones ==


=== Getting the phonet list ===
=== Getting the phones list ===


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


=== Getting info for a phone ===
=== Getting info for a phone ===


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


=== Creating a phone ===
=== Creating a phone ===
Line 179: Line 412:
</pre>
</pre>


=== Updating a tenant ===
=== Updating a phone ===


<pre>
<pre>
Line 185: Line 418:
$config['ph_name']="George Lower Basement";
$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";
$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=update&object=phone&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);
</pre>
 
== Manage DB / media files ==
 
=== Getting the media file list ===
 
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=MEDIAFILE&action=list&tenant=DEVEL
 
=== Getting info for a media file ===
 
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=MEDIAFILE&action=get&objectid=1063&tenant=DEVEL
 
=== Getting the binary part of a media file ===
 
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=MEDIAFILE&action=getbinary&objectid=1063&tenant=DEVEL
 
=== Updating a media file ===
 
<pre>
 
$config['me_name']="Beep";
 
$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=update&object=mediafile&objectid=10&tenant=DEVEL";
$resource = curl_init();
$resource = curl_init();
curl_setopt($resource, CURLOPT_URL, $url);
curl_setopt($resource, CURLOPT_URL, $url);
Line 196: Line 461:
print_r($data);
print_r($data);
</pre>
</pre>
=== Updating the binary part of a media file ===
<pre>
<?php
$postfields = array(
    'filename' => '@audio.wav'
                    );
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=MEDIAFILE&action=updatebinary&objectid=247&tenant=DEVEL");
curl_setopt($ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$postResult = curl_exec($ch);
if (curl_errno($ch)) {
  print curl_error($ch);
}
curl_close($ch);
</pre>
== ManageDB / Hunt Lists ==
=== Getting the hunt lists list ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=HUNTLIST&action=get&objectid=323&tenant=DEVEL
=== Getting the hunt lists extension list ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=HUNTLIST&action=getextensions&objectid=323&tenant=DEVEL
=== Setting the hunt lists extension list ===
<pre>
<?php
$destinations=array('EXT-1701','EXT-1703','EXT-1705','CUSTOM-67');
$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=setextensions&object=huntlist&objectid=26&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($destinations)));
$data = curl_exec($resource);
curl_close($resource);
print_r($data);
?>
</pre>
== ManageDB / Extensions ==
=== Getting the extension list ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=list&object=extension&tenant=DEVEL
=== Updating the security for an extension ===
<pre>
<?php
$value['ex_callallowed']='none';
//$value['ex_callallowed']='all';
$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=update&object=extension&objectid=1695&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($value)));
$data = curl_exec($resource);
curl_close($resource);
print_r($data);
?>
</pre>
=== Adding a SIP extension ===
<pre>
$config['ex_number']="1100";
$config['ex_name']='Test extension';
$config['ex_tech']='SIP';
$config['secret']='hackmeifyoucan';
$config['ex_pickupgroup']='1,5,6';
$config['ex_callgroup']='1,7,9';
$url = "https://devel.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=add&object=extension&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);
</pre>
=== Adding a PJSIP extension ===
<pre>
$config['ex_number']="1100";
$config['ex_name']='Test PJSIP extension';
$config['password']='hackmeifyoucan';
$config['ex_tech']='PJSIP';
$url = "https://devel.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=add&object=extension&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);
</pre>
== ManageDB / Users ==
=== Getting the user list ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=user&action=list
=== Getting the details for an user ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=user&action=get&objectid=3635
=== Creating an user ===
<pre>
<?php
$user['us_username']='Leandro71';
$user['us_password']=hash('sha256','nabucco347');
$user['us_up_id']=1;
$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=add&object=user";
$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($user)));
$data = curl_exec($resource);
curl_close($resource);
print_r($data);
?>
</pre>
== ManageDB / Conferences ==
=== Creating a conference ===
<pre>
<?php
$config['cr_number']="887";
$config['cr_name']='Test conference';
$config['pin']='5678';
$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=add&object=conference&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);
?>
</pre>
== ManageDB / Providers ==
=== Getting the provider list ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=provider&action=list
=== Getting the details for a provider (SIP) ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=provider&action=get&objectid=1027
=== Update a provider ===
<pre>
<?php
$config['pr_peername']="test_extradevel";
$config['pr_name']='Test extradevel';
$url = "https://devel.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=update&object=provider&objectid=1027";
$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);
?>
</pre>
=== Insert a provider ===
<pre>
<?php
$config['pr_peername']="new_provider";
$config['pr_name']='New Provider';
$config['pr_tech']='SIP';
$config['pr_userealtime']='on';
$config['allow']='alaw:20;ulaw:20;gsm:20';
$config['host']='172.16.1.100';
$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=add&object=provider";
$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);
?>
</pre>
== ManageDB / Routing Profiles ==
=== Getting the routing profiles list ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=routingprofile&action=list
=== Getting the details for a routing profile ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=routingprofile&action=get&objectid=99
=== Getting the list of routes for a routing profile ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=routingprofile&action=listroutes&objectid=99
=== Adding a routing profile ===
<pre>
<?php
$config['rp_name']='Only National';
$config['rp_type']='VOICE';
$url = "https://devel.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=add&object=routingprofile";
$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);
?>
</pre>
=== Update a routing profile ===
<?php
$config['rp_name']='Only National calls';
$url = "https://devel.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=update&object=routingprofile&objectid=275";
$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 / Routes ==
=== Getting the route list ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=route&action=list
=== Getting the route list for a routing profile ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=route&routingprofileid=1&action=list
=== Getting the details for a route ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=route&action=get&objectid=69
=== Adding a route to a routing profile ===
<pre>
<?php
$config['dl_rp_id']='1';
$config['dl_name']='Free Numbers';
$config['dl_regex']='^800.*';
$config['dl_pr_id']='89';
$url = "https://devel.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=add&object=route";
$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);
?>
</pre>
=== Update a route ===
<pre>
<?php
$config['dl_emergencyroute']='';
$config['dl_usepin']='on';
$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=update&object=route&objectid=69";
$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);
?>
</pre>
== ManageDB / DIDs ==
=== Listing the DIDs for a tenant ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=DID&action=LIST&tenant=DEVEL
=== Getting more info for a DID ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=DID&action=GET&objectid=27699&tenant=DEVEL
=== Updating a DID ===
<pre>
<?php
$config['di_comment']='Test DID';
$config['di_recording']='yes';
$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=update&object=did&objectid=27699";
$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);
?>
</pre>
== ManageDB / Destinations ==
=== Getting the destinations for a DID ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=DESTINATION&action=LIST&typesrc=DID&typeidsrc=27699&tenant=DEVEL
=== Getting the destinations for a Condition (true) ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=DESTINATION&action=LIST&typesrc=CONDITION&typeidsrc=20&tenant=DEVEL
=== Getting the destinations for a Condition (false) ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=DESTINATION&action=LIST&typesrc=NOTCONDITION&typeidsrc=20&tenant=DEVEL
=== Replace the destinations for a DID ===
<pre>
<?php
$config[]='PLAYBACK-60';
$config[]='EXT-29379';
$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=DESTINATION&action=replace&typesrc=DID&typeidsrc=27699&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);
?>
</pre>
You can use all these tags, with the id of the object
* EXT - Dial an extension
* SMS - Send a SMS to an extension
* PLAYBACK - Play a media file
* RERECORD - Rerecord a media file
* CLEARRECORDING - Clear the media from a media file
* RERECORDSILENT - Rerecord a media file without playing an intro
* CONDITION - Follow to a condition
* VOICMEAIL - Call a voicemail
* IVR - Call an IVR
* DISA - Call a DISA
* PAGING - Call a Paging group
* HUNTLIST - Call a Huntlist
* FLOW - Call a Flow
* PARK - Park the call
* SPECIAL - Execute a special destination (check the sp_specials table for the id)
* MEETME - Join a conference
* QUEUE - Dial a Queue
* RESETQUEUESTATS - Reset the stats for a Queue
* STARTCAMPAIGN - Start a campaign
* REDIALNOTANSWEREDCAMPAIGN - Redial the calls not answered for a campaign
* STOPCAMPAIGN - Stop a campaign
* PAUSECAMPAIGN - Pause a campaign
* PAUSECAMPAIGN - Unpause a campaign
* REMOVEFROMCAMPAIGN - Remove called number from campaign
* REMOVECALLERFROMCAMPAIGN - Remove caller number from campaign
* ADDLATESTDIALEDOUTTOCAMPAIGN - Add latest dialed out number to campaign
* ADDLATESTDIALEDINTOCAMPAIGN - Add latest dialed in number to campaign
* ADDTODNCLIST - Add called number to Do Not Call list
* LOGINQUEUE - Login caller to Queue
* TOGGLELOGINQUEUE - Toggle Login/Logout caller to Queue
* LOGINADQUEUE - Login caller to Queue
* TOGGLELOGINADQUEUE - Toggle Login/Logout caller to Queue
* TOGGLEPAUSEQUEUE - Toggle Pause/Unpause caller to Queue
* LOGOUTALLAGENTSFROMQUEUE - Logout all agents from Queue
* LOGOUTQUEUE - Logout caller from Queue
* PAUSEQUEUE - Pause caller from Queue
* UNPAUSEQUEUE - Unpause caller from Queue
* PAUSEALLAGENTSINQUEUE - Pause all agents in Queue
* UNPAUSEALLAGENTSINQUEUE - Unpause all agents in Queue
* CUSTOM - Use a custom destination
* PHONEBOOK - Route by Phone Book using regex
* EXACTPHONEBOOK - Route by Phone Book not using regex
* SETUNCONDITIONALDID - Set unconditional forwarding for a DID
* ENABLEUNCONDITIONALDID - Enable the unconditional forwarding for a DID
* DISABLEUNCONDITIONALDID - Disable the unconditional forwarding for a DID
* TOGGLEUNCONDITIONALDID - Toggle the unconditional forwarding for a DID
* CLIDNAMEBYPHONEBOOK - Set Caller ID Name by Phone Book
* CALLERIDMOD - Alter Caller ID based on rule
* MUSICONHOLD - Set Music On Hold to
* RINGMUSICONHOLD - Ring extension using Music On Hold
* RESPONSEPATH - Start Response Path
* SAMENUMBERVM - Voicemail same number
You can assign the destination for a condition (true) using the URL
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=DESTINATION&action=replace&typesrc=CONDITION&typeidsrc=20&tenant=DEVEL
or condition (false) using the URL
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=DESTINATION&action=replace&typesrc=NOTCONDITION&typeidsrc=20&tenant=DEVEL
For an IVR, you can assign the destination for a press 1 using the URL
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=DESTINATION&action=replace&typesrc=IVR_1&typeidsrc=3634&tenant=DEVEL
== ManageDB / IVRs ==
=== Listing the IVRs for a tenant ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=IVR&action=LIST&tenant=DEVEL
=== Getting more info for a IVR ===
Take in mind, the iv_me_id field is not used and the media files are stored in the destination table
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=IVR&action=GET&tenant=DEVEL&objectid=322
=== Getting the destinations for the IVR, including the media files ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=IVR&action=GETDESTINATIONS&tenant=DEVEL&objectid=3634
Use the Destination call to replace values
== ManageDB / Conditions ==
=== Listing the Conditions for a tenant ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=CONDITION&action=LIST&tenant=DEVEL
=== Listing the destinations for a Condition ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=CONDITION&action=GETDESTINATIONS&tenant=DEVEL&objectid=20&format=json
=== Getting info and more info for a Condition ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=CONDITION&action=GET&tenant=DEVEL&objectid=20&format=json
This will give you the details of the condition, but in case for example of WEEKTIME condition or CALENDAR condition, you need to get the extended info like:
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=CONDITION&action=GETEXTENDEDINFOS&tenant=DEVEL&objectid=20&format=json
=== Replacing extended info for a Condition ===
<pre>
<?php
$config[0]['param1']='1';
$config[0]['param2']='8:00';
$config[0]['param3']='13:00';
$config[1]['param1']='1';
$config[1]['param2']='15:00';
$config[1]['param3']='19:00';
$config[2]['param1']='2';
$config[2]['param2']='8:00';
$config[2]['param3']='13:00';
$config[3]['param1']='2';
$config[3]['param2']='15:00';
$config[3]['param3']='19:00';
$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=CONDITION&action=replaceextendedinfos&objectid=20&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);
?>
</pre>
== ManageDB / Voicemails ==
=== Listing the Voicemails for a tenant ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=VOICEMAIL&action=LIST&tenant=DEVEL
=== Listing the Voicemails message for a voicemail ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=VOICEMAIL&action=LISTMESSAGES&tenant=DEVEL&mailboxuser=001&mailbox=INBOX
=== Get a message recording for a voicemail id ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=VOICEMAIL&action=GETMESSAGERECORDING&id=4963&tenant=DEVEL
=== Add a voicemail box ===
<pre>
<?php
$config['mailbox']='9000';
$config['password']='1234567';
$config['fullname']='This is a test';
$config['email']='test@mirtapbx.com';
$url = "https://devel.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=add&tenant=DEVEL&object=voicemail";
$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);
?>
</pre>
=== Delete a voicemail box ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=VOICEMAIL&action=DELETE&objectid=32259&tenant=DEVEL
== ManageDB / Phone phonebooks ==
=== Listing the Phone phonebooks for a tenant ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&tenant=DEVEL&reqtype=MANAGEDB&tenant=DEVEL&object=PHONEPHONEBOOK&action=LIST
=== Get the detail of a phone phone book ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&tenant=DEVEL&reqtype=MANAGEDB&tenant=DEVEL&object=PHONEPHONEBOOK&action=GET&objectid=1332
== ManageDB / Queues ==
=== Listing the Queues for a tenant ===
https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=QUEUE&action=LIST&tenant=DEVEL
=== Add a Queue ===
<pre>
<?php
$config['qu_name']='Support Line';
$config['strategy']='RINGALL';
$config['timeout']='30';
$url = "https://devel.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=add&tenant=DEVEL&object=queue";
$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);
?>
</pre>
=== Delete a queue ===
https://devel.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=QUEUE&action=DELETE&objectid=7027&tenant=DEVEL

Latest revision as of 13:54, 2 October 2024

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=FwLjNxpSyN8tNKmD&reqtype=HELP

Some usage example examples (please note the URL on the demo server is slightly different than on production servers - mirtapbx/pbx):

INFO - SIMPLECDRS / Get the list of calls

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=SIMPLECDRS&tenant=DEVEL&calleridnum=103,104&start=2020-01-01&end=2020-12-31

INFO - CDRS / Get the list of calls

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=CDRS&tenant=DEVEL&phone=103,104&start=2019-12-01&end=2022-12-31

If the amount of fields is too large and confusing, you can select the fields to return using a XML template defined in Configuration/Settings - XML Template and then use in the proxyapi request.

Let's name this XML template as Test_CSV

{row_loop}{$uniqueid},{$ID},{$te_id},{$realsrc},{$lastdst},{$start},{$duration},{$answer},{$direction},{$direction},{$disposition}
{/row_loop}

You can use as

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=CDRS&tenant=DEVEL&phone=103,104&start=2019-12-01&end=2022-12-31&format=xml&template=Test_CSV

INFO - DIDS / Get the list of DIDs for one tenant

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=DIDS&tenant=DEVEL

INFO - DIDS / Get the list of DIDs for all tenants

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=DIDS

INFO - Flow / Get the state of a flow

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=FLOW&id=61&tenant=DEVEL

INFO - Extension / Get the state of a extension

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=EXTSTATE&ext=500&tenant=DEVEL

INFO - IVR Logs / Get the IVR logs

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&tenant=DEVEL&reqtype=INFO&info=IVRLOGS&format=json&start=2023-01-01&end=2024-12-31

INFO - Variable / Get the value of a variable

https://devel.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=variable&id=61&tenant=DEVEL

DND / Get the DND for an extension

https://devel.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&tenant=DEVEL&reqtype=DND&action=get&number=100

DND /Set the DND for an extension

https://devel.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&tenant=DEVEL&reqtype=DND&action=set&number=100&value=on

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&account=402-DEVEL

This command returns a call id like:

Success|Originate successfully queued|15a4cfe6429054|

The call id can be used to retrieve the recording with

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=recording&id=15a4cfe6429054

It will be contained in the "OriginateID" field in the cdr table

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

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=DIAL&source=402&dest=9922323232&tenant=DEVEL&account=402-DEVEL&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 DEVEL-callid

HANGUP / Hangup a call by extension

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=HANGUP&extension=103-DEVEL&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&pausereason=Breakfast

AGENT / Get info for agent in all the queues

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=AGENT&action=LISTQUEUES&extension=104-DEVEL&tenant=DEVEL&format=json

MEDIAFILE / Retrieve a media file by its ID

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MEDIAFILE&tenant=DEVEL&id=19&action=GETAUDIO&objectid=3619

QUEUE / Get the list of agents

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=QUEUE&tenant=DEVEL&action=list&number=9200

QUEUE / Add an agent to a queue

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=QUEUE&tenant=DEVEL&action=add&number=9200&extension=103

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=QUEUE&tenant=DEVEL&action=add&number=781&extension=107&paused=1&penalty=4

SETTING

Get a tenant setting

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?tenant=DEVEL&key=trQ3LPb2x4z7UMcX&reqtype=SETTING&action=GET&tenant=DEVEL&code=VMAUTORECOVER

Set a tenant setting

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?tenant=DEVEL&key=trQ3LPb2x4z7UMcX&reqtype=SETTING&action=SET&tenant=DEVEL&code=VMAUTORECOVER&value=no

VOICEMAIL

Get all voicemails for a tenant

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

Get info about voicemails in a mailbox

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=VOICEMAIL&tenant=DEVEL&mailbox=102&action=messages

Get the binary audio for a message

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=VOICEMAIL&tenant=DEVEL&mailbox=102&action=message&msgid=1475685709-00000004

Mark a message as read

https://devel.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=VOICEMAIL&tenant=DEVEL&action=markread&msgid=1543267778-00000007

Mark a message as not read

https://devel.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=VOICEMAIL&tenant=DEVEL&action=markunread&msgid=1543267778-00000007

COUNTCALLS / Count the calls on a system

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

RECORDINGS / Get or play a recording

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=recording&id=srv02-1531779475.48&tenant=DEVEL

Based on your browser settings, you can force the browser to play the recording using the "playrecording" info parameter

TRANSCRIPT / Get the transcript for a recording

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=INFO&info=trascript&id=srv02-1695552000.1043&tenant=DEVEL

PHONEBOOKS

Search for an entry

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=PHONEBOOK&subreqtype=query&tenant=DEVEL&phonebook=Default&field=name&value=Ben

Add an entry

<?php

$phonebook['NAME']="Ross";
$phonebook['PHONE1']="3564732920";

$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=PHONEBOOK&subreqtype=add&phonebook=Default&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, "values=".urlencode(json_encode($phonebook)));
$data = curl_exec($resource);
curl_close($resource);

print_r($data);

?>

FAX

Send a fax

<?php
$postfields = array(
    'filename' => '@protected/FAXtestPage.pdf'
                    );

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=FAX&action=send&number=99397654321&source_number=123412345&tenant=DEVEL");
curl_setopt($ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$postResult = curl_exec($ch);

if (curl_errno($ch)) {
  print curl_error($ch);
}
curl_close($ch);

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

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

Get the queue log for a tenant in CSV format

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

Getting response paths results

Getting the latest one for a given Response Path

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=RESPONSEPATH&tenant=DEVEL&id=19&action=GETLAST

It returns something like:

UniqueID|Type|Type ID|Value|Type Name|Value Name
srv02-1509806457.625|START|0|2017-11-04 15:41:01||
srv02-1509806457.625|CALLERID|0|Susan <1132555678>||
srv02-1509806457.625|VARIABLE|85|36985||
srv02-1509806457.625|VARIABLE|144|56896||
srv02-1509806457.625|QUEUE|281|||
srv02-1509806457.625|ANSWER|0|105-DEVEL||
srv02-1509806457.625|HANGUP|0|||

Getting the latest one for a given Response Path for agent 104-DEVEL

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=RESPONSEPATH&tenant=DEVEL&id=19&action=GETLAST&filter=ANSWER&filterdata=104-DEVEL

Getting the latest one for a given Response Path for agent 104-DEVEL in xml format

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=RESPONSEPATH&tenant=DEVEL&id=19&action=GETLAST&filter=ANSWER&filterdata=105-DEVEL&format=xml

Based on the xml format shown in the manual, it returns something like:

<?xml version="1.0">
<Result>
<Agent>105-DEVEL</Agent>
<Status>NOT ACTIVE</Status>
<Queue>supportQ</Queue>
<ClientID>1234</MemberNumber>
<OrderNumber>11223344</MemberNumber>
<Caller>Manuel <7171345678></Caller>
<VoiceFile>3619</VoiceFile>
</Result>

ManageDB

Any ManageDB action requires an admin key

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);

CDR / Get the userfield

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&tenant=DEVEL&reqtype=CDR&action=GET&field=userfield&uniqueid=srv02-1701011773.4670

CDR / Update the userfield

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&tenant=DEVEL&reqtype=CDR&action=UPDATE&field=userfield&uniqueid=srv02-1701011773.4670&value=[custom]

ManageDB / Tenants

Getting the tenant list

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

Using a filter

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=r4p2xJwKut4fw9hs&reqtype=MANAGEDB&object=TENANT&action=list&filter=te_disabled=%27on%27

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_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 phones list

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

Getting info for a phone

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=PHONE&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 phone


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

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

Manage DB / media files

Getting the media file list

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

Getting info for a media file

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

Getting the binary part of a media file

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=MEDIAFILE&action=getbinary&objectid=1063&tenant=DEVEL

Updating a media file


$config['me_name']="Beep";

$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=update&object=mediafile&objectid=10&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 the binary part of a media file


<?php
$postfields = array(
    'filename' => '@audio.wav'
                    );

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=MEDIAFILE&action=updatebinary&objectid=247&tenant=DEVEL");
curl_setopt($ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$postResult = curl_exec($ch);

if (curl_errno($ch)) {
  print curl_error($ch);
}
curl_close($ch); 

ManageDB / Hunt Lists

Getting the hunt lists list

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

Getting the hunt lists extension list

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=HUNTLIST&action=getextensions&objectid=323&tenant=DEVEL

Setting the hunt lists extension list

<?php
$destinations=array('EXT-1701','EXT-1703','EXT-1705','CUSTOM-67');

$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=setextensions&object=huntlist&objectid=26&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($destinations)));
$data = curl_exec($resource);
curl_close($resource);

print_r($data);
?>

ManageDB / Extensions

Getting the extension list

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

Updating the security for an extension

<?php

$value['ex_callallowed']='none'; 
//$value['ex_callallowed']='all'; 

$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=update&object=extension&objectid=1695&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($value)));
$data = curl_exec($resource);
curl_close($resource);

print_r($data);
?>

Adding a SIP extension

$config['ex_number']="1100";
$config['ex_name']='Test extension';
$config['ex_tech']='SIP';
$config['secret']='hackmeifyoucan';
$config['ex_pickupgroup']='1,5,6';
$config['ex_callgroup']='1,7,9';

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

Adding a PJSIP extension

$config['ex_number']="1100";
$config['ex_name']='Test PJSIP extension';
$config['password']='hackmeifyoucan';
$config['ex_tech']='PJSIP';

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

ManageDB / Users

Getting the user list

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

Getting the details for an user

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

Creating an user

<?php
$user['us_username']='Leandro71';
$user['us_password']=hash('sha256','nabucco347');
$user['us_up_id']=1;

$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=add&object=user";
$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($user)));
$data = curl_exec($resource);
curl_close($resource);

print_r($data);
?>

ManageDB / Conferences

Creating a conference

<?php

$config['cr_number']="887";
$config['cr_name']='Test conference';
$config['pin']='5678';

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

ManageDB / Providers

Getting the provider list

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

Getting the details for a provider (SIP)

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

Update a provider

<?php

$config['pr_peername']="test_extradevel";
$config['pr_name']='Test extradevel';

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

Insert a provider

<?php

$config['pr_peername']="new_provider";
$config['pr_name']='New Provider';
$config['pr_tech']='SIP';
$config['pr_userealtime']='on';

$config['allow']='alaw:20;ulaw:20;gsm:20';
$config['host']='172.16.1.100';


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

Getting the routing profiles list

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

Getting the details for a routing profile

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

Getting the list of routes for a routing profile

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=routingprofile&action=listroutes&objectid=99

Adding a routing profile

<?php

$config['rp_name']='Only National';
$config['rp_type']='VOICE';

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

Update a routing profile

<?php

$config['rp_name']='Only National calls';

$url = "https://devel.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&action=update&object=routingprofile&objectid=275"; $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 / Routes

Getting the route list

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

Getting the route list for a routing profile

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

Getting the details for a route

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

Adding a route to a routing profile

<?php

$config['dl_rp_id']='1';
$config['dl_name']='Free Numbers';
$config['dl_regex']='^800.*';
$config['dl_pr_id']='89';

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

Update a route

<?php

$config['dl_emergencyroute']='';
$config['dl_usepin']='on';

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

Listing the DIDs for a tenant

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

Getting more info for a DID

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=DID&action=GET&objectid=27699&tenant=DEVEL

Updating a DID

<?php

$config['di_comment']='Test DID';
$config['di_recording']='yes';

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

Getting the destinations for a DID

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=DESTINATION&action=LIST&typesrc=DID&typeidsrc=27699&tenant=DEVEL

Getting the destinations for a Condition (true)

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=DESTINATION&action=LIST&typesrc=CONDITION&typeidsrc=20&tenant=DEVEL

Getting the destinations for a Condition (false)

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=DESTINATION&action=LIST&typesrc=NOTCONDITION&typeidsrc=20&tenant=DEVEL

Replace the destinations for a DID

<?php

$config[]='PLAYBACK-60';
$config[]='EXT-29379';

$url = "https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=DESTINATION&action=replace&typesrc=DID&typeidsrc=27699&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);
?>

You can use all these tags, with the id of the object

  • EXT - Dial an extension
  • SMS - Send a SMS to an extension
  • PLAYBACK - Play a media file
  • RERECORD - Rerecord a media file
  • CLEARRECORDING - Clear the media from a media file
  • RERECORDSILENT - Rerecord a media file without playing an intro
  • CONDITION - Follow to a condition
  • VOICMEAIL - Call a voicemail
  • IVR - Call an IVR
  • DISA - Call a DISA
  • PAGING - Call a Paging group
  • HUNTLIST - Call a Huntlist
  • FLOW - Call a Flow
  • PARK - Park the call
  • SPECIAL - Execute a special destination (check the sp_specials table for the id)
  • MEETME - Join a conference
  • QUEUE - Dial a Queue
  • RESETQUEUESTATS - Reset the stats for a Queue
  • STARTCAMPAIGN - Start a campaign
  • REDIALNOTANSWEREDCAMPAIGN - Redial the calls not answered for a campaign
  • STOPCAMPAIGN - Stop a campaign
  • PAUSECAMPAIGN - Pause a campaign
  • PAUSECAMPAIGN - Unpause a campaign
  • REMOVEFROMCAMPAIGN - Remove called number from campaign
  • REMOVECALLERFROMCAMPAIGN - Remove caller number from campaign
  • ADDLATESTDIALEDOUTTOCAMPAIGN - Add latest dialed out number to campaign
  • ADDLATESTDIALEDINTOCAMPAIGN - Add latest dialed in number to campaign
  • ADDTODNCLIST - Add called number to Do Not Call list
  • LOGINQUEUE - Login caller to Queue
  • TOGGLELOGINQUEUE - Toggle Login/Logout caller to Queue
  • LOGINADQUEUE - Login caller to Queue
  • TOGGLELOGINADQUEUE - Toggle Login/Logout caller to Queue
  • TOGGLEPAUSEQUEUE - Toggle Pause/Unpause caller to Queue
  • LOGOUTALLAGENTSFROMQUEUE - Logout all agents from Queue
  • LOGOUTQUEUE - Logout caller from Queue
  • PAUSEQUEUE - Pause caller from Queue
  • UNPAUSEQUEUE - Unpause caller from Queue
  • PAUSEALLAGENTSINQUEUE - Pause all agents in Queue
  • UNPAUSEALLAGENTSINQUEUE - Unpause all agents in Queue
  • CUSTOM - Use a custom destination
  • PHONEBOOK - Route by Phone Book using regex
  • EXACTPHONEBOOK - Route by Phone Book not using regex
  • SETUNCONDITIONALDID - Set unconditional forwarding for a DID
  • ENABLEUNCONDITIONALDID - Enable the unconditional forwarding for a DID
  • DISABLEUNCONDITIONALDID - Disable the unconditional forwarding for a DID
  • TOGGLEUNCONDITIONALDID - Toggle the unconditional forwarding for a DID
  • CLIDNAMEBYPHONEBOOK - Set Caller ID Name by Phone Book
  • CALLERIDMOD - Alter Caller ID based on rule
  • MUSICONHOLD - Set Music On Hold to
  • RINGMUSICONHOLD - Ring extension using Music On Hold
  • RESPONSEPATH - Start Response Path
  • SAMENUMBERVM - Voicemail same number

You can assign the destination for a condition (true) using the URL

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=DESTINATION&action=replace&typesrc=CONDITION&typeidsrc=20&tenant=DEVEL

or condition (false) using the URL

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=DESTINATION&action=replace&typesrc=NOTCONDITION&typeidsrc=20&tenant=DEVEL

For an IVR, you can assign the destination for a press 1 using the URL

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=DESTINATION&action=replace&typesrc=IVR_1&typeidsrc=3634&tenant=DEVEL

ManageDB / IVRs

Listing the IVRs for a tenant

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

Getting more info for a IVR

Take in mind, the iv_me_id field is not used and the media files are stored in the destination table

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=IVR&action=GET&tenant=DEVEL&objectid=322

Getting the destinations for the IVR, including the media files

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=IVR&action=GETDESTINATIONS&tenant=DEVEL&objectid=3634

Use the Destination call to replace values

ManageDB / Conditions

Listing the Conditions for a tenant

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

Listing the destinations for a Condition

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=CONDITION&action=GETDESTINATIONS&tenant=DEVEL&objectid=20&format=json

Getting info and more info for a Condition

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=CONDITION&action=GET&tenant=DEVEL&objectid=20&format=json

This will give you the details of the condition, but in case for example of WEEKTIME condition or CALENDAR condition, you need to get the extended info like:

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=CONDITION&action=GETEXTENDEDINFOS&tenant=DEVEL&objectid=20&format=json

Replacing extended info for a Condition

<?php

$config[0]['param1']='1';
$config[0]['param2']='8:00';
$config[0]['param3']='13:00';

$config[1]['param1']='1';
$config[1]['param2']='15:00';
$config[1]['param3']='19:00';

$config[2]['param1']='2';
$config[2]['param2']='8:00';
$config[2]['param3']='13:00';

$config[3]['param1']='2';
$config[3]['param2']='15:00';
$config[3]['param3']='19:00';

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

ManageDB / Voicemails

Listing the Voicemails for a tenant

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

Listing the Voicemails message for a voicemail

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=VOICEMAIL&action=LISTMESSAGES&tenant=DEVEL&mailboxuser=001&mailbox=INBOX

Get a message recording for a voicemail id

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=VOICEMAIL&action=GETMESSAGERECORDING&id=4963&tenant=DEVEL

Add a voicemail box

<?php

$config['mailbox']='9000';
$config['password']='1234567';
$config['fullname']='This is a test';
$config['email']='test@mirtapbx.com';

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

Delete a voicemail box

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=VOICEMAIL&action=DELETE&objectid=32259&tenant=DEVEL

ManageDB / Phone phonebooks

Listing the Phone phonebooks for a tenant

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

Get the detail of a phone phone book

https://demo.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&tenant=DEVEL&reqtype=MANAGEDB&tenant=DEVEL&object=PHONEPHONEBOOK&action=GET&objectid=1332

ManageDB / Queues

Listing the Queues for a tenant

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

Add a Queue

<?php

$config['qu_name']='Support Line';
$config['strategy']='RINGALL';
$config['timeout']='30';

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

Delete a queue

https://devel.mirtapbx.com/mirtapbx/proxyapi.php?key=NLbP7GFNVRqu9SDm&reqtype=MANAGEDB&object=QUEUE&action=DELETE&objectid=7027&tenant=DEVEL