Переглянути джерело

Windows 10 softphone app (#153)

* SessionTalk Windows 10 app provisioning

* Update app_languages.php

* CSV Corporate Directory for SessionTalk Windows

* Change menu name to "SessionCloud"
konradSC 4 роки тому
батько
коміт
7ffcf41978

+ 181 - 10
sessiontalk/app_languages.php

@@ -1,18 +1,18 @@
 <?php
 
-$text['title-sessiontalk']['en-us'] = "Sessiontalk";
-$text['title-sessiontalk']['en-gb'] = "Sessiontalk";
+$text['title-sessiontalk']['en-us'] = "SessionCloud";
+$text['title-sessiontalk']['en-gb'] = "SessionCloud";
 $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']['fr-ca'] = "SessionCloud";
+$text['title-sessiontalk']['fr-fr'] = "SessionCloud";
 $text['title-sessiontalk']['he-il'] = "";
 $text['title-sessiontalk']['it-it'] = "";
-$text['title-sessiontalk']['nl-nl'] = "Sessiontalk";
+$text['title-sessiontalk']['nl-nl'] = "SessionCloud";
 $text['title-sessiontalk']['pl-pl'] = "";
 $text['title-sessiontalk']['pt-br'] = "";
 $text['title-sessiontalk']['pt-pt'] = "";
@@ -21,19 +21,19 @@ $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']['en-us'] = "SessionCloud is a soft phone for mobile devices and Windows 10 PC's. Choose your extension and follow the provided instructions below.";
+$text['title_description-sessiontalk']['en-gb'] = "SessionCloud 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 SessionCloud for your device. Start the application then select the extension below 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']['fr-ca'] = "SessionCloud 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'] = "SessionCloud 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']['nl-nl'] = "SessionCloud 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'] = "";
@@ -63,4 +63,175 @@ $text['label-extension']['ru-ru'] = "Внутренний Номер";
 $text['label-extension']['sv-se'] = "Anknytning";
 $text['label-extension']['uk-ua'] = "Розширення";
 
