Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt

This page describes an App that uses UnifiedAPI to invite a group of users to a conference call. Download.

Table of Contents
maxLevel2

Note
titleThe code is on GitHub

Download here. Do not hesitate to contribute in order to make this example better - we welcome Pull Requests!This demonstrative code SHOULD NOT be used in production. It is designed to show how an App interacts with UnifiedAPI. From this perspective, validations and error-checks aiming to demonstrate the most common mistakes are minimal and can be done easily.

Overview

Click2Conference is an App written in PHP that enables users to invite anyone to a conference call. It uses the PhoneCall resource exposed by Unified API and the following request:

...

  • .

Installation

In order to be able to use the Click2Conference App, you need a webserver web server with PHP 5.2.14 3 or higher installed.

STEP 1:  Download the files.Download the archive, extract the files, and copy them to a Switch to the directory that can be accessed over the Web.web (e.g /var/www/html) and download the files.

Shell
git clone https://github.com/4psa/app-click2conf.git

STEP 2: Proceed to allowing permissions and ownership rights.

You also need to give proper permissions and ownership rights to the files of the App. The App must be owned by the webserver user and group. For example, if we use httpd as a webserver:

Shell
chmod -R 755 <PATH_TO_Click2Conference>
chown -R httpd:httpd <PATH_TO_Click2Conference
 

STEP 3: STEP 2: Configure the App.

In order to use the App, you must configure it by opening the file <PATH_TO_Click2Conference>/interfaceconfig/config.php and changing the following settings:

...

Code Block
php
php
$config['GROUPS']['Office'] = array(
    "0003*001",
    "0003*002",
    "0003*011"
    );

$config['GROUPS']['Remote'] = array(
    "124141",
    "124142",
    "124145"
    );


STEP
3: Proceed to allowing permissions and ownership rights.

You also need to give proper permissions and ownership rights to the files of the App. The App must be owned by the webserver user and group. For example, if we use httpd as a webserver:

Code Block
chmod -R 755 <PATH_TO_Click2Conference>
chwon -R httpd:httpd <PATH_TO_Click2Conference

STEP 4: Schedule a conference as explained in the Conference Extension section of the User Documentation.

Behavior

User Interface

As soon as the setup process is complete, you can access the interface at https://<hostname>/<PATH_TO_Click2Conference>/index.php. The page displays a drop-down menu and a button as shown in the image below.

...

Groups example.

The drop-down menu lists menu lists all the groups set up earlier. Choose one group and click on the Invite group button. This invites all the phone numbers belonging to that group to a conference call.

...

Suppose you have added a custom group called group called Office including all your colleagues. You want to call all of them to have a brainstorming session on the phone. All you need to do is select the Office group from the drop-down and the VoipNow server calls all of them. Don't forget to include your own number in the list, so that you can participate in the call as well.

...

The code that makes the request can be found in <Path_To_CallMeButton>/interface/plib/request.php and and is described below:

Code Block
php
php
// Fetch token
$token = getToken();
$headers = array(
   'Content-type' => 'application/json',
   'Authorization' => $token
);
 
// Initialize the cURL request
$reqUrl = 'https://'.$config['VN_SERVER_IP'].'/uapi/phoneCalls/@me/conferenceInvite';
$request = new cURLRequest();
$request->setMethod(cURLRequest::METHOD_POST);
$request->setHeaders($headers); 
    
$jsonRequest = array(
	'extension' => $config['VN_CONFERENCE_EXT'],				    // Conference extension
	'phoneCallView' => array(
		array('source' => array($config['VN_CONFERENCE_EXT']),	   	// Conference extension
	          'destination' => $phoneNumber                 		// Phone number setup in a group
     )
);
$request->setBody(json_encode($jsonRequest));

// Receive the response in JSON format
$response = $request->sendRequest($reqUrl);									     

The source and  and extension must be set to the number of the conference extension.

...

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