Device - Edit: Updates for PHP 8.1

This commit is contained in:
fusionate 2023-07-03 18:02:17 +00:00
parent d7b3e25cd4
commit 3ea9e7d012
No known key found for this signature in database
1 changed files with 33 additions and 29 deletions

View File

@ -769,35 +769,39 @@
} }
//get the device line settings //get the device line settings
$row = $device_lines[0]; $row = $device_lines[0] ?? null;
//set the outbound proxy settings if (!empty($row)) {
if (empty($row['outbound_proxy_primary'])) {
$outbound_proxy_primary = $row['server_address']; //set the outbound proxy settings
} if (empty($row['outbound_proxy_primary'])) {
else { $outbound_proxy_primary = $row['server_address'];
$outbound_proxy_primary = $row['outbound_proxy_primary']; }
} else {
$outbound_proxy_secondary = $row['outbound_proxy_secondary']; $outbound_proxy_primary = $row['outbound_proxy_primary'];
}
$outbound_proxy_secondary = $row['outbound_proxy_secondary'];
//build content for grandstream wave
if ($device_template == "grandstream/wave") {
$content = "<?xml version='1.0' encoding='utf-8'?>";
$content .= "<AccountConfig version='1'>";
$content .= "<Account>";
$content .= "<RegisterServer>".$row['server_address']."</RegisterServer>";
$content .= "<OutboundServer>".$outbound_proxy_primary.":".$row['sip_port']."</OutboundServer>";
$content .= "<SecOutboundServer>".$outbound_proxy_secondary.":".$row['sip_port']."</SecOutboundServer>";
$content .= "<UserID>".$row['user_id']."</UserID>";
$content .= "<AuthID>".$row['auth_id']."</AuthID>";
$content .= "<AuthPass>".$row['password']."</AuthPass>";
$content .= "<AccountName>".$row['user_id']."</AccountName>";
$content .= "<DisplayName>".$row['display_name']."</DisplayName>";
$content .= "<Dialplan>{x+|*x+|*++}</Dialplan>";
$content .= "<RandomPort>0</RandomPort>";
$content .= "<Voicemail>*97</Voicemail>";
$content .= "</Account>";
$content .= "</AccountConfig>";
}
//build content for grandstream wave
if ($device_template == "grandstream/wave") {
$content = "<?xml version='1.0' encoding='utf-8'?>";
$content .= "<AccountConfig version='1'>";
$content .= "<Account>";
$content .= "<RegisterServer>".$row['server_address']."</RegisterServer>";
$content .= "<OutboundServer>".$outbound_proxy_primary.":".$row['sip_port']."</OutboundServer>";
$content .= "<SecOutboundServer>".$outbound_proxy_secondary.":".$row['sip_port']."</SecOutboundServer>";
$content .= "<UserID>".$row['user_id']."</UserID>";
$content .= "<AuthID>".$row['auth_id']."</AuthID>";
$content .= "<AuthPass>".$row['password']."</AuthPass>";
$content .= "<AccountName>".$row['user_id']."</AccountName>";
$content .= "<DisplayName>".$row['display_name']."</DisplayName>";
$content .= "<Dialplan>{x+|*x+|*++}</Dialplan>";
$content .= "<RandomPort>0</RandomPort>";
$content .= "<Voicemail>*97</Voicemail>";
$content .= "</Account>";
$content .= "</AccountConfig>";
} }
//build content for linphone //build content for linphone
@ -808,7 +812,7 @@
//stream the file //stream the file
if (!empty($content)) { if (!empty($content)) {
$xml = html_entity_decode($xml, ENT_QUOTES, 'UTF-8'); $content = html_entity_decode($content, ENT_QUOTES, 'UTF-8');
require_once 'resources/qr_code/QRErrorCorrectLevel.php'; require_once 'resources/qr_code/QRErrorCorrectLevel.php';
require_once 'resources/qr_code/QRCode.php'; require_once 'resources/qr_code/QRCode.php';
@ -830,7 +834,7 @@
} }
//html image //html image
if (!empty($content)) { if (!empty($content) && !empty($image)) {
echo "<script>\n"; echo "<script>\n";
echo "\n"; echo "\n";