+
+$text['header-windows_10']['en-us'] = "Windows 10 Client";
+$text['header-windows_10']['en-gb'] = "Windows 10 Client";
+$text['header-windows_10']['ar-eg'] = "";
+$text['header-windows_10']['de-at'] = "";
+$text['header-windows_10']['de-ch'] = "";
+$text['header-windows_10']['de-de'] = "";
+$text['header-windows_10']['es-cl'] = "";
+$text['header-windows_10']['es-mx'] = "";
+$text['header-windows_10']['fr-ca'] = "Windows 10 Client";
+$text['header-windows_10']['fr-fr'] = "Windows 10 Client";
+$text['header-windows_10']['he-il'] = "";
+$text['header-windows_10']['it-it'] = "";
+$text['header-windows_10']['nl-nl'] = "Windows 10 Client";
+$text['header-windows_10']['pl-pl'] = "";
+$text['header-windows_10']['pt-br'] = "";
+$text['header-windows_10']['pt-pt'] = "";
+$text['header-windows_10']['ro-ro'] = "";
+$text['header-windows_10']['ru-ru'] = "";
+$text['header-windows_10']['sv-se'] = "";
+$text['header-windows_10']['uk-ua'] = "";
+
+
+$text['description-step_1']['en-us'] = "Step 1: ";
+$text['description-step_1']['en-gb'] = "Step 1: ";
+$text['description-step_1']['ar-eg'] = "";
+$text['description-step_1']['de-at'] = "";
+$text['description-step_1']['de-ch'] = "";
+$text['description-step_1']['de-de'] = "";
+$text['description-step_1']['es-cl'] = "";
+$text['description-step_1']['es-mx'] = "";
+$text['description-step_1']['fr-ca'] = "Step 1: ";
+$text['description-step_1']['fr-fr'] = "Step 1: ";
+$text['description-step_1']['he-il'] = "";
+$text['description-step_1']['it-it'] = "";
+$text['description-step_1']['nl-nl'] = "Step 1: ";
+$text['description-step_1']['pl-pl'] = "";
+$text['description-step_1']['pt-br'] = "";
+$text['description-step_1']['pt-pt'] = "";
+$text['description-step_1']['ro-ro'] = "";
+$text['description-step_1']['ru-ru'] = "";
+$text['description-step_1']['sv-se'] = "";
+$text['description-step_1']['uk-ua'] = "";
+
+
+$text['description-windows_10']['en-us'] = "Click here to download and install a preconfigured Windows 10 client.";
+$text['description-windows_10']['en-gb'] = "Click here to download and install a preconfigured Windows 10 client.";
+$text['description-windows_10']['ar-eg'] = "";
+$text['description-windows_10']['de-at'] = "";
+$text['description-windows_10']['de-ch'] = "";
+$text['description-windows_10']['de-de'] = "";
+$text['description-windows_10']['es-cl'] = "";
+$text['description-windows_10']['es-mx'] = "";
+$text['description-windows_10']['fr-ca'] = "Click here to download and install a preconfigured Windows 10 client.";
+$text['description-windows_10']['fr-fr'] = "Click here to download and install a preconfigured Windows 10 client.";
+$text['description-windows_10']['he-il'] = "";
+$text['description-windows_10']['it-it'] = "";
+$text['description-windows_10']['nl-nl'] = "Click here to download and install a preconfigured Windows 10 client.";
+$text['description-windows_10']['pl-pl'] = "";
+$text['description-windows_10']['pt-br'] = "";
+$text['description-windows_10']['pt-pt'] = "";
+$text['description-windows_10']['ro-ro'] = "";
+$text['description-windows_10']['ru-ru'] = "";
+$text['description-windows_10']['sv-se'] = "";
+$text['description-windows_10']['uk-ua'] = "";
+
+$text['description-step_2']['en-us'] = "Step 2: (Optional) ";
+$text['description-step_2']['en-gb'] = "Step 2: (Optional) ";
+$text['description-step_2']['ar-eg'] = "";
+$text['description-step_2']['de-at'] = "";
+$text['description-step_2']['de-ch'] = "";
+$text['description-step_2']['de-de'] = "";
+$text['description-step_2']['es-cl'] = "";
+$text['description-step_2']['es-mx'] = "";
+$text['description-step_2']['fr-ca'] = "Step 2: (Optional) ";
+$text['description-step_2']['fr-fr'] = "Step 2: (Optional) ";
+$text['description-step_2']['he-il'] = "";
+$text['description-step_2']['it-it'] = "";
+$text['description-step_2']['nl-nl'] = "Step 2: (Optional) ";
+$text['description-step_2']['pl-pl'] = "";
+$text['description-step_2']['pt-br'] = "";
+$text['description-step_2']['pt-pt'] = "";
+$text['description-step_2']['ro-ro'] = "";
+$text['description-step_2']['ru-ru'] = "";
+$text['description-step_2']['sv-se'] = "";
+$text['description-step_2']['uk-ua'] = "";
+
+$text['description-windows_10_directory']['en-us'] = "Click here to download a corporate directory ready to import into your Windows 10 client.";
+$text['description-windows_10_directory']['en-gb'] = "Click here to download a corporate directory ready to import into your Windows 10 client.";
+$text['description-windows_10_directory']['ar-eg'] = "";
+$text['description-windows_10_directory']['de-at'] = "";
+$text['description-windows_10_directory']['de-ch'] = "";
+$text['description-windows_10_directory']['de-de'] = "";
+$text['description-windows_10_directory']['es-cl'] = "";
+$text['description-windows_10_directory']['es-mx'] = "";
+$text['description-windows_10_directory']['fr-ca'] = "Click here to download a corporate directory ready to import into your Windows 10 client.";
+$text['description-windows_10_directory']['fr-fr'] = "Click here to download a corporate directory ready to import into your Windows 10 client.";
+$text['description-windows_10_directory']['he-il'] = "";
+$text['description-windows_10_directory']['it-it'] = "";
+$text['description-windows_10_directory']['nl-nl'] = "Click here to download a corporate directory ready to import into your Windows 10 client.";
+$text['description-windows_10_directory']['pl-pl'] = "";
+$text['description-windows_10_directory']['pt-br'] = "";
+$text['description-windows_10_directory']['pt-pt'] = "";
+$text['description-windows_10_directory']['ro-ro'] = "";
+$text['description-windows_10_directory']['ru-ru'] = "";
+$text['description-windows_10_directory']['sv-se'] = "";
+$text['description-windows_10_directory']['uk-ua'] = "";
+
+$text['description-step_1_mobile']['en-us'] = "Step 1: Install the SessionCloud app from Google Play Store or Apple App Store.";
+$text['description-step_1_mobile']['en-gb'] = "Step 1: Install the SessionCloud app from Google Play Store or Apple App Store.";
+$text['description-step_1_mobile']['ar-eg'] = "";
+$text['description-step_1_mobile']['de-at'] = "";
+$text['description-step_1_mobile']['de-ch'] = "";
+$text['description-step_1_mobile']['de-de'] = "";
+$text['description-step_1_mobile']['es-cl'] = "";
+$text['description-step_1_mobile']['es-mx'] = "";
+$text['description-step_1_mobile']['fr-ca'] = "Step 1: Install the SessionCloud app from Google Play Store or Apple App Store.";
+$text['description-step_1_mobile']['fr-fr'] = "Step 1: Install the SessionCloud app from Google Play Store or Apple App Store.";
+$text['description-step_1_mobile']['he-il'] = "";
+$text['description-step_1_mobile']['it-it'] = "";
+$text['description-step_1_mobile']['nl-nl'] = "Step 1: Install the SessionCloud app from Google Play Store or Apple App Store.";
+$text['description-step_1_mobile']['pl-pl'] = "";
+$text['description-step_1_mobile']['pt-br'] = "";
+$text['description-step_1_mobile']['pt-pt'] = "";
+$text['description-step_1_mobile']['ro-ro'] = "";
+$text['description-step_1_mobile']['ru-ru'] = "";
+$text['description-step_1_mobile']['sv-se'] = "";
+$text['description-step_1_mobile']['uk-ua'] = "";
+
+$text['description-step_2_mobile']['en-us'] = "Step 2: On your mobile device open the SessionCloud app, Softphone, and scan the QR code below.";
+$text['description-step_2_mobile']['en-gb'] = "Step 2: On your mobile device open the SessionCloud app, Softphone, and scan the QR code below.";
+$text['description-step_2_mobile']['ar-eg'] = "";
+$text['description-step_2_mobile']['de-at'] = "";
+$text['description-step_2_mobile']['de-ch'] = "";
+$text['description-step_2_mobile']['de-de'] = "";
+$text['description-step_2_mobile']['es-cl'] = "";
+$text['description-step_2_mobile']['es-mx'] = "";
+$text['description-step_2_mobile']['fr-ca'] = "Step 2: On your mobile device open the SessionCloud app, Softphone, and scan the QR code below.";
+$text['description-step_2_mobile']['fr-fr'] = "Step 2: On your mobile device open the SessionCloud app, Softphone, and scan the QR code below.";
+$text['description-step_2_mobile']['he-il'] = "";
+$text['description-step_2_mobile']['it-it'] = "";
+$text['description-step_2_mobile']['nl-nl'] = "Step 2: On your mobile device open the SessionCloud app, Softphone, and scan the QR code below.";
+$text['description-step_2_mobile']['pl-pl'] = "";
+$text['description-step_2_mobile']['pt-br'] = "";
+$text['description-step_2_mobile']['pt-pt'] = "";
+$text['description-step_2_mobile']['ro-ro'] = "";
+$text['description-step_2_mobile']['ru-ru'] = "";
+$text['description-step_2_mobile']['sv-se'] = "";
+$text['description-step_2_mobile']['uk-ua'] = "";
+
+$text['header-mobile']['en-us'] = "Mobile Client (Android & iOS)";
+$text['header-mobile']['en-gb'] = "Mobile Client (Android & iOS)";
+$text['header-mobile']['ar-eg'] = "";
+$text['header-mobile']['de-at'] = "";
+$text['header-mobile']['de-ch'] = "";
+$text['header-mobile']['de-de'] = "";
+$text['header-mobile']['es-cl'] = "";
+$text['header-mobile']['es-mx'] = "";
+$text['header-mobile']['fr-ca'] = "Mobile Client (Android & iOS)";
+$text['header-mobile']['fr-fr'] = "Mobile Client (Android & iOS)";
+$text['header-mobile']['he-il'] = "";
+$text['header-mobile']['it-it'] = "";
+$text['header-mobile']['nl-nl'] = "Mobile Client (Android & iOS)";
+$text['header-mobile']['pl-pl'] = "";
+$text['header-mobile']['pt-br'] = "";
+$text['header-mobile']['pt-pt'] = "";
+$text['header-mobile']['ro-ro'] = "";
+$text['header-mobile']['ru-ru'] = "";
+$text['header-mobile']['sv-se'] = "";
+$text['header-mobile']['uk-ua'] = "";
+
 ?>

