Page tree

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

The code is on GitHub

Download here. Do not hesitate to contribute in order to make this example better - we welcome Pull Requests!

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 web server with PHP 5.3 or higher installed.

STEP 1: Switch to the directory that can be accessed over web (e.g /var/www/html) and download the files.

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:

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

STEP 3: Configure the App.

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

NameDescription
VN_SERVER_IPThe IP or hostname of your VoipNow server
VN_CONFERENCE_EXTThe extended number of a conference extension. When the members of a group are invited to a conference, the system connects this extension to the invited parties.
OAUTH_APP_IDOAuth App ID or key. A 32 char-long string used by the App to identify itself with the system.
Visit this page to see how the OAuth APP ID can be obtained.
OAUTH_APP_SECRETOAuth App Secret. A 32 char-long secret used by the system to establish ownership of the App ID or key.
Based on this pair, the system will recognize the new App and will allow it to generate an access token.
Visit this page to see how the Secret can be obtained.
GROUPSAn array containing the groups of public and local phone numbers.
These numbers are invited to the conference call. You can add as many groups as you like. The default group is used for demonstration purposes and can be changed.
Please note that the newly created app will not work properly unless you check the App is trusted option in the Add App form.
$config['GROUPS']['Office'] = array(
    "0003*001",
    "0003*002",
    "0003*011"
    );

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


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

Example

Suppose you have added a custom 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.

A warning about 'CURLOPT_FOLLOWLOCATION' is generated each time the request is made. Don't worry, this is ok and it won't interfere with the request.

Invite to a Scheduled Conference Flow

To invite the group to the conference, the App uses the Unified API  Create ConferenceInvite PhoneCalls request. For each number in the group, the App makes a request as the one below. It uses the extension defined in the config variable VN_CONFERENCE_EXT as extension and source of the call as in the example below. All fields are fictitious.

HTTP Request
POST /uapi/phoneCalls/@me/conferenceInvite HTTP/1.1
HOST x.x.x.x
Content Type: application/json
Authorization: <OAUTH_ACCESS_TOKEN>
 
{
  "extension":"<VN_CONFERENCE_EXT>",
  "phoneCallView":[
    {
       "source":["<VN_CONFERENCE_EXT>"],
       "destination":["8887777"]
       "callerId":"CallMeButton <8887777>"
    }
  ]
}

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

// 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 extension must be set to the number of the conference extension.

Behavior

STEP 1: The system first connects to VN_CONFERENCE_EXT

STEP 2: The system calls next the number of the group

STEP 3: The system connects the conference extension with the phone number returns the response using the JSON format. The response contains the phone call ID.

The Click2Conferece App does not specify whether a user has answered the call or not. It simply returns the status of the current UnifiedAPI request. In order to fetch the status of a call, you can make a UnifiedAPI List PhoneCalls request.

#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))
  • No labels

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