Howto:Initiate a Mobility CallBack via simple HTTP GET or POST request

From innovaphone-wiki

Jump to: navigation, search

This article describes how to setup a PHP script to enable CallBack on Mobility devices supporting IP CallBack only via simple HTTP GET or POST request.

Contents

Applies To

This information applies to

  • innovaphone PBX, V9 hotfix 3
  • PHP, version 5.2

or, for the stand-alone Version

  • innovaphone PBX, V9 hotfix 6

More Information

The innovaphone PBX supports CallBack via IP using 2 methods:

  • make a simple HTTP GET request (introduced in PBX Firmware V9 hotfix6)
  • with a SOAP method MakeCall (supported by all PBX Version with Mobility Functionality)


Method 1: HTTP GET Request

The callback request can also be placed directly to the PBX. The URL to use is:

http://x.x.x.x/PBX0/ADMIN/pbx_makecall.txt?cn=<Long Name>&hw=<Mobility Device>&e164=<Destination Number>

where:

  • cn - is the Long Name of the PBX User Object the call should be initiated from
  • hw - is the Device name configured under Mobility settings of the PBX User Object the call should be initiated from
  • e164 - the destination number that should be called from the PBX User Object you have defined under cn


As reply the PBX will deliver a HTTP OK Response message OK with message body containing a status code:

  • 1 - NOK, the request failed
  • 15 - OK, the call will be initiated to the mobility device


This method essentially does the same as the previous method and does not require any middle-ware such as Web server and PHP. However, it is restricted to mobility devices (no other devices are supported). Also, it obviously needs the PBX to be accessible via IP by the requesting clients (i.e. mobile phones). Finally, as with the other method, the reqauest must be placed with the "right" PBX, that is, the PBX that is configured as the registration PBX of the user. Unfortunately, there is no method available to determine the "right" PBX other than SOAP. So if this is a concern - cause you have multiple PBXs - then you should use the SOAP path right away.


Method 2: SOAP MakeCall

Callback to a mobility device can be triggered via SOAP API for all User Devices registered on it, and thus also for Mobility Fork destinations.

In order to use this CallBack feature SOAP API must be used. If only a simple HTTP GET or POST is supported on client side, a sample PHP script described in this article, can be used to convert simple HTTP requests to SOAP messages for PBX.

$/wiki-src/xml/IPCallBack/

Configuration

First download the sample PHP script and extract it to a folder on your PHP 5.2 enabled web server.

The sample contains following files:

innopbx.class.php 
PHP implementation of SOAP API for innovaphone PBX
logger.class.php 
simple logger for debugging, writes into local text file log.txt. If you enable logging, make sure HTTP Server can write to this file (e.g. execute touch log.txt;chmod a+w log.txt on linux).
mobility.php 
sample script

In the mobility.php adjust the PBX IP address and HTTP/SOAP credentials. The SOAP credentials must be configured on the PBX in the same way as for TSP.

The mobility.php script takes parameters for call back from POST or GET request and initiates a call via SOAP API. The HTTP credentials for SOAP session are hard coded in the PHP script (you may change it to submit the credentials with each HTTP request).

Example GET request with following URL:

http://192.168.0.1/mobility.php?cn=Reiner%20Zufall&e164=123&hw=iphone

In this example a User Reiner Zufall will call phone number 123 and will use device iphone:

  • The PBX Object with Long Name Reiner Zufall is used to start the call
  • The phone number 123 will be called after the callback is answered on mobility device
  • The Mobility Fork Destination with Device labelled iphone

Known Problems

Call ID 0, Cant call on behalf of user...

If you get valid User Session ID (not 0), but Call ID is always 0, check the Mobility Device setting(hw):

[07.09.2011 16:43:21] /ipcallback/mobility.php  HTTP request Array
(
    [cn] => My User
    [e164] => 106
    [hw] => iphone
)

[07.09.2011 16:43:21] /ipcallback/mobility.php  Obtaining a user handle for My User...
[07.09.2011 16:43:21] /ipcallback/mobility.php  User Session ID 3780
[07.09.2011 16:43:21] /ipcallback/mobility.php  Start callback from My User to 106...
[07.09.2011 16:43:21] /ipcallback/mobility.php  Call ID 0
[07.09.2011 16:43:21] /ipcallback/mobility.php  Cant call on behalf of user My User (3780)

In this case, iphone should be configured on Users Mobility Fork destination as Device.

Distributed PBXs

The PHP code in mobility.php only supports a single PBX (no standby, no slaves). Multi-node operation could be implemented by introducing a first step that resolves the user name to the proper PBX (using LocationURL()).

Download

Related Articles

Personal tools