© 2015 X2Engine Inc.

VoIP Integration

From X2Engine
Revision as of 21:36, 31 December 2013 by Demitri (talk | contribs) (Created page with "Category:Development To a limited extent, X2CRM currently supports integration with VoIP phone systems (such as Asterisk servers) in the form of inbound call notifications...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

To a limited extent, X2CRM currently supports integration with VoIP phone systems (such as Asterisk servers) in the form of inbound call notifications and "screen pops". While this is still somewhat a proof-of-concept, setting it up to work is fully within the reach of the technically-inclined user with administrative access to the VoIP system and X2CRM installation, and it is very useful in expediting the retrieval of customer data when taking a call.

What it does

A customer, whose phone number is saved in X2CRM, calls the organization. As soon as the call session is initiated with the VoIP system, the VoIP system makes a web request to X2CRM's web API with the caller ID. The call is then recorded, and shows up inside X2CRM, in three places:

  1. The activity feed, with a link to the contact;
  2. As a notification for the user who has been assigned that contact, or for all users if the contact is unassigned;
  3. In the action history on that contact record.

Additionally, if the contact is not assigned to "anyone", and the user to whom the contact is assigned does not have pop-up blocking enabled, a pop-up window will appear on the assignee's screen displaying the contact record, thus immediately displaying to that representative the full history of interaction with the customer.

What it requires in order to work

In essence, at the most basic level, the phone system must be connected to the internet, and must be configurable such that it makes an appropriate HTTP/HTTPS request (of type GET) to X2CRM at the right time. How this will work in different phone systems can vary widely, but the basics of how the API call must be made is described in Remote API: Inbound VoIP call notifications.

If the VoIP system is Asterisk-based, supports AGI interaction, and has PHP installed on it, a script included in the source code of X2CRM Professional Edition can be used instead of having to write a script from scratch. The rest of this article will cover the usage of this script.

Using the included script for Asterisk integration

The script for Asterisk integration, named callX2CRM.php, is included in the X2CRM source code inside the directory integration/FreePBX. It requires the following two files be present in the same directory where it will be run:

  1. The PHPAGI class (and with the filename phpagi.php)
  2. A copy of the standalone APIModel class from X2CRM, which can be found in protected/models

All three of these files (callX2CRM.php and its dependencies) must then be placed in the agi-bin directory on the Asterisk server to allow easily inserting it as an application call into the dialplan.

Finally, the script itself must be configured appropriately. Near the top of the file, one will find the following global string variables that must be properly defined:

$baseUrl
The URL to the entry script (index.php) of X2CRM. For example, if your CRM is hosted in http://example.com/crm, you will put for the value of this variable http://example.com/crm/index.php.
$user
The user of X2CRM to use for API authentication, when necessary.
$userKey
The API key of the X2CRM user for API authentication.

Case example: FreePBX integration

In the case of FreePBX,