This example written in PHP allows users to manage VoipNow accounts and fetch call statistics. |
In order to be able to use the SystemAPI PHP Tool, your system must be compliant with the requirements below:
Please follow these steps:
STEP 1: Files are located in our GitHub repository. Copy the files using:
git clone https://github.com/4psa/systemapi-example-php.git |
STEP 2: Extract the files and copy them to a directory that can be accessed over the Web.
STEP 3: In order to use the tool, you must configure it. To do so, please open the config.php file located in the <PATH_TO_SYSTEMAPI_PHP_TOOL>/config
directory, and set the variables as explained below.
STEP 4: Set the $voipnow_ip variable to the IP or hostname of your VoipNow server.
Every SOAP request needs to contain the credentials in order to authenticate a user to the SystemAPI.
Set the $voipnow_access_token in the configuration file to the oauth token of the account you want to use.
Although everybody can see the web interface of the SystemAPI PHP Tool, it is important that the user account associated with the parameter $voipnow_access_token is allowed to access the SystemAPI web service. For more information on how to generate an access token for your application, please check Access Management document. |
To access the interface, simply visit https://<IP>/<PATH_TO_SYSTEMAPI_TOOL>/index.php
.
Please note that you cannot access the application unless you have set it up before. Otherwise, you will receive a warning message with the issues you need to fix, just as shown below:
Problem | Solution |
---|---|
Current PHP version > 5.1.2 setup is not validated | You should check your PHP installation. |
PHP is configured with --enable-soap setup is not validated | You should make sure the PHP is compiled using the --enable-soap option. |
VoipNow SystemAPI is reachable setup is not validated | You should check the configuration file and make sure you have correctly set the server or connection parameters. |
Once the configuration process is complete, you can access the interface and use the following features:
In this section of the application, you can add accounts to VoipNow. The following information can be set using the form:
Parameter | Required | Description |
---|---|---|
Company | No | The company name of the user |
Contact name | Yes | The contact name of the user |
Login | Yes | Username for the new account |
Password | Yes | Password for the new account |
Phone | No | Phone number of the new account |
Fax | No | Fax number of the new account |
No | Email of the new account | |
Address | No | Address of the new account |
City | No | City for the new account |
Postal/ZIP code | No | Postal/ZIP code for the new account |
Country | Yes | Select a country from the list of countries |
Region | Yes | Select a region from the list |
Timezone | Yes | Timezone that will be used by the new account |
Interface language | Yes | User interface language |
Phone language | Yes | The language of the user phone |
Notes | No | More notes about the account |
Set the $account_type in the configuration file to the account type you want to add:
To create a user by means of a template, you must set the configuration variable $template_id to a valid VoipNow template ID. The SystemAPI web service allows you to get the list of all the templates in the system by calling GetTemplates, an operation available under the PBX component. For more details on how to use this operation, please read SystemAPI documentation.
To create a user by means of a charging plan, you must set the configuration variable $billing_plan_id to a valid VoipNow charging plan ID. The SystemAPI web service allows you to get the list of all the charging plans in the system by calling GetTemplates, an operation available under the PBX component. For more details on how to use this operation, please read SystemAPI documentation.
By using this section of the application, you can fetch call stats for a specific user, month, and year from the VoipNow system. You can set the information using the form, as explained below:
Parameter | Description |
---|---|
Account Type | The account type subject to statistics |
<Account Name> | According to the option selected for Account Type, this will be filled with all the service provider, organization or user account identifiers |
Month | Month when the calls were made |
Year | Year when the calls were made |