-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathselection.php
More file actions
51 lines (36 loc) · 1.75 KB
/
selection.php
File metadata and controls
51 lines (36 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
###################################################
# Set our variables/constants/etc
###################################################
date_default_timezone_set('America/New_York'); // Not required, but usually a good idea in php
define("DSS_KEY_NUM", "4"); // Define the DSS key number where the script will be assigned (allows us to toggle the LED)
define("AVAILABLE_CODE", "*10"); // The star code you configured to be AVAILABLE in the queue
define("UNAVAILABLE_CODE", "*11"); // The star code you configured to be UNAVAILABLE in the queue
define("URI", "http://queue.example.com/dss4"); // Set your URL here to the location of where you uploaded these files (no trailing slash).
// Example: If your file is at http://timeframe.example.com/ClientName/status.php, put "http://timeframe.example.com/ClientName" here
###################################################
$selection = htmlspecialchars($_GET['status']); // Is user joining or leaving. Sanitize user input just in case.
?>
<?xml version="1.0" encoding="ISO-8859-1"?>
<YealinkIPPhoneExecute
Beep="no">
<?php
if ($selection == "available") {
?>
<ExecuteItem URI="<?= URI ?>/message.php?status=available" />
<ExecuteItem URI="Led:LINE<?= DSS_KEY_NUM ?>_GREEN=on" />
<ExecuteItem URI="Dial:<?= AVAILABLE_CODE ?>" />
<?php
}
elseif ($selection == "unavailable") {
?>
<ExecuteItem URI="<?= URI ?>/message.php?status=unavailable" />
<ExecuteItem URI="Led:LINE<?= DSS_KEY_NUM ?>_RED=on" />
<ExecuteItem URI="Dial:<?= UNAVAILABLE_CODE ?>" />
<?php
}
else { // Sanity check so we don't do anything with data that we don't trust.
echo "Error"; // Just used for debugging
}
?>
</YealinkIPPhoneExecute>