Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated using 4PSA automated script

Excerpt

This example written in C++ allows developers to manage VoipNow manage VoipNow accounts and view information about calls. Download.

Table of Contents
maxLevel3

Note

This demonstrative code SHOULD NOT be used in production. It is designed to show how a client application interacts with the VoipNow the VoipNow SystemAPI. From this perspective, validations and error-checks aiming to demonstrate the most common mistakes are minimal and can be done easily.

...

STEP 7: After you have installed all the prerequisite tools and you have your schema files, you need to compile the voipnowservice.wsdl file from your schema folder. It is recommended that you use wsdl2h, that is the application provided by gSOAP. You can find it in your gsoap directory, i.e. /<PATH_TO_GSOAP>/bin.

Navigate to to /<PATH_TO_GSOAP>/bin and run the followin command to compile the WSDL:

...

To make things easy, we copied all the 4PSA VoipNow schemes 4PSA VoipNow schemes to /<PATH_TO_GSOAP>/bin. Otherwise, you must specify the full path to voipnowservice.wsdl.

...

Tip

You can now use the recently created classes to write applications that interact with your VoipNow your VoipNow server.

You will notice that after running the applications, there are three files in your application folder: TEST.LOG, SENT.LOG, and RECV.LOG; they contain useful logs about your application:

...

Note

Although everybody can use the SystemAPI C++ example, it is important that the user account used to connect to the VoipNow the VoipNow server is allowed to access the SystemAPI web service. For more information, please read the Access Management section.

...

This type of authentication requires that you provide a valid access token that is generated through generated through an OAuth flow using the key and secret of your application. The code should look like this:

...

For more information on how to generate an access token for your application, please check Access Management document.

Examples

The The SystemAPI C++ Tool contains demo applications that simulate the following operations:

  • add a Service Provider Account,  
  • add an Organization Account,  
  • add a User Account,  
  • add an Extension Account,
  • get the Call Costs for a User Account.

...

Adding Other Account Types

Tip

These examples can be found in the package downloaded with the SystemAPI Cexamples can be found in the package downloaded with the SystemAPI C++  ToolTool.

If you wish to add other account types (organizations, extensions or users), there is not much to change from the program listed above. First of all, you will need to create the proper object, so instead of writing:

...

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