+ 4 - 4
sessiontalk/app_menu.php

@@ -1,8 +1,8 @@
 <?php
 
 	$y=0;
-	$apps[$x]['menu'][$y]['title']['en-us'] = "Sessiontalk";
-	$apps[$x]['menu'][$y]['title']['en-gb'] = "Sessiontalk";
+	$apps[$x]['menu'][$y]['title']['en-us'] = "SessionCloud";
+	$apps[$x]['menu'][$y]['title']['en-gb'] = "SessionCloud";
 	$apps[$x]['menu'][$y]['title']['ar-eg'] = "";
 	$apps[$x]['menu'][$y]['title']['de-at'] = "";
 	$apps[$x]['menu'][$y]['title']['de-de'] = "";
@@ -21,10 +21,10 @@
 	$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]['parent_uuid'] = "b08f5f87-8a66-4c29-b1e6-eb0c374d59e2";
 	$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";
-?>
+?>

+ 37 - 8
sessiontalk/index.php

@@ -68,11 +68,6 @@
 		$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'];
@@ -125,7 +120,7 @@
 
 	echo $text['title_description-sessiontalk']."\n";
 	echo "<br /><br />\n";
-	//echo $qr_content;  //enable for debugging
+	//echo $qr_content; //debug 
 	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";
@@ -137,20 +132,54 @@
 		}
 	}
 	echo "</select>\n";
