-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sessiontalk Cloudphone Provisioning (#147)
* Sessiontalk Provisioning Allows for auto provisioning of Sessiontalk's Cloudphone with push. * Delete apple_app_store.png * Delete google_play.png * Create README.rst
- Loading branch information
Showing
9 changed files
with
574 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
********* | ||
SessionTalk | ||
********* | ||
|
||
SessionTalk's CloudPhone is a softphone available for iOS and Android devices with PUSH notification available. This app is designed to work with their cloud provisioning services. | ||
|
||
Prerequisites | ||
^^^^^^^^^^^^^^ | ||
|
||
* Working install of FusionPBX | ||
* Create an App at https://cloud.sessiontalk.co.uk/ | ||
* Use "Username, Password & Subdomain" for the Login Fields | ||
* Provider Name (Same as FusionPBX Default Settings) | ||
* External Provisioning URL: https://mydomain.com/app/sessiontalk/provision.php | ||
* Set everything else up according to your needs | ||
|
||
|
||
Install Steps | ||
^^^^^^^^^^^^^^ | ||
|
||
On your server | ||
|
||
:: | ||
|
||
cd /usr/src | ||
git clone https://github.com/fusionpbx/fusionpbx-apps | ||
Move the directory 'sessiontalk' into your main FusionPBX directory | ||
mv fusionpbx-apps/sessiontalk /var/www/fusionpbx/app | ||
chown -R www-data:www-data /var/www/fusionpbx/app/sessiontalk | ||
|
||
:: | ||
|
||
Log into the FusionPBX webpage | ||
Advanced -> Upgrade | ||
Menu Defaults and Permission Defaults. | ||
Log out and back in. | ||
:: | ||
|
||
Set your Sessiontalk provider ID in Default Settings | ||
Advanced -> Default Settings | ||
Provision :sessiontalk_provider_id | ||
:: | ||
|
||
Create an API for each user that needs access to the softphone | ||
Accounts -> Users | ||
Generate API Key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
//application details | ||
$apps[$x]['name'] = "Sessiontalk"; | ||
$apps[$x]['uuid'] = "85774108-716c-46cb-a34b-ce80b212bc82"; | ||
$apps[$x]['category'] = "Vendor"; | ||
$apps[$x]['subcategory'] = ""; | ||
$apps[$x]['version'] = "1.0"; | ||
$apps[$x]['license'] = "Mozilla Public License 1.1"; | ||
$apps[$x]['url'] = "http://www.fusionpbx.com"; | ||
$apps[$x]['description']['en-us'] = ""; | ||
$apps[$x]['description']['en-gb'] = ""; | ||
$apps[$x]['description']['ar-eg'] = ""; | ||
$apps[$x]['description']['de-at'] = ""; | ||
$apps[$x]['description']['de-ch'] = ""; | ||
$apps[$x]['description']['de-de'] = ""; | ||
$apps[$x]['description']['es-cl'] = ""; | ||
$apps[$x]['description']['es-mx'] = ""; | ||
$apps[$x]['description']['fr-ca'] = ""; | ||
$apps[$x]['description']['fr-fr'] = ""; | ||
$apps[$x]['description']['he-il'] = ""; | ||
$apps[$x]['description']['it-it'] = ""; | ||
$apps[$x]['description']['nl-nl'] = ""; | ||
$apps[$x]['description']['pl-pl'] = ""; | ||
$apps[$x]['description']['pt-br'] = ""; | ||
$apps[$x]['description']['pt-pt'] = ""; | ||
$apps[$x]['description']['ro-ro'] = ""; | ||
$apps[$x]['description']['ru-ru'] = ""; | ||
$apps[$x]['description']['sv-se'] = ""; | ||
$apps[$x]['description']['uk-ua'] = ""; | ||
|
||
//permission details | ||
$y=0; | ||
$apps[$x]['permissions'][$y]['name'] = "sessiontalk_view"; | ||
$apps[$x]['permissions'][$y]['groups'][] = "user"; | ||
$apps[$x]['permissions'][$y]['groups'][] = "admin"; | ||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin"; | ||
$y++; | ||
|
||
//default settings | ||
$y=0; | ||
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "67d5e1a7-d0b1-4f3a-b329-fabfb235b0c3"; | ||
$apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; | ||
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "sessiontalk_provider_id"; | ||
$apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; | ||
$apps[$x]['default_settings'][$y]['default_setting_value'] = ""; | ||
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; | ||
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Sessiontalk Provider ID"; | ||
$y++; | ||
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "f90a2cd2-55e3-42bf-a6b5-8c9db28ecc9b"; | ||
$apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; | ||
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "sessiontalk_transport"; | ||
$apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; | ||
$apps[$x]['default_settings'][$y]['default_setting_value'] = "UDP"; | ||
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; | ||
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Sessiontalk Transport"; | ||
$y++; | ||
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "432d9632-eafd-43ef-8955-3a510504c83f"; | ||
$apps[$x]['default_settings'][$y]['default_setting_category'] = "provision"; | ||
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "sessiontalk_srtp"; | ||
$apps[$x]['default_settings'][$y]['default_setting_name'] = "text"; | ||
$apps[$x]['default_settings'][$y]['default_setting_value'] = "Disabled"; | ||
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true"; | ||
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Sessiontalk SRTP"; | ||
$y++; | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
$text['title-sessiontalk']['en-us'] = "Sessiontalk"; | ||
$text['title-sessiontalk']['en-gb'] = "Sessiontalk"; | ||
$text['title-sessiontalk']['ar-eg'] = ""; | ||
$text['title-sessiontalk']['de-at'] = ""; | ||
$text['title-sessiontalk']['de-ch'] = ""; | ||
$text['title-sessiontalk']['de-de'] = ""; | ||
$text['title-sessiontalk']['es-cl'] = ""; | ||
$text['title-sessiontalk']['es-mx'] = ""; | ||
$text['title-sessiontalk']['fr-ca'] = "Sessiontalk"; | ||
$text['title-sessiontalk']['fr-fr'] = "Sessiontalk"; | ||
$text['title-sessiontalk']['he-il'] = ""; | ||
$text['title-sessiontalk']['it-it'] = ""; | ||
$text['title-sessiontalk']['nl-nl'] = "Sessiontalk"; | ||
$text['title-sessiontalk']['pl-pl'] = ""; | ||
$text['title-sessiontalk']['pt-br'] = ""; | ||
$text['title-sessiontalk']['pt-pt'] = ""; | ||
$text['title-sessiontalk']['ro-ro'] = ""; | ||
$text['title-sessiontalk']['ru-ru'] = ""; | ||
$text['title-sessiontalk']['sv-se'] = ""; | ||
$text['title-sessiontalk']['uk-ua'] = ""; | ||
|
||
$text['title_description-sessiontalk']['en-us'] = "Sessiontalk is a soft phone for smart phones or tablets. It can be configured easily with a QR code provided here. To use it download and install Sessiontalk for your device. Start the application and then go to Account Settings press the + to add a new account. Press on UCM Account (Scan QR Code) and then select the extension and scan the QR code."; | ||
$text['title_description-sessiontalk']['en-gb'] = "Sessiontalk is a soft phone for smart phones or tablets. It can be configured easily with a QR code provided here. To use it download and install Sessiontalk for your device. Start the application and then go to Account Settings press the + to add a new account. Press on UCM Account (Scan QR Code) and then select the extension and scan the QR code."; | ||
$text['title_description-sessiontalk']['ar-eg'] = ""; | ||
$text['title_description-sessiontalk']['de-at'] = ""; | ||
$text['title_description-sessiontalk']['de-ch'] = ""; | ||
$text['title_description-sessiontalk']['de-de'] = ""; | ||
$text['title_description-sessiontalk']['es-cl'] = ""; | ||
$text['title_description-sessiontalk']['es-mx'] = ""; | ||
$text['title_description-sessiontalk']['fr-ca'] = "Sessiontalk est un logiciel de téléphonie pour smartphones ou tablettes. Il peut être configuré facilement avec un code QR fourni ici. Pour l'utiliser, téléchargez et installez Sessiontalk sur votre appareil. Lancez l'application, puis allez dans les paramètres du compte, appuyez sur le signe + pour ajouter un nouveau compte. Appuyez sur Compte UCM (Scan QR Code), puis sélectionnez l’extension et scannez le code QR."; | ||
$text['title_description-sessiontalk']['fr-fr'] = "Sessiontalk est un logiciel de téléphonie pour smartphones ou tablettes. Il peut être configuré facilement avec un code QR fourni ici. Pour l'utiliser, téléchargez et installez Sessiontalk sur votre appareil. Lancez l'application, puis allez dans les paramètres du compte, appuyez sur le signe + pour ajouter un nouveau compte. Appuyez sur Compte UCM (Scan QR Code), puis sélectionnez l’extension et scannez le code QR."; | ||
$text['title_description-sessiontalk']['he-il'] = ""; | ||
$text['title_description-sessiontalk']['it-it'] = ""; | ||
$text['title_description-sessiontalk']['nl-nl'] = "Sessiontalk is een software telefoon voor 'smart-phones' en 'tablets'. Het kan eenvoudig d.m.v. een QR code voorzien worden van configuratie. Installeer Granstream Wave op je apparaat start de applicatie en ga naar ' Account Settings' en druk op + om een nieuwaccount toe te voegen. Druk op 'UCM account' (Scan QR Code) and kies het toestelnummer en scan de QR code met het apparaat."; | ||
$text['title_description-sessiontalk']['pl-pl'] = ""; | ||
$text['title_description-sessiontalk']['pt-br'] = ""; | ||
$text['title_description-sessiontalk']['pt-pt'] = ""; | ||
$text['title_description-sessiontalk']['ro-ro'] = ""; | ||
$text['title_description-sessiontalk']['ru-ru'] = ""; | ||
$text['title_description-sessiontalk']['sv-se'] = ""; | ||
$text['title_description-sessiontalk']['uk-ua'] = ""; | ||
|
||
$text['label-extension']['en-us'] = "Extension"; | ||
$text['label-extension']['en-gb'] = "Extension"; | ||
$text['label-extension']['ar-eg'] = "رقم داخلي"; | ||
$text['label-extension']['de-at'] = "Nebenstelle"; //copied from de-de | ||
$text['label-extension']['de-ch'] = "Nebenstelle"; //copied from de-de | ||
$text['label-extension']['de-de'] = "Nebenstelle"; | ||
$text['label-extension']['es-cl'] = "Extensión"; | ||
$text['label-extension']['es-mx'] = "Extensión"; //copied from es-cl | ||
$text['label-extension']['fr-ca'] = "Extension"; //copied from fr-fr | ||
$text['label-extension']['fr-fr'] = "Extension"; | ||
$text['label-extension']['he-il'] = "שלוחה"; | ||
$text['label-extension']['it-it'] = "Interno"; | ||
$text['label-extension']['nl-nl'] = "Toestel"; | ||
$text['label-extension']['pl-pl'] = "Numer wewnętrzny"; | ||
$text['label-extension']['pt-br'] = "Ramal"; | ||
$text['label-extension']['pt-pt'] = "Extensão"; | ||
$text['label-extension']['ro-ro'] = ""; | ||
$text['label-extension']['ru-ru'] = "Внутренний Номер"; | ||
$text['label-extension']['sv-se'] = "Anknytning"; | ||
$text['label-extension']['uk-ua'] = "Розширення"; | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
$y=0; | ||
$apps[$x]['menu'][$y]['title']['en-us'] = "Sessiontalk"; | ||
$apps[$x]['menu'][$y]['title']['en-gb'] = "Sessiontalk"; | ||
$apps[$x]['menu'][$y]['title']['ar-eg'] = ""; | ||
$apps[$x]['menu'][$y]['title']['de-at'] = ""; | ||
$apps[$x]['menu'][$y]['title']['de-de'] = ""; | ||
$apps[$x]['menu'][$y]['title']['es-cl'] = ""; | ||
$apps[$x]['menu'][$y]['title']['es-mx'] = ""; | ||
$apps[$x]['menu'][$y]['title']['fr-ca'] = ""; | ||
$apps[$x]['menu'][$y]['title']['fr-fr'] = ""; | ||
$apps[$x]['menu'][$y]['title']['he-il'] = ""; | ||
$apps[$x]['menu'][$y]['title']['it-it'] = ""; | ||
$apps[$x]['menu'][$y]['title']['nl-nl'] = ""; | ||
$apps[$x]['menu'][$y]['title']['pl-pl'] = ""; | ||
$apps[$x]['menu'][$y]['title']['pt-br'] = ""; | ||
$apps[$x]['menu'][$y]['title']['pt-pt'] = ""; | ||
$apps[$x]['menu'][$y]['title']['ro-ro'] = ""; | ||
$apps[$x]['menu'][$y]['title']['ru-ru'] = ""; | ||
$apps[$x]['menu'][$y]['title']['sv-se'] = ""; | ||
$apps[$x]['menu'][$y]['title']['uk-ua'] = ""; | ||
$apps[$x]['menu'][$y]['uuid'] = "e98894cd-ec12-447b-812d-54163fc67ca9"; | ||
$apps[$x]['menu'][$y]['parent_uuid'] = "fd29e39c-c936-f5fc-8e2b-611681b266b5"; | ||
$apps[$x]['menu'][$y]['category'] = "internal"; | ||
$apps[$x]['menu'][$y]['path'] = "/app/sessiontalk/index.php"; | ||
$apps[$x]['menu'][$y]['groups'][] = "superadmin"; | ||
$apps[$x]['menu'][$y]['groups'][] = "admin"; | ||
$apps[$x]['menu'][$y]['groups'][] = "user"; | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
<?php | ||
/* | ||
FusionPBX | ||
Version: MPL 1.1 | ||
The contents of this file are subject to the Mozilla Public License Version | ||
1.1 (the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
http://www.mozilla.org/MPL/ | ||
Software distributed under the License is distributed on an "AS IS" basis, | ||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | ||
for the specific language governing rights and limitations under the | ||
License. | ||
The Original Code is FusionPBX | ||
The Initial Developer of the Original Code is | ||
Mark J Crane <[email protected]> | ||
Portions created by the Initial Developer are Copyright (C) 2008-2020 | ||
the Initial Developer. All Rights Reserved. | ||
Contributor(s): | ||
Mark J Crane <[email protected]> | ||
KonradSC <[email protected]> | ||
*/ | ||
|
||
//includes | ||
require_once "root.php"; | ||
require_once "resources/require.php"; | ||
require_once "resources/check_auth.php"; | ||
|
||
//check permissions | ||
if (permission_exists('sessiontalk_view')) { | ||
//access granted | ||
} | ||
else { | ||
echo "access denied"; | ||
exit; | ||
} | ||
|
||
//add multi-lingual support | ||
$language = new text; | ||
$text = $language->get(); | ||
|
||
//verify the id is as uuid then set as a variable | ||
if (is_uuid($_GET['id'])) { | ||
$extension_uuid = $_GET['id']; | ||
} | ||
|
||
//get the extension(s) | ||
if (permission_exists('extension_edit')) { | ||
//admin user | ||
$sql = "SELECT e.extension_uuid, e.extension, e.description, u.api_key, e.number_alias "; | ||
$sql .= "FROM v_extensions AS e, v_extension_users AS eu, v_users AS u "; | ||
$sql .= "WHERE e.domain_uuid = :domain_uuid "; | ||
$sql .= "AND e.enabled = 'true' "; | ||
$sql .= "AND e.extension_uuid = eu.extension_uuid "; | ||
$sql .= "AND eu.user_uuid = u.user_uuid "; | ||
$sql .= "order by e.extension asc "; | ||
} | ||
else { | ||
//normal user | ||
$sql = "SELECT e.extension_uuid, e.extension, e.description, u.api_key, e.number_alias "; | ||
$sql .= "FROM v_extensions AS e, v_extension_users AS eu, v_users AS u "; | ||
$sql .= "WHERE e.domain_uuid = :domain_uuid "; | ||
$sql .= "AND eu.user_uuid = :user_uuid "; | ||
$sql .= "AND e.extension_uuid = eu.extension_uuid "; | ||
$sql .= "AND eu.user_uuid = u.user_uuid "; | ||
$sql .= "order by e.extension asc "; | ||
|
||
// $sql .= "where e.extension_uuid = eu.extension_uuid "; | ||
// $sql .= "and e.domain_uuid = :domain_uuid "; | ||
// $sql .= "and e.enabled = 'true' "; | ||
// $sql .= "order by e.extension asc "; | ||
$parameters['user_uuid'] = $_SESSION['user']['user_uuid']; | ||
} | ||
$parameters['domain_uuid'] = $_SESSION['domain_uuid']; | ||
$database = new database; | ||
$extensions = $database->select($sql, $parameters, 'all'); | ||
//echo $sql; | ||
//exit; | ||
unset($sql, $parameters); | ||
|
||
if (is_uuid($extension_uuid) && is_array($extensions) && @sizeof($extensions) != 0) { | ||
|
||
//loop through get selected extension | ||
if (is_array($extensions) && @sizeof($extensions) != 0) { | ||
foreach ($extensions as $extension) { | ||
if ($extension['extension_uuid'] == $extension_uuid) { | ||
$field = $extension; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
//get the username | ||
$username = $field['extension']; | ||
if (isset($field['number_alias']) && strlen($field['number_alias']) > 0) { | ||
$username = $field['number_alias']; | ||
} | ||
|
||
$qr_content = "scsc:". $username . "@" . $_SESSION['domain_name'] . ":". $field['api_key'] . ":" . $_SESSION['provision']['sessiontalk_provider_id']['text']; | ||
|
||
} | ||
|
||
//debian | ||
//apt install qrencode | ||
|
||
//include the header | ||
$document['title'] = $text['title-sessiontalk']; | ||
require_once "resources/header.php"; | ||
|
||
//show the content | ||
echo "<form name='frm' id='frm' method='get'>\n"; | ||
|
||
echo "<div class='action_bar' id='action_bar'>\n"; | ||
echo " <div class='heading'><b>".$text['title-sessiontalk']."</b></div>\n"; | ||
echo " <div class='actions'>\n"; | ||
echo " <a href='https://play.google.com/store/apps/details?id=co.froute.sessioncloud' target='_blank'><img src='/app/sessiontalk/resources/images/google_play.png' style='width: auto; height: 30px;' /></a>"; | ||
echo " <a href='https://apps.apple.com/us/app/sessioncloud-sip-softphone/id1065327562' target='_blank'><img src='/app/sessiontalk/resources/images/apple_app_store.png' style='width: auto; height: 30px;' /></a>"; | ||
echo " </div>\n"; | ||
echo " <div style='clear: both;'></div>\n"; | ||
echo "</div>\n"; | ||
|
||
echo $text['title_description-sessiontalk']."\n"; | ||
echo "<br /><br />\n"; | ||
echo $qr_content; | ||
echo "<div style='text-align: center; white-space: nowrap; margin: 10px 0 40px 0;'>"; | ||
echo $text['label-extension']."<br />\n"; | ||
echo "<select name='id' class='formfld' onchange='this.form.submit();'>\n"; | ||
echo " <option value='' >".$text['label-select']."...</option>\n"; | ||
if (is_array($extensions) && @sizeof($extensions) != 0) { | ||
foreach ($extensions as $row) { | ||
$selected = $row['extension_uuid'] == $extension_uuid ? "selected='selected'" : null; | ||
echo " <option value='".escape($row['extension_uuid'])."' ".$selected.">".escape($row['extension'])." ".escape($row['number_alias'])." ".escape($row['description'])."</option>\n"; | ||
} | ||
} | ||
echo "</select>\n"; | ||
|
||
echo "</form>\n"; | ||
echo "<br>\n"; | ||
|
||
|
||
//stream the file | ||
if (is_uuid($extension_uuid)) { | ||
$qr_content = html_entity_decode( $qr_content, ENT_QUOTES, 'UTF-8' ); | ||
|
||
require_once 'resources/qr_code/QRErrorCorrectLevel.php'; | ||
require_once 'resources/qr_code/QRCode.php'; | ||
require_once 'resources/qr_code/QRCodeImage.php'; | ||
|
||
try { | ||
$code = new QRCode (- 1, QRErrorCorrectLevel::H); | ||
$code->addData($qr_content); | ||
$code->make(); | ||
|
||
$img = new QRCodeImage ($code, $width=420, $height=420, $quality=50); | ||
$img->draw(); | ||
$image = $img->getImage(); | ||
$img->finish(); | ||
} | ||
catch (Exception $error) { | ||
echo $error; | ||
} | ||
} | ||
|
||
//html image | ||
if (is_uuid($extension_uuid)) { | ||
echo "<img src=\"data:image/jpeg;base64,".base64_encode($image)."\" style='margin-top: 30px; padding: 5px; background: white; max-width: 100%;'>\n"; | ||
} | ||
|
||
echo "</div>\n"; | ||
|
||
//add the footer | ||
require_once "resources/footer.php"; | ||
|
||
?> |
Oops, something went wrong.