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

From innovaphone wiki
Jump to navigation Jump to search
No edit summary
Line 68: Line 68:


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


<code>PBX0/ADMIN/mod_cmd.xml?cmd=makecall&cn=<i>cn</i>&hw=<i>device</i>&e164=<i>number</i></code>
<code>PBX0/ADMIN/pbx_makecall.txt?cn=<i>cn</i>&hw=<i>device</i>&e164=<i>number</i></code>


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.
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.


== Download ==
== Download ==

Revision as of 17:37, 12 January 2012

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.

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 4

More Information

The innovaphone PBX supports CallBack via IP using 2 methods

SOAP

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()).

Direct HTTP Request

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

PBX0/ADMIN/pbx_makecall.txt?cn=cn&hw=device&e164=number

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.

Download

Related Articles