Add Grandstream Wave

This commit is contained in:
markjcrane 2018-08-08 14:27:48 +00:00
parent f346709450
commit 440fedcb5f
7 changed files with 391 additions and 0 deletions

31
app/gswave/app_config.php Normal file
View File

@ -0,0 +1,31 @@
<?php
//application details
$apps[$x]['name'] = "Grandstream Wave";
$apps[$x]['uuid'] = "29ad51b0-6ab0-4d65-9394-629d1a34580b";
$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']['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'] = "";
?>

View File

@ -0,0 +1,63 @@
<?php
$text['title-gswave']['en-us'] = "Grandstream Wave";
$text['title-gswave']['ar-eg'] = "";
$text['title-gswave']['de-at'] = "";
$text['title-gswave']['de-ch'] = "";
$text['title-gswave']['de-de'] = "";
$text['title-gswave']['es-cl'] = "";
$text['title-gswave']['es-mx'] = "";
$text['title-gswave']['fr-ca'] = "";
$text['title-gswave']['fr-fr'] = "";
$text['title-gswave']['he-il'] = "";
$text['title-gswave']['it-it'] = "";
$text['title-gswave']['nl-nl'] = "";
$text['title-gswave']['pl-pl'] = "";
$text['title-gswave']['pt-br'] = "";
$text['title-gswave']['pt-pt'] = "";
$text['title-gswave']['ro-ro'] = "";
$text['title-gswave']['ru-ru'] = "";
$text['title-gswave']['sv-se'] = "";
$text['title-gswave']['uk-ua'] = "";
$text['title_description-gswave']['en-us'] = "Grandstream Wave 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 Grandstream Wave 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-gswave']['ar-eg'] = "";
$text['title_description-gswave']['de-at'] = "";
$text['title_description-gswave']['de-ch'] = "";
$text['title_description-gswave']['de-de'] = "";
$text['title_description-gswave']['es-cl'] = "";
$text['title_description-gswave']['es-mx'] = "";
$text['title_description-gswave']['fr-ca'] = "";
$text['title_description-gswave']['fr-fr'] = "";
$text['title_description-gswave']['he-il'] = "";
$text['title_description-gswave']['it-it'] = "";
$text['title_description-gswave']['nl-nl'] = "";
$text['title_description-gswave']['pl-pl'] = "";
$text['title_description-gswave']['pt-br'] = "";
$text['title_description-gswave']['pt-pt'] = "";
$text['title_description-gswave']['ro-ro'] = "";
$text['title_description-gswave']['ru-ru'] = "";
$text['title_description-gswave']['sv-se'] = "";
$text['title_description-gswave']['uk-ua'] = "";
$text['label-extension']['en-us'] = "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'] = "";
$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'] = "Розширення";
?>

28
app/gswave/app_menu.php Normal file
View File

@ -0,0 +1,28 @@
<?php
$y=0;
$apps[$x]['menu'][$y]['title']['en-us'] = "GS Wave";
$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'] = "4c737fd8-145e-4e1d-9662-20a5ba1e82e0";
$apps[$x]['menu'][$y]['parent_uuid'] = "fd29e39c-c936-f5fc-8e2b-611681b266b5";
$apps[$x]['menu'][$y]['category'] = "internal";
$apps[$x]['menu'][$y]['path'] = "/app/gswave/index.php";
$apps[$x]['menu'][$y]['groups'][] = "superadmin";
?>

179
app/gswave/index.php Normal file
View File

