Integrating Helpdesk and VoIP in 15 Minutes

How to link the existing telephone number to Helpdesk system and get tickets through it? By using VoIP technologies, of course.  Creators of Zendesk and Freshdesk implemented it in their system through built-in native PBX which supports IVR, voice mail and all other features typical for cloud IP PBX. At the same time, tickets are generated automatically and you can attach the recorded conversation. However, the cost of leasing telephone numbers and services of virtual PBX may not be affordable to many, and the list of countries where you can purchase numbers is limited. This may not be convenient as well, if the company already has a number known by many clients and it cannot be replaced. Developers of such systems as Live Agent or Vision Helpdesk took a simpler way and implemented telephone ticket channel with third party services like Twilio. Otherwise, the mechanism is the same as in Zendesk, automated creation of ticket with call details. In case with TwilioZendesk and Freshdesk telephony services is not free and is often expensive. What if your Helpdesk needs only a voice channel for incoming tickets and there’s no sense in paying extra for additional features? Well, link IP PBX and Helpdesk with the help of API. We decided to try it out on Freshdesk and IP telephony service with free cloud PBX Zadarma (full list is available in Zadarma Service Review). Zadarma was selected because of the variety of countries where numbers are sold and the cost of leasing cloud PBX. Freshdesk was selected because you can use it for free with up to three agents while API is available too. As a result you get everything almost for nothing. You will have to pay for telephone number only.

Setting up Interaction between IP PBX and HelpDesk

To communicate call details to HelpDesk we need to prepare a simple script which will get information from Zadarma and then create calls via API. We, for instance, prepared a script which communicates only subscriber’s number and beginning of the call. If necessary, you can add recorded call file which can be very convenient in HelpDesk. We put the script in our web-server. In Zadarma‘s API settings you need to specify your script’s address, plus take Key and Secret and write them in the script. zadarma api In Freshdesk you need to obtain API Key which is located in user settings. freshdesk api key Our code fit into 55 strings:


// Taken from
if (isset($_GET['zd_echo'])) exit($_GET['zd_echo']);

define('ZADARMA_IP', '');
define('API_SECRET', '5d8c53fdd59dh384dhjf83sff'); // You can get it from

$remoteIp = filter_input(INPUT_SERVER, 'REMOTE_ADDR');
$callerId = filter_input(INPUT_POST, 'caller_id'); // number of calling party;
$calledDid = filter_input(INPUT_POST, 'called_did'); // number of called party;
$callStart = filter_input(INPUT_POST, 'call_start'); // start time of call

if ($callStart && ($remoteIp == ZADARMA_IP)) {
 $signature = getHeader('Signature'); // Signature is send only if you have your API key and secret
 $signatureTest = base64_encode(hash_hmac('sha1', $callerId . $calledDid . $callStart, API_SECRET));
 if ($signature == $signatureTest)
 createFreshDeskTicket ($callerId);

function getHeader($name)
 $headers = getallheaders();
 foreach ($headers as $key => $val) {
 if ($key == $name) return $val;
 return null;

// Taken from
function createFreshDeskTicket ($phone) {
 $api_key = "alksdjhglakhsfiuwr9q34y";
 $password = "password";
 $yourdomain = "ergonotes";
 $ticket_data = json_encode(array(
 "description" => "Ticket from $phone",
 "subject" => "Ticket from $phone",
 "name" => $phone,
 "phone" => $phone,
 "priority" => 1,
 "status" => 2,
 "source"=> 3
 $url = "https://$";
 $ch = curl_init($url);
 $header[] = "Content-type: application/json";
 curl_setopt($ch, CURLOPT_POST, true);
 curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
 curl_setopt($ch, CURLOPT_HEADER, true);
 curl_setopt($ch, CURLOPT_USERPWD, "$api_key:$password");
 curl_setopt($ch, CURLOPT_POSTFIELDS, $ticket_data);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

Now that setup is over, lets try to call and watch how new ticket appears. Our description contains “Ticket from” and telephone number. In addition, telephone number is appears in From field too. And ticket channel will be called “By phone”. freshdesk-ticket-from-zadarma-728x414

Bottom line

Clearly you can create something similar with other HelpDesk systems and IP PBX, and communicate more parameters to HelpDesk, including call recording. In this article we considered the simplest scenario. We encourage you to comment and express your concerns, and we will gladly continue writing about HelpDesk integration with other systems.

[Total: 3    Average: 4.7/5]