POSTS
PORTFOLIO
SEARCH
SHOP
  • Your Cart Is Empty!
Your address will show here +12 34 56 78
API command for developers
Looking for telecom solutions without needing a developer? Our user portal has you covered! 
  • Text Hover
Creating a SIP Trunk
In your php file, you will run the command createSipTrunk().
The command takes two parameters: name and IP.
Both parameters are going to be strings, enclosed by " ".
You will find the new trunk listed in your customer user portal.
EXAMPLE:
<?php
$api = new QBapi();
$api->createSipTrunk("trunkName","x.x.x.x");
?>
Replace "trunkName" with the desired name of your trunk. Keep in mind if the trunk has already been created in your account, another trunk will not be made with the same name, even with a different IP.
To add DDNS during the creation you can add array('sipSetDdns','trunk' => 'TrunkName', 'host' => 'www.host.com')
as another parameter.
Your new function will look like this:
createSipTrunk("trunkName","x.x.x.x",'password', array('sipSetDdns','trunk' => 'TrunkName', 'host' => 'www.host.com') );
Creating a Registration Trunk
You will run the createSipTrunk() command without an IP address in the parameters.
This will create an IP trunk and return a password for that trunk.
EXAMPLE:
<?php
$api = new QBapi();
$api->createSipTrunk("registrationTrunk,'',"password");
?>
Will Return
[result] => success
[id] => XXXX
[passwd] => password

To enable international you can append another parameter, and array, at the end:
array('sipSetInterCalls', 'trunk' => 'trunkName', 'action' => 'on')
To route a did to the trunk upon creation:
array('routeDID', 'trunk' => 'trunkName', 'did' => 'XXXXXXXXXX')
Set Up DDNS
Setting up DDNS is simple with our API. Simply run sipSetDdns() with two parameters:
     Trunk - the name of the trunk
     Host - the IP address of the DDNS Host
Run the command while leaving the host parameter blank to unset DDNS.
EXAMPLE:
<?php
$api = new QBapi();
$api->sipSetDdns("trunkName","xxx.xxxx.xxx.xxx");
?>
Where xxx.xxx.xxx.xxx is the IP of your DDNS Host.
To see the DDNS status of a trunk you will use the listSipTrunks() functioned detailed in the next section.
List trunks and their properties in your account
In your php file, you will run the command listSipTrunks().
The command takes one parameter: trunk.
The parameter will be a string enclosed by " ".
Leaving the function blank, no parameter listed, will return all sip trunks in the account with their properties.
This includes what DIDs are routed to the trunk.
With a name listed (ex: listSipTrunks("trunkName");) will return the properties of that single trunk.
An array may also be entered in as a parameter. This is useful if you maintain multiple PBX systems and want to look at a groups properties.

EXAMPLE:
<?php
$api = new QBapi();
$api->listSipTrunks();
?>
Will Output:
[trunk] => trunkName
[ip_address] => xxx.xxx.xxx.xxx
[status] => Active
[ddns] => xx.xxx.xxx.xxx
[international] => inactive
[routed_did] => Array
    (
        [0] => XXXXXXXXXX
        [1] => XXXXXXXXXX
        [2] => XXXXXXXXXX
    )
Set a Failover Address
In your php file, you will run the command setFailoverIp().
The command takes three parameters: trunk, action, and props.
    trunk: the name of the trunk, in " " that will use the backup.
    action: "enable" or "disable". Enable will set the failover IP so that when the conditions are met, the trunk will automatically be switched. Disable should be sent if you no longer desire a backup.
    props: this will be an array of 3 values to be sent in. The Ip address of the failover location, the number of failed calls to trigger the failover, and the time interval that it checks for. This interval can only be 3, 5, 7, 10, 15, 20, 30.

EXAMPLE:
<?php
$api = new QBapi();
$props = array("xxx.xxx.xxx.xxx",13,30);
$result = $api->sipFaioverIp("trunkName","enable",$props);
echo '<pre>';
print_r($result);
?>
This will not print anything unless there has been an error in the parameters.
Update a trunk's IP
In your php file, you will run the command updateSipIp().
The command takes two parameters: name and IP.
Both parameters are going to be strings, enclosed by " ".
You will not see anything in your log if you do not print the results to console, but you will find the new IP listed in your acccount.

EXAMPLE:
<?php
$api = new QBapi();
updateSipIp("trunkName","xxx.xxx.xxx.xxx");
?>
Locking and Unlocking a trunk
The command LockSipTrunk() and unLockSipTrunk() do exactly that. This can be useful when you want to temporarily disable your sip trunk for any number of reasons. This function returns nothing other than a success or error message. If you want to known whether a trunk is locked or active you can call the listSipTrunk() function.

EXAMPLE:
<?php
$api = new QBapi();
$api->LockSipTrunk("trunkName");

$api->unLockSipTrunk("trunkName");
?>
Enabling International Calls on a Trunk
You can enable international, or disable international, with the sipSetInterCalls() function.

EXAMPLE:
<?php
$api = new QBapi();
$api->sipSetInterCalls("TrunkName", "on");
?>
Forward entire Trunk to an external number
In your php file, you will run the command sipSetForward
The command requires two parameters: Trunk name and DID
Both parameters are going to be strings, enclosed by ''
sipSetForward($trunk, $did = '')

EXAMPLE:

<?php
$result = $api->sipSetForward('trunk', 'did');
echo '<pre>';
print_r($result);
?>

Will Return:
(
[result] => success
)

Replace 'trunk' with the name of the Trunk that will be forwarded. Replace 'did' with the number the Trunk will be forwarded to.
To disable Forwarding, leave the 'did' section blank in between ''.