@ -0,0 +1,179 @@
<?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 <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
//check permissions
if (permission_exists('extension_edit')) {
//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 extensions
$sql = "select * from v_extensions ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and enabled = 'true' ";
$sql .= "order by extension asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$extensions = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset ($prep_statement, $sql);
//get the extension
if (is_uuid($_GET['id'])) {
$sql = "select * from v_extensions ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and extension_uuid = '".$extension_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$extension = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$field = $extension[0];
unset ($prep_statement, $sql);
}
//get the username
$username = $field['extension'];
if (isset($row['number_alias']) && strlen($row['number_alias']) > 0) {
$username = $field['number_alias'];
}
//build the xml
if (is_uuid($_GET['id'])) {
$xml = "<?xml version='1.0' encoding='utf-8'?>";
$xml .= "<AccountConfig version='1'>";
$xml .= "<Account>";
$xml .= "<RegisterServer>".$_SESSION['domain_name']."</RegisterServer>";
//$xml .= "<OutboundServer>".$_SESSION['domain_name']."</OutboundServer>";
//$xml .= "<SecOutboundServer>".$_SESSION['domain_name']."</SecOutboundServer>";
$xml .= "<OutboundServer>".$_SESSION['domain_name'].":".$_SESSION['provision']['line_sip_port']['numeric']."</OutboundServer>";
$xml .= "<SecOutboundServer>".$_SESSION['domain_name'].":".$_SESSION['provision']['line_sip_port']['numeric']."</SecOutboundServer>";
$xml .= "<UserID>".$username."</UserID>";
$xml .= "<AuthID>".$username."</AuthID>";
$xml .= "<AuthPass>".$field['password']."</AuthPass>";
$xml .= "<AccountName>".$username."</AccountName>";
$xml .= "<DisplayName>".$username."</DisplayName>";
$xml .= "<Dialplan>{x+|*x+|*++}</Dialplan>";
$xml .= "<RandomPort>0</RandomPort>";
$xml .= "<Voicemail>*97</Voicemail>";
$xml .= "</Account>";
$xml .= "</AccountConfig>";
}
//debian
//apt install qrencode
//additional includes
require_once "resources/header.php";
//show the content
echo "<table width='100%' border='0'>\n";
echo " <tr>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['title-gswave']."</b></td>\n";
echo " <td width='50%' style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
//echo " <input type='button' class='btn' name='' alt='Grandstream Wave' onclick=\"window.location='http://www.grandstream.com/products/ip-voice-telephony/softphone-app/product/grandstream-wave'\" value='Website'>";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='2'>\n";
echo " <br />".$text['title_description-gswave']."<br /><br />\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
//show the content
echo "<form name='frm' id='frm' method='get' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
//echo "<tr>\n";
//echo "<td width='70%' colspan='2' align='left' valign='top'>\n";
//echo " <br />\n";
//echo "</td>\n";
//echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-extension']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <select class='formfld' onchange='this.form.submit();' name='id'>\n";
echo " <option value=''></option>\n";
foreach($extensions as $row) {
if ($row['extension_uuid'] == $extension_uuid) { $selected = "selected='selected'"; } else { $selected = ''; }
echo " <option value='".escape($row['extension_uuid'])."' $selected>".escape($row['extension'])." ".escape($row['number_alias'])." ".escape($row['description'])."</option>\n";
}
echo " </select>\n";
//echo "<br />\n";
//echo $text['description-extension']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
//echo "<td align='left' width='30%' nowrap='nowrap' valign='top'><b>".$text['title-message']."</b><br><br></td>\n";
echo "<td width='70%' colspan='2' align='left' valign='top'>\n";
echo " <br />\n";
echo " <a href=\"https://play.google.com/store/apps/details?id=com.grandstream.wave\" target=\"_blank\"><img src=\"/app/gswave/resources/images/google_play.png\" style=\"height:103px;\"/></a>";
echo " <a href=\"https://itunes.apple.com/us/app/grandstream-wave/id1029274043?ls=1&mt=8\" target=\"_blank\"><img src=\"/app/gswave/resources/images/apple_app_store.png\" style=\"height:71px;\" /></a>";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "</form>";
//echo "<br />";
//stream the file
if (is_uuid($_GET['id'])) {
//header("Content-Type: image/png");
$image = shell_exec('qrencode -o - -s 6 -m 5 "'.$xml.'"');
}
//html image
if (is_uuid($_GET['id'])) {
echo "<img src=\"data:image/png;base64,". base64_encode($image) ."\">\n";
}
//save to a file
//$output = '/tmp/'.$row['user_id'].'.'.$row['server_address'].'.png';
//$result = shell_exec('qrencode -o '.$output.' -m 5 "'.$xml.'"');
//add the footer
require_once "resources/footer.php";
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

90
app/gswave/root.php Normal file
View File

@ -0,0 +1,90 @@
<?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 <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
} else {
define("PATH_SEPARATOR", ":");
}
}
if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html';
// make sure the document_root is set
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]);
if(PHP_SAPI == 'cli'){
chdir(pathinfo(realpath($_SERVER["PHP_SELF"]), PATHINFO_DIRNAME));
$script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]);
$dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME));
if (file_exists('/project_root.php')) {
$path = '/';
} else {
$i = 1;
$path = '';
while ($i < count($dirs)) {
$path .= '/' . $dirs[$i];
if (file_exists($path. '/project_root.php')) {
break;
}
$i++;
}
}
$_SERVER["DOCUMENT_ROOT"] = $path;
}else{
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
}
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
// try to detect if a project path is being used
if (!defined('PROJECT_PATH')) {
if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) {
define('PROJECT_PATH', '/fusionpbx');
} elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/project_root.php')) {
define('PROJECT_PATH', '');
} else {
$dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)));
$i = 1;
$path = $_SERVER["DOCUMENT_ROOT"];
while ($i < count($dirs)) {
$path .= '/' . $dirs[$i];
if (file_exists($path. '/project_root.php')) {
break;
}
$i++;
}
if(!file_exists($path. '/project_root.php')){
die("Failed to locate the Project Root by searching for project_root.php please contact support for assistance");
}
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
$_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH);
set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]);
}
?>