Page tree

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

This example written in PHP allows users to manage VoipNow accounts and fetch call statistics.

How To Install It

System Requirements

In order to be able to use the SystemAPI PHP Tool, your system must be compliant with the requirements below:

  • Your system needs to have PHP 5.1.2 or any subsequent version installed.
  • PHP must be compiled using the --enable-soap configuration option.
  • The SystemAPI PHP Tool requires the PHP extension libxml - Version 2.5.4 or any subsequent version.

Setup

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.

How To Use It

Authentication

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.

Examples

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 validatedYou 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:

  • Adding accounts - allows you to add service providers, organizations, users and extensions;
  • Call costs - allows you to fetch statistics for certain accounts.

Add Accounts

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

Email

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:

  • If you want to add a Service Provider account, you can set the variable $account_type = "service provider", or simply select this account type in the form.
  • If you want to add an Organization account, you must set the $serviceprovider_id to the ID of the service provider that owns the new organization. You can set the variable $account_type = "organization", or simply select this account type in the form.
  • If you want to add a User account, you must set the $organization_id to the ID of the organization that owns the new user.You can set the variable $account_type = "user", or simply select this account type in the form.
  • If you want to add an Extension account, you must set the $user_id to the ID of the user that owns the new extension. You can set the variable $account_type = "extension", or simply select this account type in the form.

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.

Call Costs

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

#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))
  • No labels

Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 4.0 International.