-
+echo "</div>\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' );
 		
+		$html_link = "scsc:?username=". $username . "@" . $_SESSION['domain_name'] . ":". $_SESSION['provision']['sessiontalk_provider_id']['text']."%26password=".$field['api_key'];
+		$html_link = html_entity_decode( $html_link, ENT_QUOTES, 'UTF-8' );
+
+		//Windows 10
+		echo "<div class='action_bar' id='action_bar_2'>\n";
+		echo "	<div class='heading'><b>".$text['header-windows_10']."</b></div>\n";
+		echo "	<div style='clear: both;'></div>\n";
+		echo "</div>\n";	
+
+		echo "<div>\n";
+		echo " ".$text['description-step_1']."\n";
+		echo " <a href='ms-appinstaller:?source=https://windows-softphone.s3.eu-west-2.amazonaws.com/sessioncloud.appinstaller&activationUri=".$html_link."'>".$text['description-windows_10']."</a>\n";
+		echo " <br/>\n";
+		echo " <br/>\n";
+		echo " ".$text['description-step_2']."<a href='".PROJECT_PATH."/app/sessiontalk/sessiontalk_directory.php'>".$text['description-windows_10_directory']."</a>\n";
+		echo "</div>\n";
+		echo "<br>\n";
+		echo "<br>\n";
+
+		//Mobile
+		echo "<div class='action_bar' id='action_bar'>\n";
+		echo "	<div class='heading'><b>".$text['header-mobile']."</b></div>\n";
+		echo "	<div style='clear: both;'></div>\n";
+		echo "</div>\n";	
+
+		echo "<div>\n";
+		echo " ".$text['description-step_1_mobile']."\n";
+		echo " <br>\n";
+		echo " <br>\n";
+		echo " ".$text['description-step_2_mobile']."\n";
+		echo "</div>\n";
+
 		require_once 'resources/qr_code/QRErrorCorrectLevel.php';
 		require_once 'resources/qr_code/QRCode.php';
 		require_once 'resources/qr_code/QRCodeImage.php';
