|
@@ -1,13 +1,40 @@
|
|
|
|
+<?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-2012
|
|
|
|
+ the Initial Developer. All Rights Reserved.
|
|
|
|
+
|
|
|
|
+ Contributor(s):
|
|
|
|
+ Mark J Crane <[email protected]>
|
|
|
|
+*/
|
|
|
|
+include "root.php";
|
|
|
|
+require "resources/require.php";
|
|
|
|
+require_once "resources/check_auth.php";
|
|
|
|
+
|
|
// FusionPBX Upgrade script used to upgrade from 3.4 to 3.6 for those using provisioning in FusionPBX.
|
|
// FusionPBX Upgrade script used to upgrade from 3.4 to 3.6 for those using provisioning in FusionPBX.
|
|
// Purpose of this script is to move provisioning assignments from device extensions to device lines
|
|
// Purpose of this script is to move provisioning assignments from device extensions to device lines
|
|
// Use this script only one time.
|
|
// Use this script only one time.
|
|
|
|
|
|
- $sql = "insert into v_device_extensions ";
|
|
|
|
- $sql .= "domain_uuid, ";
|
|
|
|
- $sql .= "device_extension_uuid, ";
|
|
|
|
- $sql .= "device_uuid, ";
|
|
|
|
- $sql .= "extension_uuid, ";
|
|
|
|
- $sql .= "device_line ";
|
|
|
|
|
|
+//set default values
|
|
|
|
+ $sip_port = '5060';
|
|
|
|
+ $sip_transport = 'TCP';
|
|
|
|
+ $register_expires = '120';
|
|
|
|
|
|
//get the assigned extensions from the device extensions
|
|
//get the assigned extensions from the device extensions
|
|
$sql = "select * from v_device_extensions ";
|
|
$sql = "select * from v_device_extensions ";
|
|
@@ -23,7 +50,7 @@
|
|
$device_extension_uuid = $row['device_extension_uuid'];
|
|
$device_extension_uuid = $row['device_extension_uuid'];
|
|
$device_uuid = $row['device_uuid'];
|
|
$device_uuid = $row['device_uuid'];
|
|
$extension_uuid = $row['extension_uuid'];
|
|
$extension_uuid = $row['extension_uuid'];
|
|
- $device_line = $row['device_line'];
|
|
|
|
|
|
+ $line_number = $row['device_line'];
|
|
|
|
|
|
//get the registration information for device lines
|
|
//get the registration information for device lines
|
|
$sql = "select * from v_extensions ";
|
|
$sql = "select * from v_extensions ";
|
|
@@ -32,20 +59,18 @@
|
|
$prep_statement->execute();
|
|
$prep_statement->execute();
|
|
$sub_result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
|
$sub_result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
|
foreach ($sub_result as &$field) {
|
|
foreach ($sub_result as &$field) {
|
|
- $zzz = $field["zzz"];
|
|
|
|
- $zzz = $field["zzz"];
|
|
|
|
- $zzz = $field["zzz"];
|
|
|
|
- $zzz = $field["zzz"];
|
|
|
|
- $zzz = $field["zzz"];
|
|
|
|
- $zzz = $field["zzz"];
|
|
|
|
- $zzz = $field["zzz"];
|
|
|
|
- $zzz = $field["zzz"];
|
|
|
|
- $zzz = $field["zzz"];
|
|
|
|
|
|
+ $user_id = $field["extension"];
|
|
|
|
+ $auth_id = $field["extension"];
|
|
|
|
+ $display_name = $field["extension"];
|
|
|
|
+ $password = $field["password"];
|
|
}
|
|
}
|
|
|
|
|
|
//set a new uuid
|
|
//set a new uuid
|
|
device_line_uuid = uuid();
|
|
device_line_uuid = uuid();
|
|
|
|
|
|
|
|
+ //get the server address from the domains array using the domain_uuid
|
|
|
|
+ $server_address = $_SESSION[domains][$domain_uuid]["domain_name"];
|
|
|
|
+
|
|
//insert into device lines
|
|
//insert into device lines
|
|
$sql = "insert into v_device_lines ";
|
|
$sql = "insert into v_device_lines ";
|
|
$sql .= "(";
|
|
$sql .= "(";
|
|
@@ -54,7 +79,7 @@
|
|
$sql .= "device_uuid, ";
|
|
$sql .= "device_uuid, ";
|
|
$sql .= "line_number, ";
|
|
$sql .= "line_number, ";
|
|
$sql .= "server_address, ";
|
|
$sql .= "server_address, ";
|
|
- $sql .= "outbound_proxy, ";
|
|
|
|
|
|
+ //$sql .= "outbound_proxy, ";
|
|
$sql .= "display_name, ";
|
|
$sql .= "display_name, ";
|
|
$sql .= "user_id, ";
|
|
$sql .= "user_id, ";
|
|
$sql .= "auth_id, ";
|
|
$sql .= "auth_id, ";
|
|
@@ -70,7 +95,7 @@
|
|
$sql .= "'$device_uuid', ";
|
|
$sql .= "'$device_uuid', ";
|
|
$sql .= "'$line_number', ";
|
|
$sql .= "'$line_number', ";
|
|
$sql .= "'$server_address', ";
|
|
$sql .= "'$server_address', ";
|
|
- $sql .= "'$outbound_proxy', ";
|
|
|
|
|
|
+ //$sql .= "'$outbound_proxy', ";
|
|
$sql .= "'$display_name', ";
|
|
$sql .= "'$display_name', ";
|
|
$sql .= "'$user_id', ";
|
|
$sql .= "'$user_id', ";
|
|
$sql .= "'$auth_id', ";
|
|
$sql .= "'$auth_id', ";
|
|
@@ -81,7 +106,9 @@
|
|
$sql .= ");\n";
|
|
$sql .= ");\n";
|
|
echo $sql;
|
|
echo $sql;
|
|
//$db->exec(check_sql($sql));
|
|
//$db->exec(check_sql($sql));
|
|
- //unset($sql);
|
|
|
|
|
|
+ unset($sql);
|
|
|
|
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+?>
|