Call Control: Minor form layout mods, add Default Setting to control Follow Me Destination count and default Timeout value, integrate ORM.
This commit is contained in:
parent
6a511a4621
commit
78d38090bc
|
|
@ -0,0 +1,109 @@
|
|||
<?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-2016
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//process this only one time
|
||||
if ($domains_processed == 1) {
|
||||
|
||||
//define array of settings
|
||||
$array[$x]['default_setting_category'] = 'follow_me';
|
||||
$array[$x]['default_setting_subcategory'] = 'max_destinations';
|
||||
$array[$x]['default_setting_name'] = 'numeric';
|
||||
$array[$x]['default_setting_value'] = '5';
|
||||
$array[$x]['default_setting_enabled'] = 'false';
|
||||
$array[$x]['default_setting_order'] = '0';
|
||||
$array[$x]['default_setting_description'] = 'Set the maximum number of Follow Me Destinations.';
|
||||
$x++;
|
||||
$array[$x]['default_setting_category'] = 'follow_me';
|
||||
$array[$x]['default_setting_subcategory'] = 'timeout';
|
||||
$array[$x]['default_setting_name'] = 'numeric';
|
||||
$array[$x]['default_setting_value'] = '30';
|
||||
$array[$x]['default_setting_enabled'] = 'false';
|
||||
$array[$x]['default_setting_order'] = '0';
|
||||
$array[$x]['default_setting_description'] = 'Set the default Follow Me Timeout value.';
|
||||
$x++;
|
||||
|
||||
//get an array of the default settings
|
||||
$sql = "select * from v_default_settings ";
|
||||
$sql .= "where default_setting_category = 'follow_me' ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
$prep_statement->execute();
|
||||
$default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
//find the missing default settings
|
||||
$i = 0;
|
||||
foreach ($array as $setting) {
|
||||
$found = false;
|
||||
$missing[$i] = $setting;
|
||||
foreach ($default_settings as $row) {
|
||||
if (trim($row['default_setting_subcategory']) == trim($setting['default_setting_subcategory'])) {
|
||||
$found = true;
|
||||
//remove items from the array that were found
|
||||
unset($missing[$i]);
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
//get the missing count
|
||||
$i = 0;
|
||||
foreach ($missing as $row) { $i++; }
|
||||
$missing_count = $i;
|
||||
|
||||
//add the missing default settings
|
||||
$sql = "insert into v_default_settings (";
|
||||
$sql .= "default_setting_uuid, ";
|
||||
$sql .= "default_setting_category, ";
|
||||
$sql .= "default_setting_subcategory, ";
|
||||
$sql .= "default_setting_name, ";
|
||||
$sql .= "default_setting_value, ";
|
||||
$sql .= "default_setting_enabled, ";
|
||||
$sql .= "default_setting_description ";
|
||||
$sql .= ") values \n";
|
||||
$i = 1;
|
||||
foreach ($missing as $row) {
|
||||
$sql .= "(";
|
||||
$sql .= "'".uuid()."', ";
|
||||
$sql .= "'".check_str($row['default_setting_category'])."', ";
|
||||
$sql .= "'".check_str($row['default_setting_subcategory'])."', ";
|
||||
$sql .= "'".check_str($row['default_setting_name'])."', ";
|
||||
$sql .= "'".check_str($row['default_setting_value'])."', ";
|
||||
$sql .= "'".check_str($row['default_setting_enabled'])."', ";
|
||||
$sql .= "'".check_str($row['default_setting_description'])."' ";
|
||||
$sql .= ")";
|
||||
if ($missing_count != $i) {
|
||||
$sql .= ",\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$db->exec(check_sql($sql));
|
||||
unset($missing);
|
||||
|
||||
//unset the array variable
|
||||
unset($array);
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
@ -42,16 +42,6 @@ $text['table-description']['sv-se'] = "Beskrivning ";
|
|||
$text['table-description']['uk'] = "Опис";
|
||||
$text['table-description']['de-at'] = "Beschreibung";
|
||||
|
||||
$text['label-select-cid-number']['en-us'] = "Select Caller ID Number";
|
||||
$text['label-select-cid-number']['es-cl'] = "Seleccione Llamadas Número de Identificación";
|
||||
$text['label-select-cid-number']['pt-pt'] = "Selecione Caller ID Number";
|
||||
$text['label-select-cid-number']['fr-fr'] = "Sélectionnez Caller ID Number";
|
||||
$text['label-select-cid-number']['pt-br'] = "Selecionar ID da chamada";
|
||||
$text['label-select-cid-number']['pl'] = "Ustaw prezentację numeru dzwoniącego";
|
||||
$text['label-select-cid-number']['sv-se'] = "Välj Nummerpresentation ";
|
||||
$text['label-select-cid-number']['uk'] = "";
|
||||
$text['label-select-cid-number']['de-at'] = "Anruferkennung (Nummer) wählen";
|
||||
|
||||
$text['label-ring-timeout']['en-us'] = "Timeout";
|
||||
$text['label-ring-timeout']['es-cl'] = "Timeout";
|
||||
$text['label-ring-timeout']['pt-pt'] = "Timeout";
|
||||
|
|
@ -135,16 +125,16 @@ $text['label-not_registered']['sv-se'] = "";
|
|||
$text['label-not_registered']['uk'] = "";
|
||||
$text['label-not_registered']['de-at'] = "";
|
||||
|
||||
$text['label-ignore-busy']['en-us'] = "Ignore Busy";
|
||||
$text['label-ignore-busy']['es-cl'] = "";
|
||||
$text['label-ignore-busy']['pt-pt'] = "";
|
||||
$text['label-ignore-busy']['fr-fr'] = "";
|
||||
$text['label-ignore-busy']['it-it'] = "";
|
||||
$text['label-ignore-busy']['pt-br'] = "Ignorar ocupado";
|
||||
$text['label-ignore-busy']['pl'] = "";
|
||||
$text['label-ignore-busy']['sv-se'] = "";
|
||||
$text['label-ignore-busy']['uk'] = "";
|
||||
$text['label-ignore-busy']['de-at'] = "Ignorieren bei Besetzt";
|
||||
$text['label-ignore_busy']['en-us'] = "Ignore Busy";
|
||||
$text['label-ignore_busy']['es-cl'] = "";
|
||||
$text['label-ignore_busy']['pt-pt'] = "";
|
||||
$text['label-ignore_busy']['fr-fr'] = "";
|
||||
$text['label-ignore_busy']['it-it'] = "";
|
||||
$text['label-ignore_busy']['pt-br'] = "Ignorar ocupado";
|
||||
$text['label-ignore_busy']['pl'] = "";
|
||||
$text['label-ignore_busy']['sv-se'] = "";
|
||||
$text['label-ignore_busy']['uk'] = "";
|
||||
$text['label-ignore_busy']['de-at'] = "Ignorieren bei Besetzt";
|
||||
|
||||
$text['label-follow-me']['en-us'] = "Follow Me";
|
||||
$text['label-follow-me']['es-cl'] = "Sígueme";
|
||||
|
|
@ -246,7 +236,7 @@ $text['label-destination']['sv-se'] = "Destination ";
|
|||
$text['label-destination']['uk'] = "Номер";
|
||||
$text['label-destination']['de-at'] = "Ziel";
|
||||
|
||||
$text['label-cid-number-prefix']['en-us'] = "Caller ID Number";
|
||||
$text['label-cid-number-prefix']['en-us'] = "Number Prefix";
|
||||
$text['label-cid-number-prefix']['es-cl'] = "Número de Caller ID";
|
||||
$text['label-cid-number-prefix']['pt-pt'] = "Número do Chamador";
|
||||
$text['label-cid-number-prefix']['pt-br'] = "Número do discador";
|
||||
|
|
@ -256,7 +246,17 @@ $text['label-cid-number-prefix']['uk'] = "Caller ID Номер";
|
|||
$text['label-cid-number-prefix']['fr-fr'] = "CID Nombre Préfixe";
|
||||
$text['label-cid-number-prefix']['de-at'] = "Anruferkennung (Nummer)";
|
||||
|
||||
$text['label-cid-name-prefix']['en-us'] = "Caller ID Name";
|
||||
$text['label-cid-number']['en-us'] = "Caller ID Number";
|
||||
$text['label-cid-number']['es-cl'] = "Número de Caller ID";
|
||||
$text['label-cid-number']['pt-pt'] = "Número do Chamador";
|
||||
$text['label-cid-number']['pt-br'] = "Número do discador";
|
||||
$text['label-cid-number']['pl'] = "Prefiks prezentacji numeru dzwoniącego";
|
||||
$text['label-cid-number']['sv-se'] = "Nummerpresentation ";
|
||||
$text['label-cid-number']['uk'] = "Caller ID Номер";
|
||||
$text['label-cid-number']['fr-fr'] = "CID Nombre Préfixe";
|
||||
$text['label-cid-number']['de-at'] = "Anruferkennung (Nummer)";
|
||||
|
||||
$text['label-cid-name-prefix']['en-us'] = "Name Prefix";
|
||||
$text['label-cid-name-prefix']['es-cl'] = "Nombre de Caller ID";
|
||||
$text['label-cid-name-prefix']['pt-pt'] = "Nome do Chamador";
|
||||
$text['label-cid-name-prefix']['fr-fr'] = "Préfixe de l'appelant";
|
||||
|
|
@ -308,7 +308,7 @@ $text['description-on-busy']['it-it'] = "Se abilitato, esegue l'override del val
|
|||
$text['description-on-busy']['pt-br'] = "Se ativado, substitui o valor do correio de voz permitindo algum ramal atender quando estiver ocupado.";
|
||||
$text['description-on-busy']['pl'] = "Jeżeli włączone, ustawienie włączenia poczty głosowej zostaje nadpisane.";
|
||||
$text['description-on-busy']['sv-se'] = "Om aktiverad, så tar den överhand framför röstbrevlåda hos anknytningen. ";
|
||||
$text['description-on-busy']['uk'] = "";
|
||||
$text['description-on-busy']['uk'] = "Якщо цей параметр включений, то вона перекриває значення голосової пошти, що дозволяє в розширенні.";
|
||||
$text['description-on-busy']['de-at'] = "Falls aktiv, wird der Wert 'Mailbox eingeschaltet' in der Nebenstelle überschrieben";
|
||||
|
||||
$text['description-no_answer']['en-us'] = "If enabled, it overrides the value of voicemail enabling in extension.";
|
||||
|
|
@ -319,19 +319,30 @@ $text['description-no_answer']['it-it'] = "Se abilitato, esegue l'override del v
|
|||
$text['description-no_answer']['pt-br'] = "Se ativado, substitui o valor do correio de voz permitindo uma extensão quando estiver chamando";
|
||||
$text['description-no_answer']['pl'] = "Jeżeli włączone, ustawienie włączenia poczty głosowej zostaje nadpisane.";
|
||||
$text['description-no_answer']['sv-se'] = "Om aktiverad, så tar den överhand framför röstbrevlåda hos anknytningen. ";
|
||||
$text['description-no_answer']['uk'] = "";
|
||||
$text['description-no_answer']['uk'] = "Якщо цей параметр включений, то вона перекриває значення голосової пошти, що дозволяє в розширенні.";
|
||||
$text['description-no_answer']['de-at'] = "Falls aktiv, wird der Wert 'Mailbox eingeschaltet' in der Nebenstelle überschrieben";
|
||||
|
||||
$text['description-not_registered']['en-us'] = "If endpoint is not reachable, forward to this destination before going to voicemail.";
|
||||
$text['description-not_registered']['es-cl'] = "";
|
||||
$text['description-not_registered']['pt-pt'] = "";
|
||||
$text['description-not_registered']['fr-fr'] = "";
|
||||
$text['description-not_registered']['it-it'] = "";
|
||||
$text['description-not_registered']['es-cl'] = "Si el punto extremo no es alcanzable, remitir a este destino antes de ir al correo de voz.";
|
||||
$text['description-not_registered']['pt-pt'] = "Se endpoint não está acessível, encaminhar para este destino antes de ir para a caixa postal.";
|
||||
$text['description-not_registered']['fr-fr'] = "Si extrémité est pas accessible, transmettre à cette destination avant d'aller à la messagerie vocale.";
|
||||
$text['description-not_registered']['it-it'] = "Se endpoint non è raggiungibile, inoltrare a questa destinazione prima di andare in segreteria telefonica.";
|
||||
$text['description-not_registered']['pt-br'] = "Se o destino não for alcançável, desvia a chamata para este destino antes de enviar para o correio de voz. ";
|
||||
$text['description-not_registered']['pl'] = "";
|
||||
$text['description-not_registered']['sv-se'] = "";
|
||||
$text['description-not_registered']['uk'] = "";
|
||||
$text['description-not_registered']['de-at'] = "";
|
||||
$text['description-not_registered']['pl'] = "Jeśli punkt końcowy nie jest osiągalny, przekazania do tego celu przed udaniem się na pocztę głosową.";
|
||||
$text['description-not_registered']['sv-se'] = "Om endpoint är inte nås, vidarebefordra till denna destination innan du går till röstbrevlådan .";
|
||||
$text['description-not_registered']['uk'] = "Якщо кінцева точка не можна досягти, вперед до цієї мети, перш ніж йти на голосову пошту.";
|
||||
$text['description-not_registered']['de-at'] = "Wenn Endpunkt nicht erreichbar ist, zu diesem Ziel weiterzuleiten , bevor an die Voicemail gehen.";
|
||||
|
||||
$text['description-ignore_busy']['en-us'] = "Interrupt the call if a destination is busy.";
|
||||
$text['description-ignore_busy']['es-cl'] = "Interrumpir la llamada si un destino está ocupado.";
|
||||
$text['description-ignore_busy']['pt-pt'] = "Interromper a chamada, se um destino está ocupado.";
|
||||
$text['description-ignore_busy']['fr-fr'] = "Interrompez l'appel si une destination est occupé.";
|
||||
$text['description-ignore_busy']['it-it'] = "Interrompere la chiamata se la destinazione è occupata.";
|
||||
$text['description-ignore_busy']['pt-br'] = "Interromper a chamada, se um destino está ocupado.";
|
||||
$text['description-ignore_busy']['pl'] = "Przerwanie połączenia, jeśli docelowy jest zajęty.";
|
||||
$text['description-ignore_busy']['sv-se'] = "Avbryta samtalet om en destination är upptagen.";
|
||||
$text['description-ignore_busy']['uk'] = "Переривання виклику, якщо абонент зайнятий.";
|
||||
$text['description-ignore_busy']['de-at'] = "Unterbrechen Sie den Anruf, wenn ein Ziel besetzt ist.";
|
||||
|
||||
$text['description-cid-number-prefix']['en-us'] = "Set the caller ID number prefix.";
|
||||
$text['description-cid-number-prefix']['es-cl'] = "Configure el prefijo de número de caller ID.";
|
||||
|
|
@ -339,10 +350,20 @@ $text['description-cid-number-prefix']['pt-pt'] = "Defina o número do Chamador"
|
|||
$text['description-cid-number-prefix']['pt-br'] = "Defina o número do prefixo.";
|
||||
$text['description-cid-number-prefix']['pl'] = "Prefiks prezentacji numeru dzwoniącego.";
|
||||
$text['description-cid-number-prefix']['sv-se'] = "Ange nummerpresentation prefix. ";
|
||||
$text['description-cid-number-prefix']['uk'] = "";
|
||||
$text['description-cid-number-prefix']['uk'] = "Задайте номер префікса ідентифікації абонента.";
|
||||
$text['description-cid-number-prefix']['fr-fr'] = "Définir un préfixe sur le nombre d'ID d'appelant.";
|
||||
$text['description-cid-number-prefix']['de-at'] = "Setzen Sie ein Präfix für die Anruferkennung (Nummer)";
|
||||
|
||||
$text['description-cid-number']['en-us'] = "Select a number to override the original caller ID number.";
|
||||
$text['description-cid-number']['es-cl'] = "Seleccionar un número para anular el número de ID de llamada original.";
|
||||
$text['description-cid-number']['pt-pt'] = "Selecione um número para substituir o número de identificação de chamada inicial.";
|
||||
$text['description-cid-number']['fr-fr'] = "Sélectionnez un numéro pour remplacer le numéro d'origine identification de l'appelant.";
|
||||
$text['description-cid-number']['pt-br'] = "Selecione um número para substituir o número de identificação de chamada inicial.";
|
||||
$text['description-cid-number']['pl'] = "Wybierz numer, aby zastąpić oryginalny numer ID.";
|
||||
$text['description-cid-number']['sv-se'] = "Välj ett nummer för att åsidosätta den ursprungliga uppringaren ID-nummer.";
|
||||
$text['description-cid-number']['uk'] = "Виберіть номер, щоб перевизначити вихідний ідентифікаційний номер абонента.";
|
||||
$text['description-cid-number']['de-at'] = "Wählen Sie eine Nummer mit dem ursprünglichen Anrufer-ID-Nummer zu überschreiben.";
|
||||
|
||||
$text['description-cid-name-prefix']['en-us'] = "Set the caller ID name prefix.";
|
||||
$text['description-cid-name-prefix']['es-cl'] = "Configure el prefijo de nombre de caller ID";
|
||||
$text['description-cid-name-prefix']['pt-pt'] = "Defina o nome do Chamador";
|
||||
|
|
@ -350,7 +371,7 @@ $text['description-cid-name-prefix']['fr-fr'] = "Choisr le péfixe du nom d'appe
|
|||
$text['description-cid-name-prefix']['pt-br'] = "Defina o nome (ID) do discador.";
|
||||
$text['description-cid-name-prefix']['pl'] = "Prefiks prezentacji nazwy dzwoniącego.";
|
||||
$text['description-cid-name-prefix']['sv-se'] = "Ange namnpresentation prefix. ";
|
||||
$text['description-cid-name-prefix']['uk'] = "";
|
||||
$text['description-cid-name-prefix']['uk'] = "Встановіть префікс ідентифікаційного імені абонента.";
|
||||
$text['description-cid-name-prefix']['de-at'] = "Setzen Sie ein Präfix für die Anruferkennung (Name)";
|
||||
|
||||
$text['description-call-prompt']['en-us'] = "Prompt to accept the call for external destinations.";
|
||||
|
|
@ -373,6 +394,16 @@ $text['description-call_routing']['sv-se'] = "Definiera alternativa inkommande s
|
|||
$text['description-call_routing']['uk'] = "Визначити обробку для наступних розширень альтернативного вхідного дзвінка.";
|
||||
$text['description-call_routing']['de-at'] = "Definieren Sie alternative eingehende Anruf für die folgenden Erweiterungen der Handhabung.";
|
||||
|
||||
$text['description-call_forward']['en-us'] = "Forward all calls to the specified destination.";
|
||||
$text['description-call_forward']['es-cl'] = "Desviar todas las llamadas al destino especificado.";
|
||||
$text['description-call_forward']['pt-pt'] = "Encaminhar todas as chamadas para o destino especificado.";
|
||||
$text['description-call_forward']['fr-fr'] = "Transférer tous les appels vers la destination spécifiée.";
|
||||
$text['description-call_forward']['pt-br'] = "Encaminhar todas as chamadas para o destino especificado.";
|
||||
$text['description-call_forward']['pl'] = "Przekazywanie wszystkich połączeń do określonego przeznaczenia.";
|
||||
$text['description-call_forward']['sv-se'] = "Vidarekoppla alla samtal till den angivna destinationen.";
|
||||
$text['description-call_forward']['uk'] = "Усі дзвінки скеровуються на вказане місце призначення.";
|
||||
$text['description-call_forward']['de-at'] = "Leiten Sie alle Anrufe an das angegebene Ziel.";
|
||||
|
||||
$text['description']['en-us'] = "Directs incoming calls for extension:";
|
||||
$text['description']['es-cl'] = "Dirige las llamadas entrantes hacia una extensión:";
|
||||
$text['description']['pt-pt'] = "Direciona as chamadas recebidas para a extensão:";
|
||||
|
|
|
|||
|
|
@ -24,16 +24,20 @@
|
|||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('follow_me') || permission_exists('call_forward') || permission_exists('do_not_disturb')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//includes
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
|
||||
//check permissions
|
||||
if (permission_exists('follow_me') || permission_exists('call_forward') || permission_exists('do_not_disturb')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
|
|
@ -45,12 +49,7 @@ else {
|
|||
echo " <select class='formfld' style='width: 55px;' name='$select_name'>\n";
|
||||
$i = 0;
|
||||
while($i <= 100) {
|
||||
if ($select_value == $i) {
|
||||
echo " <option value='$i' selected='selected'>$i</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='$i'>$i</option>\n";
|
||||
}
|
||||
echo " <option value='".$i."' ".(($select_value == $i) ? "selected='selected'" : null).">".$i."</option>\n";
|
||||
$i = $i + 5;
|
||||
}
|
||||
echo "</select>\n";
|
||||
|
|
@ -113,243 +112,163 @@ else {
|
|||
}
|
||||
unset ($prep_statement);
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
//process post vars
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST)>0) {
|
||||
$forward_all_enabled = check_str($_POST["forward_all_enabled"]);
|
||||
$forward_all_destination = check_str($_POST["forward_all_destination"]);
|
||||
$forward_busy_enabled = check_str($_POST["forward_busy_enabled"]);
|
||||
$forward_busy_destination = check_str($_POST["forward_busy_destination"]);
|
||||
$forward_no_answer_enabled = check_str($_POST["forward_no_answer_enabled"]);
|
||||
$forward_no_answer_destination = check_str($_POST["forward_no_answer_destination"]);
|
||||
$forward_user_not_registered_destination = check_str($_POST["forward_user_not_registered_destination"]);
|
||||
$forward_user_not_registered_enabled = check_str($_POST["forward_user_not_registered_enabled"]);
|
||||
$forward_caller_id_uuid = check_str($_POST["forward_caller_id_uuid"]);
|
||||
$cid_name_prefix = check_str($_POST["cid_name_prefix"]);
|
||||
$cid_number_prefix = check_str($_POST["cid_number_prefix"]);
|
||||
$follow_me_enabled = check_str($_POST["follow_me_enabled"]);
|
||||
$follow_me_caller_id_uuid = check_str($_POST["follow_me_caller_id_uuid"]);
|
||||
$follow_me_ignore_busy = check_str($_POST["follow_me_ignore_busy"]);
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST)>0) {
|
||||
$forward_all_enabled = check_str($_POST["forward_all_enabled"]);
|
||||
$forward_all_destination = check_str($_POST["forward_all_destination"]);
|
||||
$forward_busy_enabled = check_str($_POST["forward_busy_enabled"]);
|
||||
$forward_busy_destination = check_str($_POST["forward_busy_destination"]);
|
||||
$forward_no_answer_enabled = check_str($_POST["forward_no_answer_enabled"]);
|
||||
$forward_no_answer_destination = check_str($_POST["forward_no_answer_destination"]);
|
||||
$forward_user_not_registered_enabled = check_str($_POST["forward_user_not_registered_enabled"]);
|
||||
$forward_user_not_registered_destination = check_str($_POST["forward_user_not_registered_destination"]);
|
||||
|
||||
$destination_data_1 = check_str($_POST["destination_data_1"]);
|
||||
$destination_delay_1 = check_str($_POST["destination_delay_1"]);
|
||||
$destination_prompt_1 = check_str($_POST["destination_prompt_1"]);
|
||||
$destination_timeout_1 = check_str($_POST["destination_timeout_1"]);
|
||||
|
||||
$destination_data_2 = check_str($_POST["destination_data_2"]);
|
||||
$destination_delay_2 = check_str($_POST["destination_delay_2"]);
|
||||
$destination_prompt_2 = check_str($_POST["destination_prompt_2"]);
|
||||
$destination_timeout_2 = check_str($_POST["destination_timeout_2"]);
|
||||
|
||||
$destination_data_3 = check_str($_POST["destination_data_3"]);
|
||||
$destination_delay_3 = check_str($_POST["destination_delay_3"]);
|
||||
$destination_prompt_3 = check_str($_POST["destination_prompt_3"]);
|
||||
$destination_timeout_3 = check_str($_POST["destination_timeout_3"]);
|
||||
|
||||
$destination_data_4 = check_str($_POST["destination_data_4"]);
|
||||
$destination_delay_4 = check_str($_POST["destination_delay_4"]);
|
||||
$destination_prompt_4 = check_str($_POST["destination_prompt_4"]);
|
||||
$destination_timeout_4 = check_str($_POST["destination_timeout_4"]);
|
||||
|
||||
$destination_data_5 = check_str($_POST["destination_data_5"]);
|
||||
$destination_delay_5 = check_str($_POST["destination_delay_5"]);
|
||||
$destination_prompt_5 = check_str($_POST["destination_prompt_5"]);
|
||||
$destination_timeout_5 = check_str($_POST["destination_timeout_5"]);
|
||||
|
||||
$dnd_enabled = check_str($_POST["dnd_enabled"]);
|
||||
|
||||
if (strlen($forward_all_destination) > 0) {
|
||||
// $forward_all_destination = preg_replace("~[^0-9]~", "",$forward_all_destination);
|
||||
}
|
||||
if (strlen($forward_busy_destination) > 0) {
|
||||
// $forward_busy_destination = preg_replace("~[^0-9*]~", "",$forward_busy_destination);
|
||||
}
|
||||
if (strlen($forward_no_answer_destination) > 0) {
|
||||
// $forward_no_answer_destination = preg_replace("~[^0-9*]~", "",$forward_no_answer_destination);
|
||||
}
|
||||
if (strlen($destination_data_1) > 0) {
|
||||
// $destination_data_1 = preg_replace("~[^0-9]~", "",$destination_data_1);
|
||||
}
|
||||
if (strlen($destination_data_2) > 0) {
|
||||
// $destination_data_2 = preg_replace("~[^0-9]~", "",$destination_data_2);
|
||||
}
|
||||
if (strlen($destination_data_3) > 0) {
|
||||
// $destination_data_3 = preg_replace("~[^0-9]~", "",$destination_data_3);
|
||||
}
|
||||
if (strlen($destination_data_4) > 0) {
|
||||
// $destination_data_4 = preg_replace("~[^0-9]~", "",$destination_data_4);
|
||||
}
|
||||
if (strlen($destination_data_5) > 0) {
|
||||
// $destination_data_5 = preg_replace("~[^0-9]~", "",$destination_data_5);
|
||||
}
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
//if (strlen($forward_all_enabled) == 0) { $msg .= "Please provide: Call Forward<br>\n"; }
|
||||
//if (strlen($forward_all_destination) == 0) { $msg .= "Please provide: Forward Number<br>\n"; }
|
||||
//if (strlen($forward_busy_enabled) == 0) { $msg .= "Please provide: On Busy<br>\n"; }
|
||||
//if (strlen($forward_busy_destination) == 0) { $msg .= "Please provide: Busy Number<br>\n"; }
|
||||
//if (strlen($forward_no_answer_enabled) == 0) { $msg .= "Please provide: no_answer<br>\n"; }
|
||||
//if (strlen($forward_no_answer_destination) == 0) { $msg .= "Please provide: no_answer Number<br>\n"; }
|
||||
//if (strlen($follow_me_enabled) == 0) { $msg .= "Please provide: Follow Me<br>\n"; }
|
||||
//if (strlen($destination_data_1) == 0) { $msg .= "Please provide: 1st Number<br>\n"; }
|
||||
//if (strlen($destination_timeout_1) == 0) { $msg .= "Please provide: sec<br>\n"; }
|
||||
//if (strlen($destination_data_2) == 0) { $msg .= "Please provide: 2nd Number<br>\n"; }
|
||||
//if (strlen($destination_timeout_2) == 0) { $msg .= "Please provide: sec<br>\n"; }
|
||||
//if (strlen($destination_data_3) == 0) { $msg .= "Please provide: 3rd Number<br>\n"; }
|
||||
//if (strlen($destination_timeout_3) == 0) { $msg .= "Please provide: sec<br>\n"; }
|
||||
//if (strlen($destination_data_4) == 0) { $msg .= "Please provide: 4th Number<br>\n"; }
|
||||
//if (strlen($destination_timeout_4) == 0) { $msg .= "Please provide: sec<br>\n"; }
|
||||
//if (strlen($destination_data_5) == 0) { $msg .= "Please provide: 5th Number<br>\n"; }
|
||||
//if (strlen($destination_timeout_5) == 0) { $msg .= "Please provide: sec<br>\n"; }
|
||||
//if (strlen($destination_data_6) == 0) { $msg .= "Please provide: 6th Number<br>\n"; }
|
||||
//if (strlen($destination_timeout_6) == 0) { $msg .= "Please provide: sec<br>\n"; }
|
||||
//if (strlen($destination_data_7) == 0) { $msg .= "Please provide: 7th Number<br>\n"; }
|
||||
//if (strlen($destination_timeout_7) == 0) { $msg .= "Please provide: sec<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/persist_form_var.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
$forward_caller_id_uuid = check_str($_POST["forward_caller_id_uuid"]);
|
||||
$cid_name_prefix = check_str($_POST["cid_name_prefix"]);
|
||||
$cid_number_prefix = check_str($_POST["cid_number_prefix"]);
|
||||
$follow_me_enabled = check_str($_POST["follow_me_enabled"]);
|
||||
$follow_me_caller_id_uuid = check_str($_POST["follow_me_caller_id_uuid"]);
|
||||
$follow_me_ignore_busy = check_str($_POST["follow_me_ignore_busy"]);
|
||||
$n = 0;
|
||||
foreach ($_POST["destinations"] as $field) {
|
||||
$destinations[$n]['uuid'] = check_str($field['uuid']);
|
||||
$destinations[$n]['destination'] = check_str($field['destination']);
|
||||
$destinations[$n]['delay'] = check_str($field['delay']);
|
||||
$destinations[$n]['prompt'] = check_str($field['prompt']);
|
||||
$destinations[$n]['timeout'] = check_str($field['timeout']);
|
||||
$n++;
|
||||
}
|
||||
$dnd_enabled = check_str($_POST["dnd_enabled"]);
|
||||
}
|
||||
|
||||
//set the default action to add
|
||||
$call_forward_action = "add";
|
||||
//check for all required data
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/persist_form_var.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//determine if this is an add or an update
|
||||
if (strlen($follow_me_uuid) == 0) {
|
||||
$follow_me_action = "add";
|
||||
}
|
||||
else {
|
||||
$follow_me_action = "update";
|
||||
}
|
||||
//include the classes
|
||||
include "resources/classes/call_forward.php";
|
||||
include "resources/classes/follow_me.php";
|
||||
include "resources/classes/do_not_disturb.php";
|
||||
|
||||
//include the classes
|
||||
include "resources/classes/call_forward.php";
|
||||
include "resources/classes/follow_me.php";
|
||||
include "resources/classes/do_not_disturb.php";
|
||||
//call forward config
|
||||
if (permission_exists('call_forward')) {
|
||||
$extensions['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$extensions['extension_uuid'] = $extension_uuid;
|
||||
$extensions['forward_all_enabled'] = $forward_all_enabled;
|
||||
$extensions['forward_all_destination'] = $forward_all_destination;
|
||||
$extensions['forward_busy_enabled'] = $forward_busy_enabled;
|
||||
$extensions['forward_busy_destination'] = $forward_busy_destination;
|
||||
$extensions['forward_no_answer_enabled'] = $forward_no_answer_enabled;
|
||||
$extensions['forward_no_answer_destination'] = $forward_no_answer_destination;
|
||||
$extensions['forward_user_not_registered_enabled'] = $forward_user_not_registered_enabled;
|
||||
$extensions['forward_user_not_registered_destination'] = $forward_user_not_registered_destination;
|
||||
$extensions['forward_caller_id_uuid'] = $forward_caller_id_uuid;
|
||||
}
|
||||
|
||||
//call forward config
|
||||
if (permission_exists('call_forward')) {
|
||||
$call_forward = new call_forward;
|
||||
$call_forward->domain_uuid = $_SESSION['domain_uuid'];
|
||||
$call_forward->domain_name = $_SESSION['domain_name'];
|
||||
$call_forward->extension_uuid = $extension_uuid;
|
||||
$call_forward->accountcode = $accountcode;
|
||||
$call_forward->forward_all_destination = $forward_all_destination;
|
||||
$call_forward->forward_all_enabled = $forward_all_enabled;
|
||||
$call_forward->forward_caller_id_uuid = $forward_caller_id_uuid;
|
||||
//$call_forward->set();
|
||||
//unset($call_forward);
|
||||
}
|
||||
//do not disturb (dnd) config
|
||||
if (permission_exists('do_not_disturb')) {
|
||||
$extensions['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$extensions['extension_uuid'] = $extension_uuid;
|
||||
$extensions['do_not_disturb'] = $dnd_enabled;
|
||||
}
|
||||
|
||||
//do not disturb (dnd) config
|
||||
if (permission_exists('do_not_disturb')) {
|
||||
$dnd = new do_not_disturb;
|
||||
$dnd->domain_uuid = $_SESSION['domain_uuid'];
|
||||
$dnd->domain_name = $_SESSION['domain_name'];
|
||||
$dnd->extension_uuid = $extension_uuid;
|
||||
$dnd->enabled = $dnd_enabled;
|
||||
//$dnd->set();
|
||||
//$dnd->user_status();
|
||||
//unset($dnd);
|
||||
}
|
||||
//follow me config
|
||||
if (permission_exists('follow_me')) {
|
||||
//build the follow me array
|
||||
if ($follow_me_uuid == '') {
|
||||
$follow_me_uuid = uuid();
|
||||
$extensions['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$extensions['extension_uuid'] = $extension_uuid;
|
||||
$extensions['follow_me_uuid'] = $follow_me_uuid;
|
||||
}
|
||||
|
||||
//if follow me is enabled then process it last
|
||||
if ($follow_me_enabled == "true") {
|
||||
//call forward
|
||||
$call_forward->set();
|
||||
unset($call_forward);
|
||||
//dnd
|
||||
$dnd->set();
|
||||
$dnd->user_status();
|
||||
unset($dnd);
|
||||
}
|
||||
$follow_me['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$follow_me['follow_me_uuid'] = $follow_me_uuid;
|
||||
$follow_me['cid_name_prefix'] = $cid_name_prefix;
|
||||
$follow_me['cid_number_prefix'] = $cid_number_prefix;
|
||||
$follow_me['follow_me_caller_id_uuid'] = $follow_me_caller_id_uuid;
|
||||
$follow_me['follow_me_ignore_busy'] = $follow_me_ignore_busy;
|
||||
|
||||
//follow me config
|
||||
if (permission_exists('follow_me')) {
|
||||
$follow_me = new follow_me;
|
||||
$follow_me->domain_uuid = $_SESSION['domain_uuid'];
|
||||
$follow_me->domain_name = $_SESSION['domain_name'];
|
||||
$follow_me->extension_uuid = $extension_uuid;
|
||||
$follow_me->db_type = $db_type;
|
||||
$follow_me->cid_name_prefix = $cid_name_prefix;
|
||||
$follow_me->cid_number_prefix = $cid_number_prefix;
|
||||
$follow_me->follow_me_enabled = $follow_me_enabled;
|
||||
$follow_me->follow_me_caller_id_uuid = $follow_me_caller_id_uuid;
|
||||
$follow_me->follow_me_ignore_busy = $follow_me_ignore_busy;
|
||||
$d = 0;
|
||||
$destination_found = false;
|
||||
foreach ($destinations as $field) {
|
||||
if ($field['destination'] != '') {
|
||||
$follow_me['follow_me_destinations'][$d]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$follow_me['follow_me_destinations'][$d]['follow_me_uuid'] = $follow_me_uuid;
|
||||
$follow_me['follow_me_destinations'][$d]['follow_me_destination_uuid'] = $field['uuid'];
|
||||
$follow_me['follow_me_destinations'][$d]['follow_me_destination'] = $field['destination'];
|
||||
$follow_me['follow_me_destinations'][$d]['follow_me_delay'] = $field['delay'];
|
||||
$follow_me['follow_me_destinations'][$d]['follow_me_prompt'] = $field['prompt'];
|
||||
$follow_me['follow_me_destinations'][$d]['follow_me_timeout'] = $field['timeout'];
|
||||
$follow_me['follow_me_destinations'][$d]['follow_me_order'] = $d;
|
||||
$destination_found = true;
|
||||
$d++;
|
||||
}
|
||||
else {
|
||||
$follow_me_delete_uuids[] = $field['uuid'];
|
||||
}
|
||||
}
|
||||
|
||||
$follow_me->destination_data_1 = $destination_data_1;
|
||||
$follow_me->destination_type_1 = $destination_type_1;
|
||||
$follow_me->destination_delay_1 = $destination_delay_1;
|
||||
$follow_me->destination_prompt_1 = $destination_prompt_1;
|
||||
$follow_me->destination_timeout_1 = $destination_timeout_1;
|
||||
$follow_me['follow_me_enabled'] = ($destination_found) ? $follow_me_enabled : 'false';
|
||||
}
|
||||
|
||||
$follow_me->destination_data_2 = $destination_data_2;
|
||||
$follow_me->destination_type_2 = $destination_type_2;
|
||||
$follow_me->destination_delay_2 = $destination_delay_2;
|
||||
$follow_me->destination_prompt_2 = $destination_prompt_2;
|
||||
$follow_me->destination_timeout_2 = $destination_timeout_2;
|
||||
//prepare the array
|
||||
if (is_array($extensions) && sizeof($extensions) > 0) {
|
||||
$array['extensions'][] = $extensions;
|
||||
}
|
||||
if (is_array($follow_me) && sizeof($follow_me) > 0) {
|
||||
$array['follow_me'][] = $follow_me;
|
||||
}
|
||||
|
||||
$follow_me->destination_data_3 = $destination_data_3;
|
||||
$follow_me->destination_type_3 = $destination_type_3;
|
||||
$follow_me->destination_delay_3 = $destination_delay_3;
|
||||
$follow_me->destination_prompt_3 = $destination_prompt_3;
|
||||
$follow_me->destination_timeout_3 = $destination_timeout_3;
|
||||
//save the data
|
||||
$orm = new orm;
|
||||
$orm->app_name = 'call_routing';
|
||||
$orm->app_uuid = '19806921-e8ed-dcff-b325-dd3e5da4959d';
|
||||
$orm->save($array);
|
||||
//$message = $orm->message;
|
||||
|
||||
$follow_me->destination_data_4 = $destination_data_4;
|
||||
$follow_me->destination_type_4 = $destination_type_4;
|
||||
$follow_me->destination_delay_4 = $destination_delay_4;
|
||||
$follow_me->destination_prompt_4 = $destination_prompt_4;
|
||||
$follow_me->destination_timeout_4 = $destination_timeout_4;
|
||||
|
||||
$follow_me->destination_data_5 = $destination_data_5;
|
||||
$follow_me->destination_type_5 = $destination_type_5;
|
||||
$follow_me->destination_delay_5 = $destination_delay_5;
|
||||
$follow_me->destination_prompt_5 = $destination_prompt_5;
|
||||
$follow_me->destination_timeout_5 = $destination_timeout_5;
|
||||
|
||||
if ($follow_me_action == "add") {
|
||||
$follow_me_uuid = uuid();
|
||||
|
||||
$sql = "update v_extensions set ";
|
||||
$sql .= "follow_me_uuid = '$follow_me_uuid' ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and extension_uuid = '$extension_uuid' ";
|
||||
//delete empty destination records
|
||||
if (is_array($follow_me_delete_uuids) && sizeof($follow_me_delete_uuids) > 0) {
|
||||
$sql = "delete from v_follow_me_destinations where follow_me_destination_uuid in ('".implode("','", $follow_me_delete_uuids)."') ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
$follow_me->follow_me_uuid = $follow_me_uuid;
|
||||
$follow_me->add();
|
||||
$follow_me->set();
|
||||
//call forward config
|
||||
if (permission_exists('call_forward')) {
|
||||
$call_forward = new call_forward;
|
||||
$call_forward->domain_uuid = $_SESSION['domain_uuid'];
|
||||
$call_forward->domain_name = $_SESSION['domain_name'];
|
||||
$call_forward->extension_uuid = $extension_uuid;
|
||||
$call_forward->forward_all_destination = $forward_all_destination;
|
||||
$call_forward->forward_all_enabled = $forward_all_enabled;
|
||||
$call_forward->forward_caller_id_uuid = $forward_caller_id_uuid;
|
||||
}
|
||||
if ($follow_me_action == "update") {
|
||||
$follow_me->follow_me_uuid = $follow_me_uuid;
|
||||
$follow_me->update();
|
||||
$follow_me->set();
|
||||
}
|
||||
unset($follow_me);
|
||||
}
|
||||
|
||||
//if dnd or call forward are enabled process it last
|
||||
if ($follow_me_enabled != "true") {
|
||||
if ($forward_all_enabled == "true") {
|
||||
//dnd
|
||||
$dnd->set();
|
||||
$dnd->user_status();
|
||||
unset($dnd);
|
||||
//call forward
|
||||
$call_forward->set();
|
||||
unset($call_forward);
|
||||
//do not disturb (dnd) config
|
||||
if (permission_exists('do_not_disturb')) {
|
||||
$dnd = new do_not_disturb;
|
||||
$dnd->domain_uuid = $_SESSION['domain_uuid'];
|
||||
$dnd->domain_name = $_SESSION['domain_name'];
|
||||
$dnd->extension_uuid = $extension_uuid;
|
||||
$dnd->extension = $extension;
|
||||
$dnd->enabled = $dnd_enabled;
|
||||
}
|
||||
else{
|
||||
|
||||
//if follow me is enabled then process call forward and dnd first
|
||||
if ($follow_me_enabled == "true") {
|
||||
//call forward
|
||||
$call_forward->set();
|
||||
unset($call_forward);
|
||||
|
|
@ -358,43 +277,63 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
$dnd->user_status();
|
||||
unset($dnd);
|
||||
}
|
||||
}
|
||||
|
||||
//synchronize configuration
|
||||
if (is_readable($_SESSION['switch']['extensions']['dir'])) {
|
||||
require_once "app/extensions/resources/classes/extension.php";
|
||||
$ext = new extension;
|
||||
$ext->xml();
|
||||
unset($ext);
|
||||
}
|
||||
//follow me config and process
|
||||
if (permission_exists('follow_me')) {
|
||||
$follow_me = new follow_me;
|
||||
$follow_me->domain_uuid = $_SESSION['domain_uuid'];
|
||||
$follow_me->extension_uuid = $extension_uuid;
|
||||
$follow_me->follow_me_uuid = $follow_me_uuid;
|
||||
$follow_me->follow_me_ignore_busy = $follow_me_ignore_busy;
|
||||
$follow_me->follow_me_caller_id_uuid = $follow_me_caller_id_uuid;
|
||||
$follow_me->follow_me_enabled = $follow_me_enabled;
|
||||
$follow_me->set();
|
||||
unset($follow_me);
|
||||
}
|
||||
|
||||
// Forward on busy and no_answer is stored in table and will be used by lua scripts
|
||||
$sql = "update v_extensions set ";
|
||||
$sql .= "forward_busy_destination = '".$forward_busy_destination."', ";
|
||||
$sql .= "forward_busy_enabled = '".$forward_busy_enabled."', ";
|
||||
$sql .= "forward_no_answer_destination = '".$forward_no_answer_destination."', ";
|
||||
$sql .= "forward_no_answer_enabled = '".$forward_no_answer_enabled."', ";
|
||||
$sql .= "forward_user_not_registered_destination = '".$forward_user_not_registered_destination."', ";
|
||||
$sql .= "forward_user_not_registered_enabled = '".$forward_user_not_registered_enabled."', ";
|
||||
$sql .= "forward_caller_id_uuid = ".(($forward_caller_id_uuid != '') ? "'".$forward_caller_id_uuid."' " : "null ");
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and extension_uuid = '".$extension_uuid."'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
//if dnd or call forward are enabled process them last
|
||||
if ($follow_me_enabled != "true") {
|
||||
if ($forward_all_enabled == "true") {
|
||||
//dnd
|
||||
$dnd->set();
|
||||
$dnd->user_status();
|
||||
unset($dnd);
|
||||
//call forward
|
||||
$call_forward->set();
|
||||
unset($call_forward);
|
||||
}
|
||||
else{
|
||||
//call forward
|
||||
$call_forward->set();
|
||||
unset($call_forward);
|
||||
//dnd
|
||||
$dnd->set();
|
||||
$dnd->user_status();
|
||||
unset($dnd);
|
||||
}
|
||||
}
|
||||
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
$cache->delete("directory:".$extension."@".$_SESSION['domain_name']);
|
||||
if(strlen($number_alias) > 0){
|
||||
$cache->delete("directory:".$number_alias."@".$_SESSION['domain_name']);
|
||||
}
|
||||
//synchronize configuration
|
||||
if (is_readable($_SESSION['switch']['extensions']['dir'])) {
|
||||
require_once "app/extensions/resources/classes/extension.php";
|
||||
$ext = new extension;
|
||||
$ext->xml();
|
||||
unset($ext);
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
$_SESSION["message"] = $text['confirm-update'];
|
||||
header("Location: ".$_REQUEST['return_url']);
|
||||
return;
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
$cache->delete("directory:".$extension."@".$_SESSION['domain_name']);
|
||||
if(strlen($number_alias) > 0){
|
||||
$cache->delete("directory:".$number_alias."@".$_SESSION['domain_name']);
|
||||
}
|
||||
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
//redirect the user
|
||||
$_SESSION["message"] = $text['confirm-update'];
|
||||
header("Location: ".$_REQUEST['return_url']);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "resources/header.php";
|
||||
|
|
@ -402,8 +341,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
//pre-populate the form
|
||||
if ($follow_me_uuid != '') {
|
||||
$sql = "select * from v_follow_me ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and follow_me_uuid = '$follow_me_uuid' ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and follow_me_uuid = '".$follow_me_uuid."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
|
|
@ -415,44 +354,17 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
$follow_me_ignore_busy = $row["follow_me_ignore_busy"];
|
||||
|
||||
$sql = "select * from v_follow_me_destinations ";
|
||||
$sql .= "where follow_me_uuid = '$follow_me_uuid' ";
|
||||
$sql .= "where follow_me_uuid = '".$follow_me_uuid."' ";
|
||||
$sql .= "order by follow_me_order asc ";
|
||||
$prep_statement_2 = $db->prepare(check_sql($sql));
|
||||
$prep_statement_2->execute();
|
||||
$result2 = $prep_statement_2->fetchAll(PDO::FETCH_NAMED);
|
||||
$x = 1;
|
||||
foreach ($result2 as &$row2) {
|
||||
if ($x == 1) {
|
||||
$destination_data_1 = $row2["follow_me_destination"];
|
||||
$destination_delay_1 = $row2["follow_me_delay"];
|
||||
$destination_prompt_1 = $row2["follow_me_prompt"];
|
||||
$destination_timeout_1 = $row2["follow_me_timeout"];
|
||||
}
|
||||
if ($x == 2) {
|
||||
$destination_data_2 = $row2["follow_me_destination"];
|
||||
$destination_delay_2 = $row2["follow_me_delay"];
|
||||
$destination_prompt_2 = $row2["follow_me_prompt"];
|
||||
$destination_timeout_2 = $row2["follow_me_timeout"];
|
||||
}
|
||||
if ($x == 3) {
|
||||
$destination_data_3 = $row2["follow_me_destination"];
|
||||
$destination_delay_3 = $row2["follow_me_delay"];
|
||||
$destination_prompt_3 = $row2["follow_me_prompt"];
|
||||
$destination_timeout_3 = $row2["follow_me_timeout"];
|
||||
}
|
||||
if ($x == 4) {
|
||||
$destination_data_4 = $row2["follow_me_destination"];
|
||||
$destination_delay_4 = $row2["follow_me_delay"];
|
||||
$destination_prompt_4 = $row2["follow_me_prompt"];
|
||||
$destination_timeout_4 = $row2["follow_me_timeout"];
|
||||
}
|
||||
if ($x == 5) {
|
||||
$destination_data_5 = $row2["follow_me_destination"];
|
||||
$destination_delay_5 = $row2["follow_me_delay"];
|
||||
$destination_prompt_5 = $row2["follow_me_prompt"];
|
||||
$destination_timeout_5 = $row2["follow_me_timeout"];
|
||||
}
|
||||
$x++;
|
||||
foreach ($result2 as $x => &$row2) {
|
||||
$destinations[$x]['uuid'] = $row2["follow_me_destination_uuid"];
|
||||
$destinations[$x]['destination'] = $row2["follow_me_destination"];
|
||||
$destinations[$x]['delay'] = $row2["follow_me_delay"];
|
||||
$destinations[$x]['prompt'] = $row2["follow_me_prompt"];
|
||||
$destinations[$x]['timeout'] = $row2["follow_me_timeout"];
|
||||
}
|
||||
unset ($prep_statement_2);
|
||||
}
|
||||
|
|
@ -487,21 +399,11 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
}
|
||||
}
|
||||
echo " ];\n";
|
||||
echo " \$(\"#destination_data_1\").autocomplete({\n";
|
||||
echo " source: extensions\n";
|
||||
echo " });\n";
|
||||
echo " \$(\"#destination_data_2\").autocomplete({\n";
|
||||
echo " source: extensions\n";
|
||||
echo " });\n";
|
||||
echo " \$(\"#destination_data_3\").autocomplete({\n";
|
||||
echo " source: extensions\n";
|
||||
echo " });\n";
|
||||
echo " \$(\"#destination_data_4\").autocomplete({\n";
|
||||
echo " source: extensions\n";
|
||||
echo " });\n";
|
||||
echo " \$(\"#destination_data_5\").autocomplete({\n";
|
||||
echo " source: extensions\n";
|
||||
echo " });\n";
|
||||
for ($n = 0; $n <= ((($_SESSION['follow_me']['max_destinations']['numeric'] != '') ? $_SESSION['follow_me']['max_destinations']['numeric'] : 5) - 1); $n++) {
|
||||
echo " \$(\"#destination_".$n."\").autocomplete({\n";
|
||||
echo " source: extensions\n";
|
||||
echo " });\n";
|
||||
}
|
||||
echo "});\n";
|
||||
echo "</script>\n";
|
||||
|
||||
|
|
@ -521,7 +423,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' colspan='2'>\n";
|
||||
echo " ".$text['description']." $extension.<br /><br />\n";
|
||||
echo " ".$text['description']." <strong>".$extension."</strong><br /><br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
|
|
@ -539,34 +441,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
unset($on_click);
|
||||
echo " ";
|
||||
echo " <input class='formfld' type='text' name='forward_all_destination' id='forward_all_destination' maxlength='255' placeholder=\"".$text['label-destination']."\" value=\"".$forward_all_destination."\">\n";
|
||||
|
||||
if (permission_exists('follow_me_cid_set')) {
|
||||
echo " ";
|
||||
$sql_forward = "select destination_uuid, destination_number, destination_description, destination_caller_id_number, destination_caller_id_name from v_destinations where domain_uuid = '$domain_uuid' and destination_type = 'inbound' order by destination_number asc ";
|
||||
$prep_statement_forward = $db->prepare(check_sql($sql_forward));
|
||||
$prep_statement_forward->execute();
|
||||
$result_forward = $prep_statement_forward->fetchAll(PDO::FETCH_ASSOC);
|
||||
if (count($result_forward) > 0) {
|
||||
echo "<select name='forward_caller_id_uuid' id='forward_caller_id_uuid' class='formfld' >\n";
|
||||
echo " <option value=''>".$text['label-select-cid-number']."</option>\n";
|
||||
echo " <option value='' disabled='disabled'></option>\n";
|
||||
foreach ($result_forward as &$row_forward) {
|
||||
$selected = $row_forward["destination_uuid"] == $forward_caller_id_uuid ? "selected='selected' " : '';
|
||||
$caller_id_number = $row_forward['destination_caller_id_number'];
|
||||
if(strlen($caller_id_number) == 0){
|
||||
$caller_id_number = $row_forward['destination_number'];
|
||||
}
|
||||
$caller_id_name = $row_forward['destination_caller_id_name'];
|
||||
if(strlen($caller_id_name) == 0){
|
||||
$caller_id_name = $row_forward['destination_description'];
|
||||
}
|
||||
echo "<option value='".$row_forward["destination_uuid"]."' ".$selected.">".format_phone($caller_id_number)." : ".$caller_id_name."</option>\n";
|
||||
}
|
||||
echo "</select>\n";
|
||||
}
|
||||
unset ($sql_forward, $prep_statement_forward, $result_forward, $row_forward);
|
||||
}
|
||||
|
||||
echo " <br />".$text['description-call_forward']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
|
|
@ -582,7 +457,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
unset($on_click);
|
||||
echo " ";
|
||||
echo " <input class='formfld' type='text' name='forward_busy_destination' id='forward_busy_destination' maxlength='255' placeholder=\"".$text['label-destination']."\" value=\"".$forward_busy_destination."\">\n";
|
||||
echo " <br />".$text['description-on-busy'].".\n";
|
||||
echo " <br />".$text['description-on-busy']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
|
|
@ -598,7 +473,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
unset($on_click);
|
||||
echo " ";
|
||||
echo " <input class='formfld' type='text' name='forward_no_answer_destination' id='forward_no_answer_destination' maxlength='255' placeholder=\"".$text['label-destination']."\" value=\"".$forward_no_answer_destination."\">\n";
|
||||
echo " <br />".$text['description-no_answer'].".\n";
|
||||
echo " <br />".$text['description-no_answer']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
|
|
@ -613,10 +488,43 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
unset($on_click);
|
||||
echo " ";
|
||||
echo " <input class='formfld' type='text' name='forward_user_not_registered_destination' id='forward_user_not_registered_destination' maxlength='255' placeholder=\"".$text['label-destination']."\" value=\"".$forward_user_not_registered_destination."\">\n";
|
||||
echo " <br />".$text['description-not_registered'].".\n";
|
||||
echo " <br />".$text['description-not_registered']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if (permission_exists('follow_me_cid_set')) {
|
||||
$sql_forward = "select destination_uuid, destination_number, destination_description, destination_caller_id_number, destination_caller_id_name from v_destinations where domain_uuid = '$domain_uuid' and destination_type = 'inbound' order by destination_number asc ";
|
||||
$prep_statement_forward = $db->prepare(check_sql($sql_forward));
|
||||
$prep_statement_forward->execute();
|
||||
$result_forward = $prep_statement_forward->fetchAll(PDO::FETCH_ASSOC);
|
||||
if (count($result_forward) > 0) {
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>";
|
||||
echo $text['label-cid-number'];
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select name='forward_caller_id_uuid' id='forward_caller_id_uuid' class='formfld' >\n";
|
||||
echo " <option value=''></option>\n";
|
||||
foreach ($result_forward as &$row_forward) {
|
||||
$selected = $row_forward["destination_uuid"] == $forward_caller_id_uuid ? "selected='selected' " : '';
|
||||
$caller_id_number = $row_forward['destination_caller_id_number'];
|
||||
if(strlen($caller_id_number) == 0){
|
||||
$caller_id_number = $row_forward['destination_number'];
|
||||
}
|
||||
$caller_id_name = $row_forward['destination_caller_id_name'];
|
||||
if(strlen($caller_id_name) == 0){
|
||||
$caller_id_name = $row_forward['destination_description'];
|
||||
}
|
||||
echo " <option value='".$row_forward["destination_uuid"]."' ".$selected.">".format_phone($caller_id_number)." : ".$caller_id_name."</option>\n";
|
||||
}
|
||||
echo " </select><br />\n";
|
||||
echo $text['description-cid-number']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
unset ($sql_forward, $prep_statement_forward, $result_forward, $row_forward);
|
||||
}
|
||||
|
||||
echo "<tr><td colspan='2'><br /></td></tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
|
|
@ -632,37 +540,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
echo " <label for='follow_me_disabled'><input type='radio' name='follow_me_enabled' id='follow_me_disabled' onclick=\"$('#tr_follow_me_settings').slideUp('fast');\" value='false' ".(($follow_me_enabled == "false" || $follow_me_enabled == "") ? "checked='checked'" : null)." /> ".$text['label-disabled']."</label> \n";
|
||||
echo " <label for='follow_me_enabled'><input type='radio' name='follow_me_enabled' id='follow_me_enabled' onclick=\"$('#tr_follow_me_settings').slideDown('fast'); ".$on_click."\" value='true' ".(($follow_me_enabled == "true") ? "checked='checked'" : null)."/> ".$text['label-enabled']."</label> \n";
|
||||
unset($on_click);
|
||||
|
||||
if (permission_exists('follow_me_cid_set')) {
|
||||
echo " ";
|
||||
$sql_follow_me = "select destination_uuid, destination_number, destination_description, destination_caller_id_number, destination_caller_id_name from v_destinations where domain_uuid = '$domain_uuid' and destination_type = 'inbound' order by destination_number asc ";
|
||||
$prep_statement_follow_me = $db->prepare(check_sql($sql_follow_me));
|
||||
$prep_statement_follow_me->execute();
|
||||
$result_follow_me = $prep_statement_follow_me->fetchAll(PDO::FETCH_ASSOC);
|
||||
if (count($result_follow_me) > 0) {
|
||||
echo "<select name='follow_me_caller_id_uuid' id='follow_me_caller_id_uuid' class='formfld' >\n";
|
||||
echo " <option value=''>".$text['label-select-cid-number']."</option>\n";
|
||||
echo " <option value='' disabled='disabled'></option>\n";
|
||||
foreach ($result_follow_me as &$row_follow_me) {
|
||||
$selected = $row_follow_me["destination_uuid"] == $follow_me_caller_id_uuid ? "selected='selected'" : '';
|
||||
|
||||
$caller_id_number = $row_follow_me['destination_caller_id_number'];
|
||||
if(strlen($caller_id_number) == 0){
|
||||
$caller_id_number = $row_follow_me['destination_number'];
|
||||
}
|
||||
$caller_id_name = $row_follow_me['destination_caller_id_name'];
|
||||
if(strlen($caller_id_name) == 0){
|
||||
$caller_id_name = $row_follow_me['destination_description'];
|
||||
}
|
||||
|
||||
echo "<option value='".$row_follow_me["destination_uuid"]."' ".$selected.">".format_phone($caller_id_number)." : ".$caller_id_name."</option>\n";
|
||||
}
|
||||
echo "</select>\n";
|
||||
}
|
||||
unset ($sql_follow_me, $prep_statement_follow_me, $result_follow_me, $row_follow_me);
|
||||
}
|
||||
|
||||
echo " <br /><br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
|
|
@ -687,105 +564,28 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
}
|
||||
echo " </tr>\n";
|
||||
|
||||
// 1st destination
|
||||
echo " <tr>\n";
|
||||
echo " <td><input class='formfld' style='min-width: 135px;' type='text' name='destination_data_1' id='destination_data_1' maxlength='255' value=\"".$destination_data_1."\"></td>\n";
|
||||
echo " <td>\n";
|
||||
destination_select('destination_delay_1', $destination_delay_1, '0');
|
||||
echo " </td>\n";
|
||||
echo " <td>\n";
|
||||
destination_select('destination_timeout_1', $destination_timeout_1, '30');
|
||||
echo " </td>\n";
|
||||
if (permission_exists('follow_me_prompt')) {
|
||||
echo " <td>\n";
|
||||
echo " <select class='formfld' style='width: 90px;' name='destination_prompt_1'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
echo " <option value='1' ".(($destination_prompt_1)?"selected='selected'":null).">".$text['label-destination_prompt_confirm']."</option>\n";
|
||||
//echo " <option value='2'>".$text['label-destination_prompt_announce]."</option>\n";
|
||||
echo " </select>\n";
|
||||
echo " </td>\n";
|
||||
//output destinations
|
||||
for ($n = 0; $n <= ((($_SESSION['follow_me']['max_destinations']['numeric'] != '') ? $_SESSION['follow_me']['max_destinations']['numeric'] : 5) - 1); $n++) {
|
||||
echo " <input type='hidden' name='destinations[".$n."][uuid]' value='".(($destinations[$n]['uuid'] != '') ? $destinations[$n]['uuid'] : uuid())."'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td><input class='formfld' style='min-width: 135px;' type='text' name='destinations[".$n."][destination]' id='destination_".$n."' maxlength='255' value=\"".$destinations[$n]['destination']."\"></td>\n";
|
||||
echo " <td>\n";
|
||||
destination_select('destinations['.$n.'][delay]', $destinations[$n]['delay'], '0');
|
||||
echo " </td>\n";
|
||||
echo " <td>\n";
|
||||
destination_select('destinations['.$n.'][timeout]', $destinations[$n]['timeout'], (($_SESSION['follow_me']['timeout']['numeric'] != '') ? $_SESSION['follow_me']['timeout']['numeric'] : 30));
|
||||
echo " </td>\n";
|
||||
if (permission_exists('follow_me_prompt')) {
|
||||
echo " <td>\n";
|
||||
echo " <select class='formfld' style='width: 90px;' name='destinations[".$n."][prompt]'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
echo " <option value='1' ".(($destinations[$n]['prompt'])?"selected='selected'":null).">".$text['label-destination_prompt_confirm']."</option>\n";
|
||||
//echo " <option value='2'>".$text['label-destination_prompt_announce]."</option>\n";
|
||||
echo " </select>\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo " </tr>\n";
|
||||
}
|
||||
echo " </tr>\n";
|
||||
|
||||
// 2nd destination
|
||||
echo " <tr>\n";
|
||||
echo " <td><input class='formfld' style='min-width: 135px;' type='text' name='destination_data_2' id='destination_data_2' maxlength='255' value=\"".$destination_data_2."\"></td>\n";
|
||||
echo " <td>\n";
|
||||
destination_select('destination_delay_2', $destination_delay_2, '0');
|
||||
echo " </td>\n";
|
||||
echo " <td>\n";
|
||||
destination_select('destination_timeout_2', $destination_timeout_2, '30');
|
||||
echo " </td>\n";
|
||||
if (permission_exists('follow_me_prompt')) {
|
||||
echo " <td>\n";
|
||||
echo " <select class='formfld' style='width: 90px;' name='destination_prompt_2'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
echo " <option value='1' ".(($destination_prompt_2)?"selected='selected'":null).">".$text['label-destination_prompt_confirm']."</option>\n";
|
||||
//echo " <option value='2'>".$text['label-destination_prompt_announce]."</option>\n";
|
||||
echo " </select>\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo " </tr>\n";
|
||||
|
||||
// 3rd destination
|
||||
echo " <tr>\n";
|
||||
echo " <td><input class='formfld' style='min-width: 135px;' type='text' name='destination_data_3' id='destination_data_3' maxlength='255' value=\"".$destination_data_3."\"></td>\n";
|
||||
echo " <td>\n";
|
||||
destination_select('destination_delay_3', $destination_delay_3, '0');
|
||||
echo " </td>\n";
|
||||
echo " <td>\n";
|
||||
destination_select('destination_timeout_3', $destination_timeout_3, '30');
|
||||
echo " </td>\n";
|
||||
if (permission_exists('follow_me_prompt')) {
|
||||
echo " <td>\n";
|
||||
echo " <select class='formfld' style='width: 90px;' name='destination_prompt_3'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
echo " <option value='1' ".(($destination_prompt_3)?"selected='selected'":null).">".$text['label-destination_prompt_confirm']."</option>\n";
|
||||
//echo " <option value='2'>".$text['label-destination_prompt_announce]."</option>\n";
|
||||
echo " </select>\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo " </tr>\n";
|
||||
|
||||
// 4th destination
|
||||
echo " <tr>\n";
|
||||
echo " <td><input class='formfld' style='min-width: 135px;' type='text' name='destination_data_4' id='destination_data_4' maxlength='255' value=\"".$destination_data_4."\"></td>\n";
|
||||
echo " <td>\n";
|
||||
destination_select('destination_delay_4', $destination_delay_4, '0');
|
||||
echo " </td>\n";
|
||||
echo " <td>\n";
|
||||
destination_select('destination_timeout_4', $destination_timeout_4, '30');
|
||||
echo " </td>\n";
|
||||
if (permission_exists('follow_me_prompt')) {
|
||||
echo " <td>\n";
|
||||
echo " <select class='formfld' style='width: 90px;' name='destination_prompt_4'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
echo " <option value='1' ".(($destination_prompt_4)?"selected='selected'":null).">".$text['label-destination_prompt_confirm']."</option>\n";
|
||||
//echo " <option value='2'>".$text['label-destination_prompt_announce]."</option>\n";
|
||||
echo " </select>\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo " </tr>\n";
|
||||
|
||||
// 5th destination
|
||||
echo " <tr>\n";
|
||||
echo " <td><input class='formfld' style='min-width: 135px;' type='text' name='destination_data_5' id='destination_data_5' maxlength='255' value=\"".$destination_data_5."\"></td>\n";
|
||||
echo " <td>\n";
|
||||
destination_select('destination_delay_5', $destination_delay_5, '0');
|
||||
echo " </td>\n";
|
||||
echo " <td>\n";
|
||||
destination_select('destination_timeout_5', $destination_timeout_5, '30');
|
||||
echo " </td>\n";
|
||||
if (permission_exists('follow_me_prompt')) {
|
||||
echo " <td>\n";
|
||||
echo " <select class='formfld' style='width: 90px;' name='destination_prompt_5'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
echo " <option value='1' ".(($destination_prompt_5)?"selected='selected'":null).">".$text['label-destination_prompt_confirm']."</option>\n";
|
||||
//echo " <option value='2'>".$text['label-destination_prompt_announce]."</option>\n";
|
||||
echo " </select>\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo " </tr>\n";
|
||||
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
|
|
@ -794,18 +594,52 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
if (permission_exists('follow_me_ignore_busy')) {
|
||||
echo " <tr>\n";
|
||||
echo " <td class='vncell' valign='top' align='left' nowrap='nowrap'>";
|
||||
echo $text['label-ignore-busy'];
|
||||
echo $text['label-ignore_busy'];
|
||||
echo " </td>\n";
|
||||
echo " <td class='vtable' align='left'>\n";
|
||||
echo " <label for='follow_me_ignore_busy_false'><input type='radio' name='follow_me_ignore_busy' id='follow_me_ignore_busy_false' value='false' onclick=\"\" ".(($follow_me_ignore_busy == "false" || $follow_me_ignore_busy == "") ? "checked='checked'" : null)." /> ".$text['label-disabled']."</label> \n";
|
||||
echo " <label for='follow_me_ignore_busy_true'><input type='radio' name='follow_me_ignore_busy' id='follow_me_ignore_busy_true' value='true' onclick=\"$on_click\" ".(($follow_me_ignore_busy == "true") ? "checked='checked'" : null)." /> ".$text['label-enabled']."</label> \n";
|
||||
echo " <br />\n";
|
||||
echo $text['description-ignore-busy']." \n";
|
||||
//echo " <br> Interrupt call if one of destination are busy\n";
|
||||
echo $text['description-ignore_busy']."\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
}
|
||||
|
||||
if (permission_exists('follow_me_cid_set')) {
|
||||
$sql_follow_me = "select destination_uuid, destination_number, destination_description, destination_caller_id_number, destination_caller_id_name from v_destinations where domain_uuid = '$domain_uuid' and destination_type = 'inbound' order by destination_number asc ";
|
||||
$prep_statement_follow_me = $db->prepare(check_sql($sql_follow_me));
|
||||
$prep_statement_follow_me->execute();
|
||||
$result_follow_me = $prep_statement_follow_me->fetchAll(PDO::FETCH_ASSOC);
|
||||
if (count($result_follow_me) > 0) {
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>";
|
||||
echo $text['label-cid-number'];
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select name='follow_me_caller_id_uuid' id='follow_me_caller_id_uuid' class='formfld' >\n";
|
||||
echo " <option value=''></option>\n";
|
||||
foreach ($result_follow_me as &$row_follow_me) {
|
||||
$selected = $row_follow_me["destination_uuid"] == $follow_me_caller_id_uuid ? "selected='selected'" : '';
|
||||
|
||||
$caller_id_number = $row_follow_me['destination_caller_id_number'];
|
||||
if(strlen($caller_id_number) == 0){
|
||||
$caller_id_number = $row_follow_me['destination_number'];
|
||||
}
|
||||
$caller_id_name = $row_follow_me['destination_caller_id_name'];
|
||||
if(strlen($caller_id_name) == 0){
|
||||
$caller_id_name = $row_follow_me['destination_description'];
|
||||
}
|
||||
|
||||
echo " <option value='".$row_follow_me["destination_uuid"]."' ".$selected.">".format_phone($caller_id_number)." : ".$caller_id_name."</option>\n";
|
||||
}
|
||||
echo " </select><br />\n";
|
||||
echo $text['description-cid-number']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
unset ($sql_follow_me, $prep_statement_follow_me, $result_follow_me, $row_follow_me);
|
||||
}
|
||||
|
||||
if (permission_exists('follow_me_cid_name_prefix')) {
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
|
|
@ -814,7 +648,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='cid_name_prefix' maxlength='255' value='$cid_name_prefix'>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-cid-name-prefix']." \n";
|
||||
echo $text['description-cid-name-prefix']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
|
@ -827,7 +661,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='cid_number_prefix' maxlength='255' value='$cid_number_prefix'>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-cid-number-prefix']." \n";
|
||||
echo $text['description-cid-number-prefix']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
|
@ -854,14 +688,14 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='id' value='$extension_uuid'>\n";
|
||||
echo " <input type='hidden' name='id' value='".$extension_uuid."'>\n";
|
||||
}
|
||||
echo " <br>";
|
||||
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
|
||||
echo " <br />";
|
||||
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "<br><br>";
|
||||
echo "<br /><br />";
|
||||
echo "</form>";
|
||||
|
||||
//include the footer
|
||||
|
|
|
|||
|
|
@ -266,150 +266,147 @@ include "root.php";
|
|||
}
|
||||
unset ($prep_statement);
|
||||
|
||||
//add follow me
|
||||
if (strlen($follow_me_uuid) == 0) {
|
||||
$this->add();
|
||||
//set the extension dial string
|
||||
$sql = "select * from v_follow_me_destinations ";
|
||||
$sql .= "where follow_me_uuid = '".$this->follow_me_uuid."' ";
|
||||
$sql .= "order by follow_me_order asc ";
|
||||
$prep_statement_2 = $db->prepare(check_sql($sql));
|
||||
$prep_statement_2->execute();
|
||||
$result = $prep_statement_2->fetchAll(PDO::FETCH_NAMED);
|
||||
$dial_string = "{";
|
||||
if ($this->follow_me_ignore_busy != 'true') {
|
||||
$dial_string .= "fail_on_single_reject=USER_BUSY,";
|
||||
}
|
||||
$dial_string .= "instant_ringback=true,";
|
||||
$dial_string .= "ignore_early_media=true";
|
||||
$dial_string .= ",domain_uuid=".$_SESSION['domain_uuid'];
|
||||
$dial_string .= ",sip_invite_domain=".$_SESSION['domain_name'];
|
||||
$dial_string .= ",domain_name=".$_SESSION['domain_name'];
|
||||
$dial_string .= ",domain=".$_SESSION['domain_name'];
|
||||
$dial_string .= ",extension_uuid=".$this->extension_uuid;
|
||||
$dial_string .= ",group_confirm_key=exec,group_confirm_file=lua confirm.lua";
|
||||
|
||||
$dial_string_caller_id_name = "\${effective_caller_id_name}";
|
||||
$dial_string_caller_id_number = "\${effective_caller_id_number}";
|
||||
|
||||
if (strlen($this->follow_me_caller_id_uuid) > 0){
|
||||
$sql_caller = "select destination_number, destination_description, destination_caller_id_number, destination_caller_id_name from v_destinations where domain_uuid = '$this->domain_uuid' and destination_type = 'inbound' and destination_uuid = '$this->follow_me_caller_id_uuid'";
|
||||
$prep_statement_caller = $db->prepare($sql_caller);
|
||||
if ($prep_statement_caller) {
|
||||
$prep_statement_caller->execute();
|
||||
$row_caller = $prep_statement_caller->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
$caller_id_number = $row_caller['destination_caller_id_number'];
|
||||
if(strlen($caller_id_number) == 0){
|
||||
$caller_id_number = $row_caller['destination_number'];
|
||||
}
|
||||
$caller_id_name = $row_caller['destination_caller_id_name'];
|
||||
if(strlen($caller_id_name) == 0){
|
||||
$caller_id_name = $row_caller['destination_description'];
|
||||
}
|
||||
|
||||
if (strlen($caller_id_name) > 0) {
|
||||
$dial_string_caller_id_name = $caller_id_name;
|
||||
}
|
||||
if (strlen($caller_id_number) > 0) {
|
||||
$dial_string_caller_id_number = $caller_id_number;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//set the extension dial string
|
||||
$sql = "select * from v_follow_me_destinations ";
|
||||
$sql .= "where follow_me_uuid = '".$this->follow_me_uuid."' ";
|
||||
$sql .= "order by follow_me_order asc ";
|
||||
$prep_statement_2 = $db->prepare(check_sql($sql));
|
||||
$prep_statement_2->execute();
|
||||
$result = $prep_statement_2->fetchAll(PDO::FETCH_NAMED);
|
||||
$dial_string = "{";
|
||||
if ($this->follow_me_ignore_busy != 'true') {
|
||||
$dial_string .= "fail_on_single_reject=USER_BUSY,";
|
||||
}
|
||||
$dial_string .= "instant_ringback=true,";
|
||||
$dial_string .= "ignore_early_media=true";
|
||||
$dial_string .= ",domain_uuid=".$_SESSION['domain_uuid'];
|
||||
$dial_string .= ",sip_invite_domain=".$_SESSION['domain_name'];
|
||||
$dial_string .= ",domain_name=".$_SESSION['domain_name'];
|
||||
$dial_string .= ",domain=".$_SESSION['domain_name'];
|
||||
$dial_string .= ",extension_uuid=".$this->extension_uuid;
|
||||
$dial_string .= ",group_confirm_key=exec,group_confirm_file=lua confirm.lua";
|
||||
if (strlen($this->cid_name_prefix) > 0) {
|
||||
$dial_string .= ",origination_caller_id_name=".$this->cid_name_prefix."$dial_string_caller_id_name";
|
||||
}
|
||||
else {
|
||||
$dial_string .= ",origination_caller_id_name=$dial_string_caller_id_name";
|
||||
}
|
||||
|
||||
$dial_string_caller_id_name = "\${effective_caller_id_name}";
|
||||
$dial_string_caller_id_number = "\${effective_caller_id_number}";
|
||||
if (strlen($this->cid_number_prefix) > 0) {
|
||||
//$dial_string .= ",origination_caller_id_number=".$this->cid_number_prefix."";
|
||||
$dial_string .= ",origination_caller_id_number=".$this->cid_number_prefix."$dial_string_caller_id_number";
|
||||
}
|
||||
else {
|
||||
$dial_string .= ",origination_caller_id_number=$dial_string_caller_id_number";
|
||||
}
|
||||
|
||||
if (strlen($this->follow_me_caller_id_uuid) > 0){
|
||||
$sql_caller = "select destination_number, destination_description, destination_caller_id_number, destination_caller_id_name from v_destinations where domain_uuid = '$this->domain_uuid' and destination_type = 'inbound' and destination_uuid = '$this->follow_me_caller_id_uuid'";
|
||||
$prep_statement_caller = $db->prepare($sql_caller);
|
||||
if ($prep_statement_caller) {
|
||||
$prep_statement_caller->execute();
|
||||
$row_caller = $prep_statement_caller->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
$caller_id_number = $row_caller['destination_caller_id_number'];
|
||||
if(strlen($caller_id_number) == 0){
|
||||
$caller_id_number = $row_caller['destination_number'];
|
||||
}
|
||||
$caller_id_name = $row_caller['destination_caller_id_name'];
|
||||
if(strlen($caller_id_name) == 0){
|
||||
$caller_id_name = $row_caller['destination_description'];
|
||||
}
|
||||
|
||||
if (strlen($caller_id_name) > 0) {
|
||||
$dial_string_caller_id_name = $caller_id_name;
|
||||
}
|
||||
if (strlen($caller_id_number) > 0) {
|
||||
$dial_string_caller_id_number = $caller_id_number;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen($this->cid_name_prefix) > 0) {
|
||||
$dial_string .= ",origination_caller_id_name=".$this->cid_name_prefix."$dial_string_caller_id_name";
|
||||
}
|
||||
else {
|
||||
$dial_string .= ",origination_caller_id_name=$dial_string_caller_id_name";
|
||||
}
|
||||
|
||||
if (strlen($this->cid_number_prefix) > 0) {
|
||||
//$dial_string .= ",origination_caller_id_number=".$this->cid_number_prefix."";
|
||||
$dial_string .= ",origination_caller_id_number=".$this->cid_number_prefix."$dial_string_caller_id_number";
|
||||
}
|
||||
else {
|
||||
$dial_string .= ",origination_caller_id_number=$dial_string_caller_id_number";
|
||||
}
|
||||
|
||||
if (strlen($this->accountcode) > 0) {
|
||||
$dial_string .= ",sip_h_X-accountcode=".$this->accountcode;
|
||||
$dial_string .= ",accountcode=".$this->accountcode;
|
||||
}
|
||||
if (strlen($this->accountcode) > 0) {
|
||||
$dial_string .= ",sip_h_X-accountcode=".$this->accountcode;
|
||||
$dial_string .= ",accountcode=".$this->accountcode;
|
||||
}
|
||||
if ($this->toll_allow != '') {
|
||||
$dial_string .= ",toll_allow='".$this->toll_allow."'";
|
||||
$dial_string .= "}";
|
||||
$x = 0;
|
||||
if (is_array($result)) foreach ($result as &$row) {
|
||||
if ($x > 0) {
|
||||
$dial_string .= ",";
|
||||
}
|
||||
$dial_string .= "}";
|
||||
$x = 0;
|
||||
if (is_array($result)) foreach ($result as &$row) {
|
||||
if ($x > 0) {
|
||||
$dial_string .= ",";
|
||||
}
|
||||
if (extension_exists($row["follow_me_destination"])) {
|
||||
//set the dial string
|
||||
if (strlen($_SESSION['domain']['dial_string']['text']) == 0) {
|
||||
$dial_string .= "[";
|
||||
$dial_string .= "outbound_caller_id_number=$dial_string_caller_id_number,";
|
||||
$dial_string .= "presence_id=".$row["follow_me_destination"]."@".$_SESSION['domain_name'].",";
|
||||
if ($row["follow_me_prompt"] == "1") {
|
||||
$dial_string .= "group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true,";
|
||||
}
|
||||
$dial_string .= "leg_delay_start=".$row["follow_me_delay"].",";
|
||||
$dial_string .= "leg_timeout=".$row["follow_me_timeout"]."]";
|
||||
$dial_string .= "\${sofia_contact(".$row["follow_me_destination"]."@".$_SESSION['domain_name'].")}";
|
||||
}
|
||||
if (extension_exists($row["follow_me_destination"])) {
|
||||
//set the dial string
|
||||
if (strlen($_SESSION['domain']['dial_string']['text']) == 0) {
|
||||
$dial_string .= "[";
|
||||
$dial_string .= "outbound_caller_id_number=$dial_string_caller_id_number,";
|
||||
$dial_string .= "presence_id=".$row["follow_me_destination"]."@".$_SESSION['domain_name'].",";
|
||||
if ($row["follow_me_prompt"] == "1") {
|
||||
$dial_string .= "group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true,";
|
||||
}
|
||||
$dial_string .= "leg_delay_start=".$row["follow_me_delay"].",";
|
||||
$dial_string .= "leg_timeout=".$row["follow_me_timeout"]."]";
|
||||
$dial_string .= "\${sofia_contact(".$row["follow_me_destination"]."@".$_SESSION['domain_name'].")}";
|
||||
else {
|
||||
$replace_value = $row["follow_me_destination"];
|
||||
if ($row["follow_me_prompt"] == "1") {
|
||||
$replace_value .= "[group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true]";
|
||||
}
|
||||
$local_dial_string = $_SESSION['domain']['dial_string']['text'];
|
||||
$local_dial_string = str_replace("\${dialed_user}", $replace_value, $local_dial_string);
|
||||
$local_dial_string = str_replace("\${dialed_domain}", $_SESSION['domain_name'], $local_dial_string);
|
||||
$local_dial_string = str_replace("\${call_timeout}", $row["follow_me_timeout"], $local_dial_string);
|
||||
$local_dial_string = str_replace("\${leg_timeout}", $row["follow_me_timeout"], $local_dial_string);
|
||||
$dial_string .= $local_dial_string;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$dial_string .= "[";
|
||||
if ($_SESSION['cdr']['follow_me_fix']['boolean'] == "true"){
|
||||
$dial_string .= "outbound_caller_id_name=".$this->outbound_caller_id_name;
|
||||
$dial_string .= ",outbound_caller_id_number=".$this->outbound_caller_id_number;
|
||||
$dial_string .= ",origination_caller_id_name=".$this->outbound_caller_id_name;
|
||||
$dial_string .= ",origination_caller_id_number=".$this->outbound_caller_id_number;
|
||||
}
|
||||
else{
|
||||
$dial_string .= "outbound_caller_id_number=$dial_string_caller_id_number";
|
||||
}
|
||||
$dial_string .= ",presence_id=".$this->extension."@".$_SESSION['domain_name'];
|
||||
if ($row["follow_me_prompt"] == "1") {
|
||||
$dial_string .= ",group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true,";
|
||||
}
|
||||
$dial_string .= ",leg_delay_start=".$row["follow_me_delay"];
|
||||
$dial_string .= ",leg_timeout=".$row["follow_me_timeout"]."]";
|
||||
if (is_numeric($row["follow_me_destination"])) {
|
||||
if ($_SESSION['domain']['bridge']['text'] == "outbound" || $_SESSION['domain']['bridge']['text'] == "bridge") {
|
||||
$bridge = outbound_route_to_bridge ($_SESSION['domain_uuid'], $row["follow_me_destination"]);
|
||||
$dial_string .= $bridge[0];
|
||||
}
|
||||
elseif ($_SESSION['domain']['bridge']['text'] == "loopback") {
|
||||
$dial_string .= "loopback/".$row["follow_me_destination"]."/".$_SESSION['domain_name'];
|
||||
}
|
||||
elseif ($_SESSION['domain']['bridge']['text'] == "lcr") {
|
||||
$dial_string .= "lcr/".$_SESSION['lcr']['profile']['text']."/".$_SESSION['domain_name']."/".$row["follow_me_destination"];
|
||||
}
|
||||
else {
|
||||
$replace_value = $row["follow_me_destination"];
|
||||
if ($row["follow_me_prompt"] == "1") {
|
||||
$replace_value .= "[group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true]";
|
||||
}
|
||||
$local_dial_string = $_SESSION['domain']['dial_string']['text'];
|
||||
$local_dial_string = str_replace("\${dialed_user}", $replace_value, $local_dial_string);
|
||||
$local_dial_string = str_replace("\${dialed_domain}", $_SESSION['domain_name'], $local_dial_string);
|
||||
$local_dial_string = str_replace("\${call_timeout}", $row["follow_me_timeout"], $local_dial_string);
|
||||
$local_dial_string = str_replace("\${leg_timeout}", $row["follow_me_timeout"], $local_dial_string);
|
||||
$dial_string .= $local_dial_string;
|
||||
$dial_string .= "loopback/".$row["follow_me_destination"]."/".$_SESSION['domain_name'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$dial_string .= "[";
|
||||
if ($_SESSION['cdr']['follow_me_fix']['boolean'] == "true"){
|
||||
$dial_string .= "outbound_caller_id_name=".$this->outbound_caller_id_name;
|
||||
$dial_string .= ",outbound_caller_id_number=".$this->outbound_caller_id_number;
|
||||
$dial_string .= ",origination_caller_id_name=".$this->outbound_caller_id_name;
|
||||
$dial_string .= ",origination_caller_id_number=".$this->outbound_caller_id_number;
|
||||
}
|
||||
else{
|
||||
$dial_string .= "outbound_caller_id_number=$dial_string_caller_id_number";
|
||||
}
|
||||
$dial_string .= ",presence_id=".$this->extension."@".$_SESSION['domain_name'];
|
||||
if ($row["follow_me_prompt"] == "1") {
|
||||
$dial_string .= ",group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true,";
|
||||
}
|
||||
$dial_string .= ",leg_delay_start=".$row["follow_me_delay"];
|
||||
$dial_string .= ",leg_timeout=".$row["follow_me_timeout"]."]";
|
||||
if (is_numeric($row["follow_me_destination"])) {
|
||||
if ($_SESSION['domain']['bridge']['text'] == "outbound" || $_SESSION['domain']['bridge']['text'] == "bridge") {
|
||||
$bridge = outbound_route_to_bridge ($_SESSION['domain_uuid'], $row["follow_me_destination"]);
|
||||
$dial_string .= $bridge[0];
|
||||
}
|
||||
elseif ($_SESSION['domain']['bridge']['text'] == "loopback") {
|
||||
$dial_string .= "loopback/".$row["follow_me_destination"]."/".$_SESSION['domain_name'];
|
||||
}
|
||||
elseif ($_SESSION['domain']['bridge']['text'] == "lcr") {
|
||||
$dial_string .= "lcr/".$_SESSION['lcr']['profile']['text']."/".$_SESSION['domain_name']."/".$row["follow_me_destination"];
|
||||
}
|
||||
else {
|
||||
$dial_string .= "loopback/".$row["follow_me_destination"]."/".$_SESSION['domain_name'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$dial_string .= $row["follow_me_destination"];
|
||||
}
|
||||
$dial_string .= $row["follow_me_destination"];
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
$this->dial_string = $dial_string;
|
||||
$x++;
|
||||
}
|
||||
$this->dial_string = $dial_string;
|
||||
|
||||
$sql = "update v_follow_me set ";
|
||||
$sql .= "dial_string = '".$this->dial_string."' ";
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@
|
|||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "call_prompt";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = "";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = "true";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "dial_string";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
|
|
|
|||
Loading…
Reference in New Issue