+		$qr_content = html_entity_decode( $qr_content, ENT_QUOTES, 'UTF-8' );
   
 		try {
+			
 			$code = new QRCode (- 1, QRErrorCorrectLevel::H);
 			$code->addData($qr_content);
 			$code->make();

+ 142 - 0
sessiontalk/sessiontalk_directory.php

@@ -0,0 +1,142 @@
+<?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-2016
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	Mark J Crane <[email protected]>
+*/
+
+//includes
+	require_once "root.php";
+	require_once "resources/require.php";
+	require_once "resources/check_auth.php";
+	require_once "resources/paging.php";
+
+//check permissions
+	require_once "resources/check_auth.php";
+	if (permission_exists('company_directory_view')) {
+		//access granted
+	}
+	else {
+		echo "access denied";
+		exit;
+	}
+	
+//add multi-lingual support
+	$language = new text;
+	$text = $language->get();
+
+//get the http values and set them as variables
+	$order_by = check_str($_REQUEST["order_by"]);
+	$order = check_str($_REQUEST["order"]);
+
+//handle search term
+	$search = check_str($_REQUEST["search"]);
+	if (strlen($search) > 0) {
+		$sql_mod = "and ( ";
+		$sql_mod .= "e.extension ILIKE '%".$search."%' ";
+		$sql_mod .= "or e.call_group ILIKE '%".$search."%' ";
+		$sql_mod .= "or e.directory_last_name ILIKE '%".$search."%' ";
+		$sql_mod .= "or e.directory_first_name ILIKE '%".$search."%' ";
+		$sql_mod .= ") ";
+	}
+	if (strlen($order_by) < 1) {
+		$order_by = "extension";
+		$order = "ASC";
+	}
+
+	$domain_uuid = $_SESSION['domain_uuid'];
+
+	
+//lookup the domain count
+	$sql = "select count(*) as num_rows from v_extensions as e\n";
+	$sql .= "WHERE domain_uuid = '$domain_uuid' and directory_visible = 'true' \n";
+	$sql .= $sql_mod; //add search mod from above"
+	$prep_statement = $db->prepare($sql);
+	if ($prep_statement) {
+		$prep_statement->execute();
+		$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
+		$numeric_extension_count = $row['num_rows'];
+		if (($db_type == "pgsql") or ($db_type == "mysql")) {
+			$numeric_extension_count = $row['num_rows'];
+		}
+	}
+	unset($prep_statement, $row);
+
+
+//prepare to page the results
+	$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
+	$param = "&search=".$search;
+	if (!isset($_GET['page'])) { $_GET['page'] = 0; }
+	$_GET['page'] = check_str($_GET['page']);
+	list($paging_controls_mini, $rows_per_page, $var_3) = paging($numeric_extension_count, $param, $rows_per_page, true); //top
+	list($paging_controls, $rows_per_page, $var_3) = paging($numeric_extension_count, $param, $rows_per_page); //bottom
+	$offset = $rows_per_page * $_GET['page'];
+	
+	
+//get all the counts from the database
+	$sql = "SELECT \n";
+	$sql .= "e.directory_first_name AS first_name, \n";
+	$sql .= "e.directory_last_name AS last_name, \n";
+	$sql .= "e.extension AS phone, \n";
+	$sql .= "e.call_group AS group\n";
+	$sql .= "FROM v_extensions as e \n";
+	$sql .= "WHERE e.domain_uuid = '$domain_uuid' and e.directory_visible = 'true' \n";
+	$sql .= $sql_mod; //add search mod from above
+	$sql .= "ORDER BY ".$order_by." ".$order." \n";
+	if ($export != "true") {$sql .= "limit $rows_per_page offset $offset ";}
+	$database = new database;
+	$directory = $database->select($sql, null, 'all');
+	unset($database,$result);
+
+
+	//set the headers
+		header('Content-type: application/octet-binary');
+		header("Content-Disposition: attachment; filename=company-directory_" . date("Y-m-d") . ".csv");
+
+	//show the column names on the first line
+		$z = 0;
+		foreach($directory[1] as $key => $val) {
+			if ($z == 0) {
+				echo '"'.$key.'"';
+			}
+			else {
+				echo ',"'.$key.'"';
+			}
+			$z++;
+		}
+		echo "\n";
+	
+	//add the values to the csv
+		$x = 0;
+		
+		foreach($directory as $key => $row){
+			echo '"'.$row['first_name'].'"';
+			echo ',"'.$row['last_name'].'"';
+			echo ',"'.$row['phone'].'"';
+			echo ',"'.$row['group'].'"';
+			echo "\n";
+			$x++;
+		}
+
+		exit;
+		
+?>