diff --git a/README.md b/README.md index 386578b474..6e4104093d 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ It provides the functionality your business needs and brings corporate-level pho In addition to providing all of the usual PBX functionality, FusionPBX allows you to configure: -- Multi-Tenancy +- Multi-Tenant - Unlimited Extensions - Voicemail-to-Email - Music on Hold @@ -25,7 +25,7 @@ We provide several avenues for you to get your system up and running on your own 1. [Current Documentation](http://wiki.fusionpbx.com/index.php?title=Main_Page) 2. [New Documentation](http://fusionpbx-docs.readthedocs.org/en/latest/) COMING SOON 3. [How to Contribute](http://fusionpbx.com) COMING SOON -4. [IRC](http://webchat.freenode.net/) in the fusionpbx channel +4. [IRC](http://webchat.freenode.net/) in the #fusionpbx channel Commercial Support -------------------------------------- diff --git a/app/access_controls/access_control_node_delete.php b/app/access_controls/access_control_node_delete.php index 57e1696d6c..473913808e 100644 --- a/app/access_controls/access_control_node_delete.php +++ b/app/access_controls/access_control_node_delete.php @@ -33,6 +33,6 @@ else { //redirect the user $_SESSION['message'] = $text['message-delete']; - header('Location: access_control_node_edit.php?id='.$access_control_uuid); + header('Location: access_control_edit.php?id='.$access_control_uuid); ?> \ No newline at end of file diff --git a/app/call_block/app_config.php b/app/call_block/app_config.php index ba7e7d220c..d86ffd5cfc 100644 --- a/app/call_block/app_config.php +++ b/app/call_block/app_config.php @@ -25,22 +25,18 @@ $apps[$x]['permissions'][$y]['menu']['uuid'] = "29295c90-b1b9-440b-9c7E-c8363c6e8975"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $apps[$x]['permissions'][$y]['groups'][] = "admin"; - $apps[$x]['permissions'][$y]['groups'][] = "user"; $y++; $apps[$x]['permissions'][$y]['name'] = "call_block_add"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $apps[$x]['permissions'][$y]['groups'][] = "admin"; - $apps[$x]['permissions'][$y]['groups'][] = "user"; $y++; $apps[$x]['permissions'][$y]['name'] = "call_block_edit"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $apps[$x]['permissions'][$y]['groups'][] = "admin"; - $apps[$x]['permissions'][$y]['groups'][] = "user"; $y++; $apps[$x]['permissions'][$y]['name'] = "call_block_delete"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $apps[$x]['permissions'][$y]['groups'][] = "admin"; - $apps[$x]['permissions'][$y]['groups'][] = "user"; $y++; //schema details diff --git a/app/call_block/app_languages.php b/app/call_block/app_languages.php index bf329113ba..42845acfba 100644 --- a/app/call_block/app_languages.php +++ b/app/call_block/app_languages.php @@ -350,6 +350,31 @@ $text['label-busy']['de-at'] = "Besetzt"; $text['label-busy']['ar-eg'] = "مشغول"; $text['label-busy']['he'] = "תפוס"; +$text['label-hold']['en-us'] = "Hold"; +$text['label-hold']['es-cl'] = ""; +$text['label-hold']['pt-pt'] = ""; +$text['label-hold']['fr-fr'] = ""; +$text['label-hold']['nl-nl'] = ""; +$text['label-hold']['pt-br'] = ""; +$text['label-hold']['pl'] = ""; +$text['label-hold']['sv-se'] = ""; +$text['label-hold']['uk'] = ""; +$text['label-hold']['ro'] = ""; +$text['label-hold']['de-at'] = ""; +$text['label-hold']['ar-eg'] = ""; +$text['label-hold']['he'] = ""; + +$text['label-voicemail']['en-us'] = "Voicemail"; +$text['label-voicemail']['es-cl'] = "Correo de Voz"; +$text['label-voicemail']['pt-pt'] = "Correio de Voz"; +$text['label-voicemail']['fr-fr'] = "Messagerie Vocale"; +$text['label-voicemail']['pt-br'] = "Correio de voz"; +$text['label-voicemail']['pl'] = "Poczta głosowa"; +$text['label-voicemail']['sv-se'] = "Röstbrevlåda"; +$text['label-voicemail']['uk'] = "Голосова пошта"; +$text['label-voicemail']['de-at'] = "Mailbox"; +$text['label-voicemail']['he'] = "תא קולי"; + $text['label-add-note']['en-us'] = "Block calls from a number. Either select a number from the list above or enter the number, name and enable below."; $text['label-add-note']['es-cl'] = "Bloquea llamadas desde un número. Puede elegir un número de la lista de arriba o ingresar el nú, nombre y activarlo abajo."; $text['label-add-note']['pt-pt'] = "Bloquear chamadas a partir de um número. Seleccione um número a partir da lista indicada ou introduza um número, nome e active."; diff --git a/app/call_block/app_menu.php b/app/call_block/app_menu.php index fa19b6f530..59da295d0d 100644 --- a/app/call_block/app_menu.php +++ b/app/call_block/app_menu.php @@ -16,8 +16,7 @@ $apps[$x]['menu'][0]['uuid'] = "29295c90-b1b9-440b-9c7E-c8363c6e8975"; $apps[$x]['menu'][0]['parent_uuid'] = "fd29e39c-c936-f5fc-8e2b-611681b266b5"; $apps[$x]['menu'][0]['category'] = "internal"; $apps[$x]['menu'][0]['path'] = "/app/call_block/call_block.php"; -$apps[$x]['menu'][0]['groups'][] = "user"; -$apps[$x]['menu'][0]['groups'][] = "admin"; $apps[$x]['menu'][0]['groups'][] = "superadmin"; +$apps[$x]['menu'][0]['groups'][] = "admin"; ?> \ No newline at end of file diff --git a/app/call_block/call_block_edit.php b/app/call_block/call_block_edit.php index 91e78e0efc..8cae586146 100644 --- a/app/call_block/call_block_edit.php +++ b/app/call_block/call_block_edit.php @@ -44,7 +44,7 @@ else { //define the call_block_get_extensions function function call_block_get_extensions($select_extension) { - global $db; + global $db, $text; //list voicemail $sql = "select extension, user_context, description from v_extensions "; @@ -55,12 +55,12 @@ else { $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC); - echo "\n"; + echo "\n"; foreach ($result as &$row) { $extension = $row["extension"]; $context = $row["user_context"]; $description = $row["description"]; - if ($extension == $select_extension) $selected = "SELECTED"; + if ($extension == $select_extension) $selected = "selected='selected'"; echo " \n"; $selected = ""; } @@ -77,7 +77,7 @@ else { } //get http post variables and set them to php variables - if (count($_POST)>0) { + if (count($_POST) > 0) { $call_block_name = check_str($_POST["call_block_name"]); $call_block_number = check_str($_POST["call_block_number"]); $call_block_action = check_str($_POST["call_block_action"]); @@ -167,7 +167,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $result = $prep_statement->fetchAll(); $result_count = count($result); if ($result_count > 0) { - $call_block_number = $result[0]["call_block_number"]; + //set the domain_name $domain_name = $result[0]["domain_name"]; //clear the cache @@ -298,6 +298,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { else { echo " \n"; } + if ($action == "Hold") { + echo " \n"; + } + else { + echo " \n"; + } call_block_get_extensions($extension); echo " \n"; echo "
\n"; diff --git a/app/call_centers/call_center_agent_delete.php b/app/call_centers/call_center_agent_delete.php index ecbdd74ff6..d7703ec81f 100644 --- a/app/call_centers/call_center_agent_delete.php +++ b/app/call_centers/call_center_agent_delete.php @@ -86,6 +86,7 @@ if (count($_GET)>0) { //synchronize configuration save_call_center_xml(); + remove_config_from_cache('configuration:callcenter.conf'); //redirect the browser $_SESSION["message"] = $text['message-delete']; diff --git a/app/call_centers/call_center_agent_edit.php b/app/call_centers/call_center_agent_edit.php index 5ff7915723..e72dc42c19 100644 --- a/app/call_centers/call_center_agent_edit.php +++ b/app/call_centers/call_center_agent_edit.php @@ -264,6 +264,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //syncrhonize configuration save_call_center_xml(); + remove_config_from_cache('configuration:callcenter.conf'); $_SESSION["message"] = $text['message-add']; header("Location: call_center_agents.php"); @@ -291,7 +292,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { unset($sql); //syncrhonize configuration - save_call_center_xml(); + save_call_center_xml(); + remove_config_from_cache('configuration:callcenter.conf'); $_SESSION["message"] = $text['message-update']; header("Location: call_center_agents.php"); diff --git a/app/call_centers/call_center_queue_delete.php b/app/call_centers/call_center_queue_delete.php index bad7ad96cc..5abb84093f 100644 --- a/app/call_centers/call_center_queue_delete.php +++ b/app/call_centers/call_center_queue_delete.php @@ -87,9 +87,11 @@ if (strlen($id) > 0) { //clear the cache $cache = new cache; $cache->delete("dialplan:".$_SESSION["context"]); + remove_config_from_cache('configuration:callcenter.conf'); //synchronize configuration save_dialplan_xml(); + save_call_center_xml(); //apply settings reminder $_SESSION["reload_xml"] = true; diff --git a/app/call_centers/call_center_queue_edit.php b/app/call_centers/call_center_queue_edit.php index 05f82c1580..e37cf5f245 100644 --- a/app/call_centers/call_center_queue_edit.php +++ b/app/call_centers/call_center_queue_edit.php @@ -257,6 +257,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //syncrhonize the configuration save_call_center_xml(); + remove_config_from_cache('configuration:callcenter.conf'); //delete the dialplan context from memcache $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); @@ -326,6 +327,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //synchronize the configuration save_call_center_xml(); + remove_config_from_cache('configuration:callcenter.conf'); //clear the cache $cache = new cache; @@ -393,6 +395,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //syncrhonize configuration save_call_center_xml(); + remove_config_from_cache('configuration:callcenter.conf'); } //redirect diff --git a/app/call_centers/call_center_tier_edit.php b/app/call_centers/call_center_tier_edit.php index 5f25536092..a8c5d2d4ac 100644 --- a/app/call_centers/call_center_tier_edit.php +++ b/app/call_centers/call_center_tier_edit.php @@ -111,7 +111,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { unset($sql); //syncrhonize configuration - save_call_center_xml(); + save_call_center_xml(); + remove_config_from_cache('configuration:callcenter.conf'); //look up queue uuid by queue name (ugh) $sql = "select call_center_queue_uuid from v_call_center_queues where queue_name = '".$queue_name."'"; diff --git a/app/calls/app_languages.php b/app/calls/app_languages.php index 981ca16dd8..d475fee621 100644 --- a/app/calls/app_languages.php +++ b/app/calls/app_languages.php @@ -101,17 +101,6 @@ $text['label-on-busy']['sv-se'] = "Vid Upptaget "; $text['label-on-busy']['uk'] = "Якщо зайнято"; $text['label-on-busy']['de-at'] = "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'] = ""; -$text['label-ignore-busy']['pl'] = ""; -$text['label-ignore-busy']['sv-se'] = ""; -$text['label-ignore-busy']['uk'] = ""; -$text['label-ignore-busy']['de-at'] = ""; - $text['label-number']['en-us'] = "Number"; $text['label-number']['es-cl'] = "Número"; $text['label-number']['pt-pt'] = "Número"; @@ -133,6 +122,17 @@ $text['label-no_answer']['sv-se'] = "Inget Svar "; $text['label-no_answer']['uk'] = "Без відповіді"; $text['label-no_answer']['de-at'] = "Keine Antwort"; +$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'] = ""; +$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"; $text['label-follow-me']['pt-pt'] = "Segue-me"; @@ -141,7 +141,7 @@ $text['label-follow-me']['pt-br'] = "Siga-me"; $text['label-follow-me']['pl'] = "Podążaj za mną"; $text['label-follow-me']['sv-se'] = "Följ Mig "; $text['label-follow-me']['uk'] = ""; -$text['label-follow-me']['de-at'] = "Follow Me"; +$text['label-follow-me']['de-at'] = "Anrufweiterschaltung"; $text['label-enabled']['en-us'] = "Enabled"; $text['label-enabled']['es-cl'] = "Activo"; @@ -311,7 +311,7 @@ $text['label-call-forward']['pt-br'] = "Encaminhamento de chamadas"; $text['label-call-forward']['pl'] = "Przekierowanie"; $text['label-call-forward']['sv-se'] = "Vidarekoppling "; $text['label-call-forward']['uk'] = "Переадресація"; -$text['label-call-forward']['de-at'] = "Ruf Weiterleitung"; +$text['label-call-forward']['de-at'] = "Rufumleitung"; $text['description-on-busy']['en-us'] = "If enabled, it overrides the value of voicemail enabling in extension."; $text['description-on-busy']['es-cl'] = "Si está habilitada, anula el valor del correo de voz que permite en la extensión."; @@ -383,7 +383,7 @@ $text['description-2']['pt-br'] = "A informação contem a origem, destino, dura $text['description-2']['pl'] = "Za pomocą poniższych linków można skonfigurować przekierowania, usługę „Podążaj z mną” lub „Nie przeszkadzać” (DnD)."; $text['description-2']['sv-se'] = "Använd länkarna för att konfigurera Vidarekoppling, Följ Mig och Stör Ej. "; $text['description-2']['uk'] = ""; -$text['description-2']['de-at'] = "Benutzen Sie die Funktionen um Weiterleitung, Follow Me oder Bitte nicht stören zu konfigurieren."; +$text['description-2']['de-at'] = "Benutzen Sie die Funktionen um Rufumleitung, Anrufweiterschaltung oder Nicht stören zu konfigurieren."; $text['description']['en-us'] = "Directs incoming calls for extension:"; $text['description']['es-cl'] = "Dirige las llamadas entrantes hacia una extensión:"; diff --git a/app/calls/call_edit.php b/app/calls/call_edit.php index b9b149b954..2834914f0c 100644 --- a/app/calls/call_edit.php +++ b/app/calls/call_edit.php @@ -63,7 +63,7 @@ else { $sql = "select * from v_extensions "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and extension_uuid = '$extension_uuid' "; - if (!(if_group("admin") || if_group("superadmin"))) { + if (!(permission_exists('follow_me') || permission_exists('call_forward') || permission_exists('do_not_disturb'))) { if (count($_SESSION['user']['extension']) > 0) { $sql .= "and ("; $x = 0; @@ -536,7 +536,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if (permission_exists('follow_me_cid_set')) { echo "   "; - $sql_forward = "select destination_uuid, destination_number, destination_description from v_destinations where domain_uuid = '$domain_uuid' and destination_type = 'inbound' order by destination_number asc "; + $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); @@ -546,7 +546,15 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo " \n"; foreach ($result_forward as &$row_forward) { $selected = $row_forward["destination_uuid"] == $forward_caller_id_uuid ? "selected='selected' " : ''; - echo "\n"; + $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 "\n"; } echo "\n"; } @@ -603,7 +611,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if (permission_exists('follow_me_cid_set')) { echo "   "; - $sql_follow_me = "select destination_uuid, destination_number, destination_description from v_destinations where domain_uuid = '$domain_uuid' and destination_type = 'inbound' order by destination_number asc "; + $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); @@ -613,7 +621,17 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo " \n"; foreach ($result_follow_me as &$row_follow_me) { $selected = $row_follow_me["destination_uuid"] == $follow_me_caller_id_uuid ? "selected='selected'" : ''; - echo "\n"; + + $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 "\n"; } echo "\n"; } @@ -749,11 +767,11 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo $text['label-ignore-busy']; echo " \n"; echo " \n"; - echo " \n"; - echo "
Interrupt call if one of destination are busy\n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo $text['description-ignore-busy']." \n"; + //echo "
Interrupt call if one of destination are busy\n"; echo " \n"; echo " \n"; diff --git a/app/calls/resources/classes/call_forward.php b/app/calls/resources/classes/call_forward.php index 74688572ed..2886856180 100644 --- a/app/calls/resources/classes/call_forward.php +++ b/app/calls/resources/classes/call_forward.php @@ -84,17 +84,27 @@ include "root.php"; } if (strlen($this->forward_caller_id_uuid) > 0){ - $sql_caller = "select destination_number, destination_description from v_destinations where domain_uuid = '$this->domain_uuid' and destination_type = 'inbound' and destination_uuid = '$this->forward_caller_id_uuid'"; + $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->forward_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); - if (strlen($row_caller['destination_description']) > 0) { - $dial_string_caller_id_name = $row_caller['destination_description']; + + $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; $dial_string .= ",origination_caller_id_name=$dial_string_caller_id_name"; } - if (strlen($row_caller['destination_number']) > 0) { - $dial_string_caller_id_number = $row_caller['destination_number']; + if (strlen($caller_id_number) > 0) { + $dial_string_caller_id_number = $caller_id_number; $dial_string .= ",origination_caller_id_number=$dial_string_caller_id_number"; $dial_string .= ",outbound_caller_id_number=$dial_string_caller_id_number"; } @@ -136,15 +146,17 @@ include "root.php"; //update the extension $sql = "update v_extensions set "; + if (strlen($this->forward_all_destination) == 0) { + $sql .= "forward_all_destination = null, "; + } + else { + $sql .= "forward_all_destination = '$this->forward_all_destination', "; + } if (strlen($this->forward_all_destination) == 0 || $this->forward_all_enabled == "false") { - if (strlen($this->forward_all_destination) == 0) { - $sql .= "forward_all_destination = null, "; - } $sql .= "dial_string = null, "; $sql .= "forward_all_enabled = 'false' "; } else { - $sql .= "forward_all_destination = '$this->forward_all_destination', "; $sql .= "dial_string = '".check_str($this->dial_string)."', "; $sql .= "forward_all_enabled = 'true' "; } diff --git a/app/calls/resources/classes/do_not_disturb.php b/app/calls/resources/classes/do_not_disturb.php index 37fcef5e29..0b675867d8 100644 --- a/app/calls/resources/classes/do_not_disturb.php +++ b/app/calls/resources/classes/do_not_disturb.php @@ -96,7 +96,7 @@ include "root.php"; //set the dial string if ($this->enabled == "true") { - $this->dial_string = "loopback/*99".$this->extension; + $this->dial_string = "error/user_busy"; } else { $this->dial_string = ''; diff --git a/app/calls/resources/classes/follow_me.php b/app/calls/resources/classes/follow_me.php index 8aeb0f80cc..5cdf86d74e 100644 --- a/app/calls/resources/classes/follow_me.php +++ b/app/calls/resources/classes/follow_me.php @@ -299,16 +299,26 @@ include "root.php"; $dial_string_caller_id_number = "\${caller_id_number}"; if (strlen($this->follow_me_caller_id_uuid) > 0){ - $sql_caller = "select destination_number, destination_description from v_destinations where domain_uuid = '$this->domain_uuid' and destination_type = 'inbound' and destination_uuid = '$this->follow_me_caller_id_uuid'"; + $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); - if (strlen($row_caller['destination_description']) > 0) { - $dial_string_caller_id_name = $row_caller['destination_description']; + + $caller_id_number = $row_caller['destination_caller_id_number']; + if(strlen($caller_id_number) == 0){ + $caller_id_number = $row_caller['destination_number']; } - if (strlen($row_caller['destination_number']) > 0) { - $dial_string_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; } } } diff --git a/app/conference_centers/app_config.php b/app/conference_centers/app_config.php index bd9078f5f6..464bc6fd51 100644 --- a/app/conference_centers/app_config.php +++ b/app/conference_centers/app_config.php @@ -418,43 +418,4 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "end_epoch"; $z++; - /* - $y = 4; //table array index - $z = 0; //field array index - $apps[$x]['db'][$y]['table'] = "v_conference_center_users"; - $apps[$x]['db'][$y]['fields'][$z]['name'] = "conference_user_uuid"; - $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid"; - $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; - $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; - $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "primary"; - $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; - $z++; - $apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_uuid"; - $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid"; - $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; - $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; - $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign"; - $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_domains"; - $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "domain_uuid"; - $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; - $z++; - $apps[$x]['db'][$y]['fields'][$z]['name'] = "conference_center_uuid"; - $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid"; - $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; - $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; - $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign"; - $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_conference_centers"; - $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "conference_uuid"; - $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; - $z++; - $apps[$x]['db'][$y]['fields'][$z]['name'] = "user_uuid"; - $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid"; - $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; - $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; - $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign"; - $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_users"; - $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "user_uuid"; - $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; - */ - ?> \ No newline at end of file diff --git a/app/conference_centers/conference_center_edit.php b/app/conference_centers/conference_center_edit.php index 296d504631..0c50504f45 100644 --- a/app/conference_centers/conference_center_edit.php +++ b/app/conference_centers/conference_center_edit.php @@ -62,218 +62,169 @@ else { $conference_center_name = str_replace(" ", "-", $conference_center_name); } -/* -//delete the user from the v_conference_center_users - if ($_GET["a"] == "delete" && permission_exists("conference_center_delete")) { - //set the variables - $user_uuid = check_str($_REQUEST["user_uuid"]); - $conference_center_uuid = check_str($_REQUEST["id"]); - //delete the group from the users - $sql = "delete from v_conference_center_users "; - $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and conference_center_uuid = '".$conference_center_uuid."' "; - $sql .= "and user_uuid = '".$user_uuid."' "; - $db->exec(check_sql($sql)); - //redirect the browser - require_once "resources/header.php"; - echo "\n"; - echo "
Delete Complete
"; - require_once "resources/footer.php"; - return; - } +//process user data + if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { -//add the user to the v_conference_center_users - if (strlen($_REQUEST["user_uuid"]) > 0 && strlen($_REQUEST["id"]) > 0 && $_GET["a"] != "delete") { - //set the variables - $user_uuid = check_str($_REQUEST["user_uuid"]); - $conference_center_uuid = check_str($_REQUEST["id"]); - //assign the user to the extension - $sql_insert = "insert into v_conference_center_users "; - $sql_insert .= "("; - $sql_insert .= "conference_user_uuid, "; - $sql_insert .= "domain_uuid, "; - $sql_insert .= "conference_center_uuid, "; - $sql_insert .= "user_uuid "; - $sql_insert .= ")"; - $sql_insert .= "values "; - $sql_insert .= "("; - $sql_insert .= "'".uuid()."', "; - $sql_insert .= "'".$_SESSION['domain_uuid']."', "; - $sql_insert .= "'".$conference_center_uuid."', "; - $sql_insert .= "'".$user_uuid."' "; - $sql_insert .= ")"; - $db->exec($sql_insert); - //redirect the browser - require_once "resources/header.php"; - echo "\n"; - echo "
Add Complete
"; - require_once "resources/footer.php"; - return; - } -*/ - -if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { - - $msg = ''; - if ($action == "update") { - $conference_center_uuid = check_str($_POST["conference_center_uuid"]); - } - - //check for all required data - //if (strlen($dialplan_uuid) == 0) { $msg .= "Please provide: Dialplan UUID
\n"; } - if (strlen($conference_center_name) == 0) { $msg .= "Please provide: Name
\n"; } - if (strlen($conference_center_extension) == 0) { $msg .= "Please provide: Extension
\n"; } - if (strlen($conference_center_pin_length) == 0) { $msg .= "Please provide: PIN Length
\n"; } - //if (strlen($conference_center_order) == 0) { $msg .= "Please provide: Order
\n"; } - //if (strlen($conference_center_description) == 0) { $msg .= "Please provide: Description
\n"; } - if (strlen($conference_center_enabled) == 0) { $msg .= "Please provide: Enabled
\n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { - require_once "resources/header.php"; - require_once "resources/persist_form_var.php"; - echo "
\n"; - echo "
\n"; - echo $msg."
"; - echo "
\n"; - persistformvar($_POST); - echo "
\n"; - require_once "resources/footer.php"; - return; + $msg = ''; + if ($action == "update") { + $conference_center_uuid = check_str($_POST["conference_center_uuid"]); } - //add or update the database - if ($_POST["persistformvar"] != "true") { - if ($action == "add") { - //prepare the uuids - $conference_center_uuid = uuid(); - $dialplan_uuid = uuid(); - //add the conference - $sql = "insert into v_conference_centers "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "conference_center_uuid, "; - $sql .= "dialplan_uuid, "; - $sql .= "conference_center_name, "; - $sql .= "conference_center_extension, "; - $sql .= "conference_center_pin_length, "; - $sql .= "conference_center_greeting, "; - $sql .= "conference_center_description, "; - $sql .= "conference_center_enabled "; - $sql .= ")"; - $sql .= "values "; - $sql .= "("; - $sql .= "'$domain_uuid', "; - $sql .= "'$conference_center_uuid', "; - $sql .= "'$dialplan_uuid', "; - $sql .= "'$conference_center_name', "; - $sql .= "'$conference_center_extension', "; - $sql .= "'$conference_center_pin_length', "; - $sql .= "'$conference_center_greeting', "; - $sql .= "'$conference_center_description', "; - $sql .= "'$conference_center_enabled' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); - - //create the dialplan entry - $dialplan_name = $conference_center_name; - $dialplan_order ='333'; - $dialplan_context = $_SESSION['context']; - $dialplan_enabled = 'true'; - $dialplan_description = $conference_center_description; - $app_uuid = 'b81412e8-7253-91f4-e48e-42fc2c9a38d9'; - dialplan_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_name, $dialplan_order, $dialplan_context, $dialplan_enabled, $dialplan_description, $app_uuid); - - // - $dialplan_detail_tag = 'condition'; //condition, action, antiaction - $dialplan_detail_type = 'destination_number'; - $dialplan_detail_data = '^'.$conference_center_extension.'$'; - $dialplan_detail_order = '010'; - $dialplan_detail_group = '2'; - dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); - - // - $dialplan_detail_tag = 'action'; //condition, action, antiaction - $dialplan_detail_type = 'lua'; - $dialplan_detail_data = 'app.lua conference_center'; - $dialplan_detail_order = '020'; - $dialplan_detail_group = '2'; - dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); - - //save the xml - save_dialplan_xml(); - - $_SESSION["message"] = $text['message-add']; - header("Location: conference_centers.php"); + //check for all required data + //if (strlen($dialplan_uuid) == 0) { $msg .= "Please provide: Dialplan UUID
\n"; } + if (strlen($conference_center_name) == 0) { $msg .= "Please provide: Name
\n"; } + if (strlen($conference_center_extension) == 0) { $msg .= "Please provide: Extension
\n"; } + if (strlen($conference_center_pin_length) == 0) { $msg .= "Please provide: PIN Length
\n"; } + //if (strlen($conference_center_order) == 0) { $msg .= "Please provide: Order
\n"; } + //if (strlen($conference_center_description) == 0) { $msg .= "Please provide: Description
\n"; } + if (strlen($conference_center_enabled) == 0) { $msg .= "Please provide: Enabled
\n"; } + if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + require_once "resources/header.php"; + require_once "resources/persist_form_var.php"; + echo "
\n"; + echo "
\n"; + echo $msg."
"; + echo "
\n"; + persistformvar($_POST); + echo "
\n"; + require_once "resources/footer.php"; return; - } //if ($action == "add") + } - if ($action == "update") { - //update the conference center extension - $sql = "update v_conference_centers set "; - $sql .= "conference_center_name = '$conference_center_name', "; - $sql .= "conference_center_extension = '$conference_center_extension', "; - $sql .= "conference_center_pin_length = '$conference_center_pin_length', "; - $sql .= "conference_center_greeting = '$conference_center_greeting', "; - $sql .= "conference_center_description = '$conference_center_description', "; - $sql .= "conference_center_enabled = '$conference_center_enabled' "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and conference_center_uuid = '$conference_center_uuid'"; - $db->exec(check_sql($sql)); - unset($sql); + //add or update the database + if ($_POST["persistformvar"] != "true") { + if ($action == "add") { + //prepare the uuids + $conference_center_uuid = uuid(); + $dialplan_uuid = uuid(); + //add the conference + $sql = "insert into v_conference_centers "; + $sql .= "("; + $sql .= "domain_uuid, "; + $sql .= "conference_center_uuid, "; + $sql .= "dialplan_uuid, "; + $sql .= "conference_center_name, "; + $sql .= "conference_center_extension, "; + $sql .= "conference_center_pin_length, "; + $sql .= "conference_center_greeting, "; + $sql .= "conference_center_description, "; + $sql .= "conference_center_enabled "; + $sql .= ")"; + $sql .= "values "; + $sql .= "("; + $sql .= "'$domain_uuid', "; + $sql .= "'$conference_center_uuid', "; + $sql .= "'$dialplan_uuid', "; + $sql .= "'$conference_center_name', "; + $sql .= "'$conference_center_extension', "; + $sql .= "'$conference_center_pin_length', "; + $sql .= "'$conference_center_greeting', "; + $sql .= "'$conference_center_description', "; + $sql .= "'$conference_center_enabled' "; + $sql .= ")"; + $db->exec(check_sql($sql)); + unset($sql); - //udpate the conference center dialplan - $sql = "update v_dialplans set "; - $sql .= "dialplan_name = '$conference_center_name', "; - if (strlen($dialplan_order) > 0) { - $sql .= "dialplan_order = '333', "; - } - $sql .= "dialplan_context = '".$_SESSION['context']."', "; - $sql .= "dialplan_enabled = 'true', "; - $sql .= "dialplan_description = '$conference_center_description' "; - $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and dialplan_uuid = '$dialplan_uuid' "; - $db->query($sql); - unset($sql); + //create the dialplan entry + $dialplan_name = $conference_center_name; + $dialplan_order ='333'; + $dialplan_context = $_SESSION['context']; + $dialplan_enabled = 'true'; + $dialplan_description = $conference_center_description; + $app_uuid = 'b81412e8-7253-91f4-e48e-42fc2c9a38d9'; + dialplan_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_name, $dialplan_order, $dialplan_context, $dialplan_enabled, $dialplan_description, $app_uuid); - //update dialplan detail condition - $sql = "update v_dialplan_details set "; - $sql .= "dialplan_detail_data = '^".$conference_center_extension."$' "; - $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and dialplan_detail_tag = 'condition' "; - $sql .= "and dialplan_detail_type = 'destination_number' "; - $sql .= "and dialplan_uuid = '$dialplan_uuid' "; - $db->query($sql); - unset($sql); + // + $dialplan_detail_tag = 'condition'; //condition, action, antiaction + $dialplan_detail_type = 'destination_number'; + $dialplan_detail_data = '^'.$conference_center_extension.'$'; + $dialplan_detail_order = '010'; + $dialplan_detail_group = '2'; + dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); - //update dialplan detail action - $dialplan_detail_type = 'lua'; - $dialplan_detail_data = 'app.lua conference_center'; - $sql = "update v_dialplan_details set "; - $sql .= "dialplan_detail_type = '".$dialplan_detail_type."', "; - $sql .= "dialplan_detail_data = '".$dialplan_detail_data."' "; - $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and dialplan_detail_tag = 'action' "; - $sql .= "and dialplan_detail_type = 'lua' "; - $sql .= "and dialplan_uuid = '$dialplan_uuid' "; - $db->query($sql); + // + $dialplan_detail_tag = 'action'; //condition, action, antiaction + $dialplan_detail_type = 'lua'; + $dialplan_detail_data = 'app.lua conference_center'; + $dialplan_detail_order = '020'; + $dialplan_detail_group = '2'; + dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); - //syncrhonize configuration - save_dialplan_xml(); + //save the xml + save_dialplan_xml(); - //apply settings reminder - $_SESSION["reload_xml"] = true; - - //clear the cache - $cache = new cache; - $cache->delete("dialplan:".$_SESSION["context"]); - - //redirect the browser - $_SESSION["message"] = $text['message-update']; + $_SESSION["message"] = $text['message-add']; header("Location: conference_centers.php"); return; - } //if ($action == "update") - } //if ($_POST["persistformvar"] != "true") -} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) + } //if ($action == "add") + + if ($action == "update") { + //update the conference center extension + $sql = "update v_conference_centers set "; + $sql .= "conference_center_name = '$conference_center_name', "; + $sql .= "conference_center_extension = '$conference_center_extension', "; + $sql .= "conference_center_pin_length = '$conference_center_pin_length', "; + $sql .= "conference_center_greeting = '$conference_center_greeting', "; + $sql .= "conference_center_description = '$conference_center_description', "; + $sql .= "conference_center_enabled = '$conference_center_enabled' "; + $sql .= "where domain_uuid = '$domain_uuid' "; + $sql .= "and conference_center_uuid = '$conference_center_uuid'"; + $db->exec(check_sql($sql)); + unset($sql); + + //udpate the conference center dialplan + $sql = "update v_dialplans set "; + $sql .= "dialplan_name = '$conference_center_name', "; + if (strlen($dialplan_order) > 0) { + $sql .= "dialplan_order = '333', "; + } + $sql .= "dialplan_context = '".$_SESSION['context']."', "; + $sql .= "dialplan_enabled = 'true', "; + $sql .= "dialplan_description = '$conference_center_description' "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and dialplan_uuid = '$dialplan_uuid' "; + $db->query($sql); + unset($sql); + + //update dialplan detail condition + $sql = "update v_dialplan_details set "; + $sql .= "dialplan_detail_data = '^".$conference_center_extension."$' "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and dialplan_detail_tag = 'condition' "; + $sql .= "and dialplan_detail_type = 'destination_number' "; + $sql .= "and dialplan_uuid = '$dialplan_uuid' "; + $db->query($sql); + unset($sql); + + //update dialplan detail action + $dialplan_detail_type = 'lua'; + $dialplan_detail_data = 'app.lua conference_center'; + $sql = "update v_dialplan_details set "; + $sql .= "dialplan_detail_type = '".$dialplan_detail_type."', "; + $sql .= "dialplan_detail_data = '".$dialplan_detail_data."' "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and dialplan_detail_tag = 'action' "; + $sql .= "and dialplan_detail_type = 'lua' "; + $sql .= "and dialplan_uuid = '$dialplan_uuid' "; + $db->query($sql); + + //syncrhonize configuration + save_dialplan_xml(); + + //apply settings reminder + $_SESSION["reload_xml"] = true; + + //clear the cache + $cache = new cache; + $cache->delete("dialplan:".$_SESSION["context"]); + + //redirect the browser + $_SESSION["message"] = $text['message-update']; + header("Location: conference_centers.php"); + return; + } //if ($action == "update") + } //if ($_POST["persistformvar"] != "true") + } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) //function to show the list of sound files // moved to functions.php diff --git a/app/contacts/contact_address_edit.php b/app/contacts/contact_address_edit.php index c0b679289e..ef67242594 100644 --- a/app/contacts/contact_address_edit.php +++ b/app/contacts/contact_address_edit.php @@ -48,9 +48,10 @@ else { $action = "add"; } -if (strlen($_GET["contact_uuid"]) > 0) { - $contact_uuid = check_str($_GET["contact_uuid"]); -} +//get the contact uuid + if (strlen($_GET["contact_uuid"]) > 0) { + $contact_uuid = check_str($_GET["contact_uuid"]); + } //get http post variables and set them to php variables if (count($_POST)>0) { @@ -73,114 +74,125 @@ if (strlen($_GET["contact_uuid"]) > 0) { $address_label = ($address_label_custom != '') ? $address_label_custom : $address_label; } -if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { +//process the form data + if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { - $msg = ''; - if ($action == "update") { - $contact_address_uuid = check_str($_POST["contact_address_uuid"]); - } + //set the uuid + if ($action == "update") { + $contact_address_uuid = check_str($_POST["contact_address_uuid"]); + } - //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 "
\n"; - echo "
\n"; - echo $msg."
"; - echo "
\n"; - persistformvar($_POST); - echo "
\n"; - require_once "resources/footer.php"; - return; - } + //check for all required data + $msg = ''; + if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + require_once "resources/header.php"; + require_once "resources/persist_form_var.php"; + echo "
\n"; + echo "
\n"; + echo $msg."
"; + echo "
\n"; + persistformvar($_POST); + echo "
\n"; + require_once "resources/footer.php"; + return; + } - //add or update the database - if ($_POST["persistformvar"] != "true") { + //add or update the database + if ($_POST["persistformvar"] != "true") { - //if primary, unmark other primary numbers - if ($address_primary) { - $sql = "update v_contact_addresses set address_primary = 0 "; - $sql .= "where domain_uuid = '".$domain_uuid."' "; - $sql .= "and contact_uuid = '".$contact_uuid."' "; - $db->exec(check_sql($sql)); - unset($sql); - } + //update last modified + $sql = "update v_contacts set "; + $sql .= "last_mod_date = now(), "; + $sql .= "last_mod_user = '".$_SESSION['username']."' "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; + $db->exec(check_sql($sql)); + unset($sql); - if ($action == "add") { - $contact_address_uuid = uuid(); - $sql = "insert into v_contact_addresses "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "contact_uuid, "; - $sql .= "contact_address_uuid, "; - $sql .= "address_type, "; - $sql .= "address_label, "; - $sql .= "address_street, "; - $sql .= "address_extended, "; - $sql .= "address_community, "; - $sql .= "address_locality, "; - $sql .= "address_region, "; - $sql .= "address_postal_code, "; - $sql .= "address_country, "; - $sql .= "address_latitude, "; - $sql .= "address_longitude, "; - $sql .= "address_primary, "; - $sql .= "address_description "; - $sql .= ")"; - $sql .= "values "; - $sql .= "("; - $sql .= "'".$_SESSION['domain_uuid']."', "; - $sql .= "'".$contact_uuid."', "; - $sql .= "'".$contact_address_uuid."', "; - $sql .= "'".$address_type."', "; - $sql .= "'".$address_label."', "; - $sql .= "'".$address_street."', "; - $sql .= "'".$address_extended."', "; - $sql .= "'".$address_community."', "; - $sql .= "'".$address_locality."', "; - $sql .= "'".$address_region."', "; - $sql .= "'".$address_postal_code."', "; - $sql .= "'".$address_country."', "; - $sql .= "'".$address_latitude."', "; - $sql .= "'".$address_longitude."', "; - $sql .= (($address_primary) ? 1 : 0).", "; - $sql .= "'".$address_description."' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); + //if primary, unmark other primary numbers + if ($address_primary) { + $sql = "update v_contact_addresses set address_primary = 0 "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; + $db->exec(check_sql($sql)); + unset($sql); + } - $_SESSION["message"] = $text['message-add']; - header("Location: contact_edit.php?id=".$contact_uuid); - return; - } //if ($action == "add") + if ($action == "add") { + $contact_address_uuid = uuid(); + $sql = "insert into v_contact_addresses "; + $sql .= "("; + $sql .= "domain_uuid, "; + $sql .= "contact_uuid, "; + $sql .= "contact_address_uuid, "; + $sql .= "address_type, "; + $sql .= "address_label, "; + $sql .= "address_street, "; + $sql .= "address_extended, "; + $sql .= "address_community, "; + $sql .= "address_locality, "; + $sql .= "address_region, "; + $sql .= "address_postal_code, "; + $sql .= "address_country, "; + $sql .= "address_latitude, "; + $sql .= "address_longitude, "; + $sql .= "address_primary, "; + $sql .= "address_description "; + $sql .= ")"; + $sql .= "values "; + $sql .= "("; + $sql .= "'".$_SESSION['domain_uuid']."', "; + $sql .= "'".$contact_uuid."', "; + $sql .= "'".$contact_address_uuid."', "; + $sql .= "'".$address_type."', "; + $sql .= "'".$address_label."', "; + $sql .= "'".$address_street."', "; + $sql .= "'".$address_extended."', "; + $sql .= "'".$address_community."', "; + $sql .= "'".$address_locality."', "; + $sql .= "'".$address_region."', "; + $sql .= "'".$address_postal_code."', "; + $sql .= "'".$address_country."', "; + $sql .= "'".$address_latitude."', "; + $sql .= "'".$address_longitude."', "; + $sql .= (($address_primary) ? 1 : 0).", "; + $sql .= "'".$address_description."' "; + $sql .= ")"; + $db->exec(check_sql($sql)); + unset($sql); - if ($action == "update") { - $sql = "update v_contact_addresses set "; - $sql .= "contact_uuid = '".$contact_uuid."', "; - $sql .= "address_type = '".$address_type."', "; - $sql .= "address_label = '".$address_label."', "; - $sql .= "address_street = '".$address_street."', "; - $sql .= "address_extended = '".$address_extended."', "; - $sql .= "address_community = '".$address_community."', "; - $sql .= "address_locality = '".$address_locality."', "; - $sql .= "address_region = '".$address_region."', "; - $sql .= "address_postal_code = '".$address_postal_code."', "; - $sql .= "address_country = '".$address_country."', "; - $sql .= "address_latitude = '".$address_latitude."', "; - $sql .= "address_longitude = '".$address_longitude."', "; - $sql .= "address_primary = ".(($address_primary) ? 1 : 0).", "; - $sql .= "address_description = '".$address_description."' "; - $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and contact_address_uuid = '".$contact_address_uuid."'"; - $db->exec(check_sql($sql)); - unset($sql); + $_SESSION["message"] = $text['message-add']; + header("Location: contact_edit.php?id=".$contact_uuid); + return; + } //if ($action == "add") - $_SESSION["message"] = $text['message-update']; - header("Location: contact_edit.php?id=".$contact_uuid); - return; - } //if ($action == "update") - } //if ($_POST["persistformvar"] != "true") -} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) + if ($action == "update") { + $sql = "update v_contact_addresses set "; + $sql .= "contact_uuid = '".$contact_uuid."', "; + $sql .= "address_type = '".$address_type."', "; + $sql .= "address_label = '".$address_label."', "; + $sql .= "address_street = '".$address_street."', "; + $sql .= "address_extended = '".$address_extended."', "; + $sql .= "address_community = '".$address_community."', "; + $sql .= "address_locality = '".$address_locality."', "; + $sql .= "address_region = '".$address_region."', "; + $sql .= "address_postal_code = '".$address_postal_code."', "; + $sql .= "address_country = '".$address_country."', "; + $sql .= "address_latitude = '".$address_latitude."', "; + $sql .= "address_longitude = '".$address_longitude."', "; + $sql .= "address_primary = ".(($address_primary) ? 1 : 0).", "; + $sql .= "address_description = '".$address_description."' "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and contact_address_uuid = '".$contact_address_uuid."'"; + $db->exec(check_sql($sql)); + unset($sql); + + $_SESSION["message"] = $text['message-update']; + header("Location: contact_edit.php?id=".$contact_uuid); + return; + } //if ($action == "update") + } //if ($_POST["persistformvar"] != "true") + } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) //pre-populate the form if (count($_GET)>0 && $_POST["persistformvar"] != "true") { diff --git a/app/contacts/contact_edit.php b/app/contacts/contact_edit.php index 1021c2d4f8..ad313bc68d 100644 --- a/app/contacts/contact_edit.php +++ b/app/contacts/contact_edit.php @@ -79,171 +79,182 @@ else { $contact_note = check_str($_POST["contact_note"]); } -if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { +//process the form data + if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { - $msg = ''; - if ($action == "update") { - $contact_uuid = check_str($_POST["contact_uuid"]); - } + //set the uuid + if ($action == "update") { + $contact_uuid = check_str($_POST["contact_uuid"]); + } - //check for all required data - //if (strlen($contact_type) == 0) { $msg .= $text['message-required'].$text['label-contact_type']."
\n"; } - //if (strlen($contact_organization) == 0) { $msg .= $text['message-required'].$text['label-contact_organization']."
\n"; } - //if (strlen($contact_name_prefix) == 0) { $msg .= $text['message-required'].$text['label-contact_name_prefix']."
\n"; } - //if (strlen($contact_name_given) == 0) { $msg .= $text['message-required'].$text['label-contact_name_given']."
\n"; } - //if (strlen($contact_name_middle) == 0) { $msg .= $text['message-required'].$text['label-contact_name_middle']."
\n"; } - //if (strlen($contact_name_family) == 0) { $msg .= $text['message-required'].$text['label-contact_name_family']."
\n"; } - //if (strlen($contact_name_suffix) == 0) { $msg .= $text['message-required'].$text['label-contact_name_suffix']."
\n"; } - //if (strlen($contact_nickname) == 0) { $msg .= $text['message-required'].$text['label-contact_nickname']."
\n"; } - //if (strlen($contact_title) == 0) { $msg .= $text['message-required'].$text['label-contact_title']."
\n"; } - //if (strlen($contact_role) == 0) { $msg .= $text['message-required'].$text['label-contact_role']."
\n"; } - //if (strlen($contact_time_zone) == 0) { $msg .= $text['message-required'].$text['label-contact_time_zone']."
\n"; } - //if (strlen($contact_note) == 0) { $msg .= $text['message-required'].$text['label-contact_note']."
\n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { - require_once "resources/header.php"; - require_once "resources/persist_form_var.php"; - echo "
\n"; - echo "
\n"; - echo $msg."
"; - echo "
\n"; - persistformvar($_POST); - echo "
\n"; - require_once "resources/footer.php"; - return; - } + //check for all required data + $msg = ''; + //if (strlen($contact_type) == 0) { $msg .= $text['message-required'].$text['label-contact_type']."
\n"; } + //if (strlen($contact_organization) == 0) { $msg .= $text['message-required'].$text['label-contact_organization']."
\n"; } + //if (strlen($contact_name_prefix) == 0) { $msg .= $text['message-required'].$text['label-contact_name_prefix']."
\n"; } + //if (strlen($contact_name_given) == 0) { $msg .= $text['message-required'].$text['label-contact_name_given']."
\n"; } + //if (strlen($contact_name_middle) == 0) { $msg .= $text['message-required'].$text['label-contact_name_middle']."
\n"; } + //if (strlen($contact_name_family) == 0) { $msg .= $text['message-required'].$text['label-contact_name_family']."
\n"; } + //if (strlen($contact_name_suffix) == 0) { $msg .= $text['message-required'].$text['label-contact_name_suffix']."
\n"; } + //if (strlen($contact_nickname) == 0) { $msg .= $text['message-required'].$text['label-contact_nickname']."
\n"; } + //if (strlen($contact_title) == 0) { $msg .= $text['message-required'].$text['label-contact_title']."
\n"; } + //if (strlen($contact_role) == 0) { $msg .= $text['message-required'].$text['label-contact_role']."
\n"; } + //if (strlen($contact_time_zone) == 0) { $msg .= $text['message-required'].$text['label-contact_time_zone']."
\n"; } + //if (strlen($contact_note) == 0) { $msg .= $text['message-required'].$text['label-contact_note']."
\n"; } + if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + require_once "resources/header.php"; + require_once "resources/persist_form_var.php"; + echo "
\n"; + echo "
\n"; + echo $msg."
"; + echo "
\n"; + persistformvar($_POST); + echo "
\n"; + require_once "resources/footer.php"; + return; + } - //add or update the database - if ($_POST["persistformvar"] != "true") { + //add or update the database + if ($_POST["persistformvar"] != "true") { - if ($action == "add") { - $contact_uuid = uuid(); - $sql = "insert into v_contacts "; - $sql .= "( "; - $sql .= "domain_uuid, "; - $sql .= "contact_uuid, "; - $sql .= "contact_type, "; - $sql .= "contact_organization, "; - $sql .= "contact_name_prefix, "; - $sql .= "contact_name_given, "; - $sql .= "contact_name_middle, "; - $sql .= "contact_name_family, "; - $sql .= "contact_name_suffix, "; - $sql .= "contact_nickname, "; - $sql .= "contact_title, "; - $sql .= "contact_category, "; - $sql .= "contact_role, "; - $sql .= "contact_time_zone, "; - $sql .= "contact_note, "; - $sql .= "last_mod_date, "; - $sql .= "last_mod_user "; - $sql .= ") "; - $sql .= "values "; - $sql .= "( "; - $sql .= "'".$_SESSION['domain_uuid']."', "; - $sql .= "'".$contact_uuid."', "; - $sql .= "'".$contact_type."', "; - $sql .= "'".$contact_organization."', "; - $sql .= "'".$contact_name_prefix."', "; - $sql .= "'".$contact_name_given."', "; - $sql .= "'".$contact_name_middle."', "; - $sql .= "'".$contact_name_family."', "; - $sql .= "'".$contact_name_suffix."', "; - $sql .= "'".$contact_nickname."', "; - $sql .= "'".$contact_title."', "; - $sql .= "'".$contact_category."', "; - $sql .= "'".$contact_role."', "; - $sql .= "'".$contact_time_zone."', "; - $sql .= "'".$contact_note."', "; - $sql .= "now(), "; - $sql .= "'".$_SESSION['username']."' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); + //update last modified + $sql = "update v_contacts set "; + $sql .= "last_mod_date = now(), "; + $sql .= "last_mod_user = '".$_SESSION['username']."' "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; + $db->exec(check_sql($sql)); + unset($sql); - $_SESSION["message"] = $text['message-add']; - $location = "contact_edit.php?id=".$contact_uuid; - } //if ($action == "add") + if ($action == "add") { + $contact_uuid = uuid(); + $sql = "insert into v_contacts "; + $sql .= "( "; + $sql .= "domain_uuid, "; + $sql .= "contact_uuid, "; + $sql .= "contact_type, "; + $sql .= "contact_organization, "; + $sql .= "contact_name_prefix, "; + $sql .= "contact_name_given, "; + $sql .= "contact_name_middle, "; + $sql .= "contact_name_family, "; + $sql .= "contact_name_suffix, "; + $sql .= "contact_nickname, "; + $sql .= "contact_title, "; + $sql .= "contact_category, "; + $sql .= "contact_role, "; + $sql .= "contact_time_zone, "; + $sql .= "contact_note, "; + $sql .= "last_mod_date, "; + $sql .= "last_mod_user "; + $sql .= ") "; + $sql .= "values "; + $sql .= "( "; + $sql .= "'".$_SESSION['domain_uuid']."', "; + $sql .= "'".$contact_uuid."', "; + $sql .= "'".$contact_type."', "; + $sql .= "'".$contact_organization."', "; + $sql .= "'".$contact_name_prefix."', "; + $sql .= "'".$contact_name_given."', "; + $sql .= "'".$contact_name_middle."', "; + $sql .= "'".$contact_name_family."', "; + $sql .= "'".$contact_name_suffix."', "; + $sql .= "'".$contact_nickname."', "; + $sql .= "'".$contact_title."', "; + $sql .= "'".$contact_category."', "; + $sql .= "'".$contact_role."', "; + $sql .= "'".$contact_time_zone."', "; + $sql .= "'".$contact_note."', "; + $sql .= "now(), "; + $sql .= "'".$_SESSION['username']."' "; + $sql .= ")"; + $db->exec(check_sql($sql)); + unset($sql); - //if contact is shared, remove contact group record containing user's uuid - if ($_POST['contact_shared'] == 'true') { - $sql = "delete from v_contact_groups "; - $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and contact_uuid = '".$contact_uuid."' "; - $sql .= "and group_uuid = '".$_SESSION["user_uuid"]."' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - unset($prep_statement, $sql); - $group_uuid = $_POST['group_uuid']; - } - //if private contact, delete any groups currently assigned, set group uuid to user's uuid - else { - $sql = "delete from v_contact_groups "; - $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and contact_uuid = '".$contact_uuid."' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - unset($prep_statement, $sql); - $group_uuid = $_SESSION["user_uuid"]; - } + $_SESSION["message"] = $text['message-add']; + $location = "contact_edit.php?id=".$contact_uuid; + } //if ($action == "add") - //handle insertion of contact group (or private contact, if not shared) - if ($group_uuid != '') { - $sql = "insert into v_contact_groups "; - $sql .= "( "; - $sql .= "contact_group_uuid, "; - $sql .= "domain_uuid, "; - $sql .= "contact_uuid, "; - $sql .= "group_uuid "; - $sql .= ") "; - $sql .= "values "; - $sql .= "( "; - $sql .= "'".uuid()."', "; - $sql .= "'".$domain_uuid."', "; - $sql .= "'".$contact_uuid."', "; - $sql .= "'".$group_uuid."' "; - $sql .= ") "; - $db->exec(check_sql($sql)); - unset($sql); - } + //if contact is shared, remove contact group record containing user's uuid + if ($_POST['contact_shared'] == 'true') { + $sql = "delete from v_contact_groups "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; + $sql .= "and group_uuid = '".$_SESSION["user_uuid"]."' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + unset($prep_statement, $sql); + $group_uuid = $_POST['group_uuid']; + } + //if private contact, delete any groups currently assigned, set group uuid to user's uuid + else { + $sql = "delete from v_contact_groups "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + unset($prep_statement, $sql); + $group_uuid = $_SESSION["user_uuid"]; + } - if ($action == "update") { - $sql = "update v_contacts set "; - $sql .= "contact_type = '".$contact_type."', "; - $sql .= "contact_organization = '".$contact_organization."', "; - $sql .= "contact_name_prefix = '".$contact_name_prefix."', "; - $sql .= "contact_name_given = '".$contact_name_given."', "; - $sql .= "contact_name_middle = '".$contact_name_middle."', "; - $sql .= "contact_name_family = '".$contact_name_family."', "; - $sql .= "contact_name_suffix = '".$contact_name_suffix."', "; - $sql .= "contact_nickname = '".$contact_nickname."', "; - $sql .= "contact_title = '".$contact_title."', "; - $sql .= "contact_category = '".$contact_category."', "; - $sql .= "contact_role = '".$contact_role."', "; - $sql .= "contact_time_zone = '".$contact_time_zone."', "; - $sql .= "contact_note = '".$contact_note."', "; - $sql .= "last_mod_date = now(), "; - $sql .= "last_mod_user = '".$_SESSION['username']."' "; - $sql .= "where domain_uuid = '".$domain_uuid."' "; - $sql .= "and contact_uuid = '".$contact_uuid."' "; - $db->exec(check_sql($sql)); - unset($sql); + //handle insertion of contact group (or private contact, if not shared) + if ($group_uuid != '') { + $sql = "insert into v_contact_groups "; + $sql .= "( "; + $sql .= "contact_group_uuid, "; + $sql .= "domain_uuid, "; + $sql .= "contact_uuid, "; + $sql .= "group_uuid "; + $sql .= ") "; + $sql .= "values "; + $sql .= "( "; + $sql .= "'".uuid()."', "; + $sql .= "'".$domain_uuid."', "; + $sql .= "'".$contact_uuid."', "; + $sql .= "'".$group_uuid."' "; + $sql .= ") "; + $db->exec(check_sql($sql)); + unset($sql); + } - $_SESSION["message"] = $text['message-update']; - $location = "contact_edit.php?id=".$contact_uuid; - } //if ($action == "update") + if ($action == "update") { + $sql = "update v_contacts set "; + $sql .= "contact_type = '".$contact_type."', "; + $sql .= "contact_organization = '".$contact_organization."', "; + $sql .= "contact_name_prefix = '".$contact_name_prefix."', "; + $sql .= "contact_name_given = '".$contact_name_given."', "; + $sql .= "contact_name_middle = '".$contact_name_middle."', "; + $sql .= "contact_name_family = '".$contact_name_family."', "; + $sql .= "contact_name_suffix = '".$contact_name_suffix."', "; + $sql .= "contact_nickname = '".$contact_nickname."', "; + $sql .= "contact_title = '".$contact_title."', "; + $sql .= "contact_category = '".$contact_category."', "; + $sql .= "contact_role = '".$contact_role."', "; + $sql .= "contact_time_zone = '".$contact_time_zone."', "; + $sql .= "contact_note = '".$contact_note."', "; + $sql .= "last_mod_date = now(), "; + $sql .= "last_mod_user = '".$_SESSION['username']."' "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; + $db->exec(check_sql($sql)); + unset($sql); - //handle redirect - if ($_POST['submit'] == $text['button-add']) { - $group_uuid = $_POST['group_uuid']; - //insert - $location = "contact_edit.php?id=".$contact_uuid; - } + $_SESSION["message"] = $text['message-update']; + $location = "contact_edit.php?id=".$contact_uuid; + } //if ($action == "update") - header("Location: ".$location); - return; + //handle redirect + if ($_POST['submit'] == $text['button-add']) { + $group_uuid = $_POST['group_uuid']; + //insert + $location = "contact_edit.php?id=".$contact_uuid; + } - } //if ($_POST["persistformvar"] != "true") -} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) + header("Location: ".$location); + return; + + } //if ($_POST["persistformvar"] != "true") + } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) //pre-populate the form if (count($_GET) > 0 && $_POST["persistformvar"] != "true") { diff --git a/app/contacts/contact_email_edit.php b/app/contacts/contact_email_edit.php index f3c7e97665..5a4149e89b 100644 --- a/app/contacts/contact_email_edit.php +++ b/app/contacts/contact_email_edit.php @@ -64,87 +64,98 @@ if (strlen($_GET["contact_uuid"]) > 0) { $email_label = ($email_label_custom != '') ? $email_label_custom : $email_label; } -if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { +//process the form data + if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { - $msg = ''; - if ($action == "update") { - $contact_email_uuid = check_str($_POST["contact_email_uuid"]); - } + //set the uuid + if ($action == "update") { + $contact_email_uuid = check_str($_POST["contact_email_uuid"]); + } - //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 "
\n"; - echo "
\n"; - echo $msg."
"; - echo "
\n"; - persistformvar($_POST); - echo "
\n"; - require_once "resources/footer.php"; - return; - } + //check for all required data + $msg = ''; + if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + require_once "resources/header.php"; + require_once "resources/persist_form_var.php"; + echo "
\n"; + echo "
\n"; + echo $msg."
"; + echo "
\n"; + persistformvar($_POST); + echo "
\n"; + require_once "resources/footer.php"; + return; + } - //add or update the database - if ($_POST["persistformvar"] != "true") { + //add or update the database + if ($_POST["persistformvar"] != "true") { - //if primary, unmark other primary numbers - if ($email_primary) { - $sql = "update v_contact_emails set email_primary = 0 "; - $sql .= "where domain_uuid = '".$domain_uuid."' "; - $sql .= "and contact_uuid = '".$contact_uuid."' "; - $db->exec(check_sql($sql)); - unset($sql); - } + //update last modified + $sql = "update v_contacts set "; + $sql .= "last_mod_date = now(), "; + $sql .= "last_mod_user = '".$_SESSION['username']."' "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; + $db->exec(check_sql($sql)); + unset($sql); - if ($action == "add") { - $contact_email_uuid = uuid(); - $sql = "insert into v_contact_emails "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "contact_uuid, "; - $sql .= "contact_email_uuid, "; - $sql .= "email_label, "; - $sql .= "email_address, "; - $sql .= "email_primary, "; - $sql .= "email_description "; - $sql .= ")"; - $sql .= "values "; - $sql .= "("; - $sql .= "'".$_SESSION['domain_uuid']."', "; - $sql .= "'".$contact_uuid."', "; - $sql .= "'".$contact_email_uuid."', "; - $sql .= "'".$email_label."', "; - $sql .= "'".$email_address."', "; - $sql .= (($email_primary) ? 1 : 0).", "; - $sql .= "'".$email_description."' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); + //if primary, unmark other primary numbers + if ($email_primary) { + $sql = "update v_contact_emails set email_primary = 0 "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; + $db->exec(check_sql($sql)); + unset($sql); + } - $_SESSION["message"] = $text['message-add']; - header("Location: contact_edit.php?id=".$contact_uuid); - return; - } //if ($action == "add") + if ($action == "add") { + $contact_email_uuid = uuid(); + $sql = "insert into v_contact_emails "; + $sql .= "("; + $sql .= "domain_uuid, "; + $sql .= "contact_uuid, "; + $sql .= "contact_email_uuid, "; + $sql .= "email_label, "; + $sql .= "email_address, "; + $sql .= "email_primary, "; + $sql .= "email_description "; + $sql .= ")"; + $sql .= "values "; + $sql .= "("; + $sql .= "'".$_SESSION['domain_uuid']."', "; + $sql .= "'".$contact_uuid."', "; + $sql .= "'".$contact_email_uuid."', "; + $sql .= "'".$email_label."', "; + $sql .= "'".$email_address."', "; + $sql .= (($email_primary) ? 1 : 0).", "; + $sql .= "'".$email_description."' "; + $sql .= ")"; + $db->exec(check_sql($sql)); + unset($sql); - if ($action == "update") { - $sql = "update v_contact_emails set "; - $sql .= "contact_uuid = '".$contact_uuid."', "; - $sql .= "email_label = '".$email_label."', "; - $sql .= "email_address = '".$email_address."', "; - $sql .= "email_primary = ".(($email_primary) ? 1 : 0).", "; - $sql .= "email_description = '".$email_description."' "; - $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and contact_email_uuid = '".$contact_email_uuid."'"; - $db->exec(check_sql($sql)); - unset($sql); + $_SESSION["message"] = $text['message-add']; + header("Location: contact_edit.php?id=".$contact_uuid); + return; + } //if ($action == "add") - $_SESSION["message"] = $text['message-update']; - header("Location: contact_edit.php?id=".$contact_uuid); - return; - } //if ($action == "update") - } //if ($_POST["persistformvar"] != "true") -} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) + if ($action == "update") { + $sql = "update v_contact_emails set "; + $sql .= "contact_uuid = '".$contact_uuid."', "; + $sql .= "email_label = '".$email_label."', "; + $sql .= "email_address = '".$email_address."', "; + $sql .= "email_primary = ".(($email_primary) ? 1 : 0).", "; + $sql .= "email_description = '".$email_description."' "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and contact_email_uuid = '".$contact_email_uuid."'"; + $db->exec(check_sql($sql)); + unset($sql); + + $_SESSION["message"] = $text['message-update']; + header("Location: contact_edit.php?id=".$contact_uuid); + return; + } //if ($action == "update") + } //if ($_POST["persistformvar"] != "true") + } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) //pre-populate the form if (count($_GET)>0 && $_POST["persistformvar"] != "true") { diff --git a/app/contacts/contact_extensions.php b/app/contacts/contact_extensions.php index 232a7aef5e..95148688ff 100644 --- a/app/contacts/contact_extensions.php +++ b/app/contacts/contact_extensions.php @@ -82,7 +82,7 @@ else { echo "".$text['label-description']."\n"; echo ""; if (permission_exists('extension_add')) { - echo "$v_link_label_add\n"; + echo "$v_link_label_add\n"; } echo "\n"; echo "\n"; @@ -92,7 +92,7 @@ else { echo "\n"; echo " "; if (permission_exists('extension_edit')) { - echo "".$row['extension'].""; + echo "".$row['extension'].""; } else { echo $row['extension']; @@ -102,10 +102,10 @@ else { echo " ".$row['description']." \n"; echo " "; if (permission_exists('extension_edit')) { - echo "$v_link_label_edit"; + echo "$v_link_label_edit"; } if (permission_exists('extension_delete')) { - echo "$v_link_label_delete"; + echo "$v_link_label_delete"; } echo " \n"; echo "\n"; @@ -116,4 +116,4 @@ else { echo ""; -?> +?> \ No newline at end of file diff --git a/app/contacts/contact_import.php b/app/contacts/contact_import.php index 0c25924cd4..66517dd769 100644 --- a/app/contacts/contact_import.php +++ b/app/contacts/contact_import.php @@ -299,7 +299,7 @@ else { $sql .= (($row['phone_type_text']) ? 1 : 0).", "; $sql .= "'".$row['phone_label']."', "; $sql .= "'".$row['phone_number']."', "; - $sql .= "'".$row['phone_description']."', "; + $sql .= "'".$row['phone_description']."' "; $sql .= ")"; $db->exec(check_sql($sql)); unset($sql); diff --git a/app/contacts/contact_note_edit.php b/app/contacts/contact_note_edit.php index 88129984ff..8c255dc37d 100644 --- a/app/contacts/contact_note_edit.php +++ b/app/contacts/contact_note_edit.php @@ -59,75 +59,87 @@ else { $last_mod_user = check_str($_POST["last_mod_user"]); } -if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { +//process the form data + if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { - //get the primary id for the contact note - $msg = ''; - if ($action == "update") { - $contact_note_uuid = check_str($_POST["contact_note_uuid"]); - } + //get the primary id for the contact note + if ($action == "update") { + $contact_note_uuid = check_str($_POST["contact_note_uuid"]); + } - //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 "
\n"; - echo "
\n"; - echo $msg."
"; - echo "
\n"; - persistformvar($_POST); - echo "
\n"; - require_once "resources/footer.php"; - return; - } + //check for all required data + $msg = ''; + if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + require_once "resources/header.php"; + require_once "resources/persist_form_var.php"; + echo "
\n"; + echo "
\n"; + echo $msg."
"; + echo "
\n"; + persistformvar($_POST); + echo "
\n"; + require_once "resources/footer.php"; + return; + } - //add or update the database - if ($_POST["persistformvar"] != "true") { - if ($action == "add") { - $contact_note_uuid = uuid(); - $sql = "insert into v_contact_notes "; - $sql .= "("; - $sql .= "contact_note_uuid, "; - $sql .= "contact_uuid, "; - $sql .= "contact_note, "; - $sql .= "domain_uuid, "; - $sql .= "last_mod_date, "; - $sql .= "last_mod_user "; - $sql .= ")"; - $sql .= "values "; - $sql .= "("; - $sql .= "'$contact_note_uuid', "; - $sql .= "'$contact_uuid', "; - $sql .= "'$contact_note', "; - $sql .= "'$domain_uuid', "; - $sql .= "now(), "; - $sql .= "'".$_SESSION['username']."' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); + //add or update the database + if ($_POST["persistformvar"] != "true") { + //update last modified + $sql = "update v_contacts set "; + $sql .= "last_mod_date = now(), "; + $sql .= "last_mod_user = '".$_SESSION['username']."' "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; + $db->exec(check_sql($sql)); + unset($sql); - $_SESSION["message"] = $text['message-add']; - header("Location: contact_edit.php?id=".$contact_uuid); - return; - } //if ($action == "add") + //add the note + if ($action == "add") { + $contact_note_uuid = uuid(); + $sql = "insert into v_contact_notes "; + $sql .= "("; + $sql .= "contact_note_uuid, "; + $sql .= "contact_uuid, "; + $sql .= "contact_note, "; + $sql .= "domain_uuid, "; + $sql .= "last_mod_date, "; + $sql .= "last_mod_user "; + $sql .= ")"; + $sql .= "values "; + $sql .= "("; + $sql .= "'$contact_note_uuid', "; + $sql .= "'$contact_uuid', "; + $sql .= "'$contact_note', "; + $sql .= "'$domain_uuid', "; + $sql .= "now(), "; + $sql .= "'".$_SESSION['username']."' "; + $sql .= ")"; + $db->exec(check_sql($sql)); + unset($sql); - if ($action == "update") { - $sql = "update v_contact_notes set "; - $sql .= "contact_uuid = '$contact_uuid', "; - $sql .= "contact_note = '$contact_note', "; - $sql .= "last_mod_date = now(), "; - $sql .= "last_mod_user = '".$_SESSION['username']."' "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and contact_note_uuid = '$contact_note_uuid'"; - $db->exec(check_sql($sql)); - unset($sql); + $_SESSION["message"] = $text['message-add']; + header("Location: contact_edit.php?id=".$contact_uuid); + return; + } //if ($action == "add") - $_SESSION["message"] = $text['message-update']; - header("Location: contact_edit.php?id=".$contact_uuid); - return; - } //if ($action == "update") - } //if ($_POST["persistformvar"] != "true") -} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) + //update the note + if ($action == "update") { + $sql = "update v_contact_notes set "; + $sql .= "contact_uuid = '$contact_uuid', "; + $sql .= "contact_note = '$contact_note', "; + $sql .= "last_mod_date = now(), "; + $sql .= "last_mod_user = '".$_SESSION['username']."' "; + $sql .= "where domain_uuid = '$domain_uuid' "; + $sql .= "and contact_note_uuid = '$contact_note_uuid'"; + $db->exec(check_sql($sql)); + unset($sql); + + $_SESSION["message"] = $text['message-update']; + header("Location: contact_edit.php?id=".$contact_uuid); + return; + } //if ($action == "update") + } //if ($_POST["persistformvar"] != "true") + } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) //pre-populate the form if (count($_GET)>0 && $_POST["persistformvar"] != "true") { diff --git a/app/contacts/contact_phone_edit.php b/app/contacts/contact_phone_edit.php index 4c3c61c844..ce05e03975 100644 --- a/app/contacts/contact_phone_edit.php +++ b/app/contacts/contact_phone_edit.php @@ -72,102 +72,113 @@ if (strlen($_GET["contact_uuid"]) > 0) { $phone_label = ($phone_label_custom != '') ? $phone_label_custom : $phone_label; } -if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { +//process the form data + if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { - $msg = ''; - if ($action == "update") { - $contact_phone_uuid = check_str($_POST["contact_phone_uuid"]); - } + //set thge uuid + if ($action == "update") { + $contact_phone_uuid = check_str($_POST["contact_phone_uuid"]); + } - //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 "
\n"; - echo "
\n"; - echo $msg."
"; - echo "
\n"; - persistformvar($_POST); - echo "
\n"; - require_once "resources/footer.php"; - return; - } + //check for all required data + $msg = ''; + if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + require_once "resources/header.php"; + require_once "resources/persist_form_var.php"; + echo "
\n"; + echo "
\n"; + echo $msg."
"; + echo "
\n"; + persistformvar($_POST); + echo "
\n"; + require_once "resources/footer.php"; + return; + } - //add or update the database - if ($_POST["persistformvar"] != "true") { + //add or update the database + if ($_POST["persistformvar"] != "true") { - //if primary, unmark other primary numbers - if ($phone_primary) { - $sql = "update v_contact_phones set phone_primary = 0 "; - $sql .= "where domain_uuid = '".$domain_uuid."' "; - $sql .= "and contact_uuid = '".$contact_uuid."' "; - $db->exec(check_sql($sql)); - unset($sql); - } + //update last modified + $sql = "update v_contacts set "; + $sql .= "last_mod_date = now(), "; + $sql .= "last_mod_user = '".$_SESSION['username']."' "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; + $db->exec(check_sql($sql)); + unset($sql); - if ($action == "add") { - $contact_phone_uuid = uuid(); - $sql = "insert into v_contact_phones "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "contact_uuid, "; - $sql .= "contact_phone_uuid, "; - $sql .= "phone_type_voice, "; - $sql .= "phone_type_fax, "; - $sql .= "phone_type_video, "; - $sql .= "phone_type_text, "; - $sql .= "phone_label, "; - $sql .= "phone_number, "; - $sql .= "phone_extension, "; - $sql .= "phone_primary, "; - $sql .= "phone_description "; - $sql .= ")"; - $sql .= "values "; - $sql .= "("; - $sql .= "'".$domain_uuid."', "; - $sql .= "'".$contact_uuid."', "; - $sql .= "'".$contact_phone_uuid."', "; - $sql .= (($phone_type_voice) ? 1 : 'null').", "; - $sql .= (($phone_type_fax) ? 1 : 'null').", "; - $sql .= (($phone_type_video) ? 1 : 'null').", "; - $sql .= (($phone_type_text) ? 1 : 'null').", "; - $sql .= "'".$phone_label."', "; - $sql .= "'".$phone_number."', "; - $sql .= "'".$phone_extension."', "; - $sql .= (($phone_primary) ? 1 : 0).", "; - $sql .= "'".$phone_description."' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); + //if primary, unmark other primary numbers + if ($phone_primary) { + $sql = "update v_contact_phones set phone_primary = 0 "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; + $db->exec(check_sql($sql)); + unset($sql); + } - $_SESSION["message"] = $text['message-add']; - header("Location: contact_edit.php?id=".$contact_uuid); - return; - } //if ($action == "add") + if ($action == "add") { + $contact_phone_uuid = uuid(); + $sql = "insert into v_contact_phones "; + $sql .= "("; + $sql .= "domain_uuid, "; + $sql .= "contact_uuid, "; + $sql .= "contact_phone_uuid, "; + $sql .= "phone_type_voice, "; + $sql .= "phone_type_fax, "; + $sql .= "phone_type_video, "; + $sql .= "phone_type_text, "; + $sql .= "phone_label, "; + $sql .= "phone_number, "; + $sql .= "phone_extension, "; + $sql .= "phone_primary, "; + $sql .= "phone_description "; + $sql .= ")"; + $sql .= "values "; + $sql .= "("; + $sql .= "'".$domain_uuid."', "; + $sql .= "'".$contact_uuid."', "; + $sql .= "'".$contact_phone_uuid."', "; + $sql .= (($phone_type_voice) ? 1 : 'null').", "; + $sql .= (($phone_type_fax) ? 1 : 'null').", "; + $sql .= (($phone_type_video) ? 1 : 'null').", "; + $sql .= (($phone_type_text) ? 1 : 'null').", "; + $sql .= "'".$phone_label."', "; + $sql .= "'".$phone_number."', "; + $sql .= "'".$phone_extension."', "; + $sql .= (($phone_primary) ? 1 : 0).", "; + $sql .= "'".$phone_description."' "; + $sql .= ")"; + $db->exec(check_sql($sql)); + unset($sql); - if ($action == "update") { - $sql = "update v_contact_phones set "; - $sql .= "contact_uuid = '$contact_uuid', "; - $sql .= "phone_type_voice = ".(($phone_type_voice) ? 1 : 'null').", "; - $sql .= "phone_type_fax = ".(($phone_type_fax) ? 1 : 'null').", "; - $sql .= "phone_type_video = ".(($phone_type_video) ? 1 : 'null').", "; - $sql .= "phone_type_text = ".(($phone_type_text) ? 1 : 'null').", "; - $sql .= "phone_label = '".$phone_label."', "; - $sql .= "phone_number = '".$phone_number."', "; - $sql .= "phone_extension = '".$phone_extension."', "; - $sql .= "phone_primary = ".(($phone_primary) ? 1 : 0).", "; - $sql .= "phone_description = '".$phone_description."' "; - $sql .= "where domain_uuid = '".$domain_uuid."' "; - $sql .= "and contact_phone_uuid = '".$contact_phone_uuid."'"; - $db->exec(check_sql($sql)); - unset($sql); + $_SESSION["message"] = $text['message-add']; + header("Location: contact_edit.php?id=".$contact_uuid); + return; + } //if ($action == "add") - $_SESSION["message"] = $text['message-update']; - header("Location: contact_edit.php?id=".$contact_uuid); - return; - } //if ($action == "update") - } //if ($_POST["persistformvar"] != "true") -} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) + if ($action == "update") { + $sql = "update v_contact_phones set "; + $sql .= "contact_uuid = '$contact_uuid', "; + $sql .= "phone_type_voice = ".(($phone_type_voice) ? 1 : 'null').", "; + $sql .= "phone_type_fax = ".(($phone_type_fax) ? 1 : 'null').", "; + $sql .= "phone_type_video = ".(($phone_type_video) ? 1 : 'null').", "; + $sql .= "phone_type_text = ".(($phone_type_text) ? 1 : 'null').", "; + $sql .= "phone_label = '".$phone_label."', "; + $sql .= "phone_number = '".$phone_number."', "; + $sql .= "phone_extension = '".$phone_extension."', "; + $sql .= "phone_primary = ".(($phone_primary) ? 1 : 0).", "; + $sql .= "phone_description = '".$phone_description."' "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; + $sql .= "and contact_phone_uuid = '".$contact_phone_uuid."'"; + $db->exec(check_sql($sql)); + unset($sql); + + $_SESSION["message"] = $text['message-update']; + header("Location: contact_edit.php?id=".$contact_uuid); + return; + } //if ($action == "update") + } //if ($_POST["persistformvar"] != "true") + } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) //pre-populate the form if (count($_GET)>0 && $_POST["persistformvar"] != "true") { diff --git a/app/contacts/contact_relation_edit.php b/app/contacts/contact_relation_edit.php index c7154ab3a0..bd01d13a93 100644 --- a/app/contacts/contact_relation_edit.php +++ b/app/contacts/contact_relation_edit.php @@ -48,9 +48,10 @@ else { $action = "add"; } -if (strlen($_GET["contact_uuid"]) > 0) { - $contact_uuid = check_str($_GET["contact_uuid"]); -} +//get the contact uuid + if (strlen($_GET["contact_uuid"]) > 0) { + $contact_uuid = check_str($_GET["contact_uuid"]); + } //get http post variables and set them to php variables if (count($_POST)>0) { @@ -66,93 +67,104 @@ if (strlen($_GET["contact_uuid"]) > 0) { $relation_reciprocal_label = ($relation_reciprocal_label_custom != '') ? $relation_reciprocal_label_custom : $relation_reciprocal_label; } -if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { +//process the form data + if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { - $msg = ''; - if ($action == "update") { - $contact_relation_uuid = check_str($_POST["contact_relation_uuid"]); - } - - //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 "
\n"; - echo "
\n"; - echo $msg."
"; - echo "
\n"; - persistformvar($_POST); - echo "
\n"; - require_once "resources/footer.php"; - return; - } - - //add or update the database - if ($_POST["persistformvar"] != "true") { - - if ($action == "add") { - $contact_relation_uuid = uuid(); - $sql = "insert into v_contact_relations "; - $sql .= "("; - $sql .= "contact_relation_uuid, "; - $sql .= "domain_uuid, "; - $sql .= "contact_uuid, "; - $sql .= "relation_label, "; - $sql .= "relation_contact_uuid "; - $sql .= ")"; - $sql .= "values "; - $sql .= "("; - $sql .= "'".$contact_relation_uuid."', "; - $sql .= "'".$_SESSION['domain_uuid']."', "; - $sql .= "'".$contact_uuid."', "; - $sql .= "'".$relation_label."', "; - $sql .= "'".$relation_contact_uuid."' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); - - if ($relation_reciprocal) { - $contact_relation_uuid = uuid(); - $sql = "insert into v_contact_relations "; - $sql .= "("; - $sql .= "contact_relation_uuid, "; - $sql .= "domain_uuid, "; - $sql .= "contact_uuid, "; - $sql .= "relation_label, "; - $sql .= "relation_contact_uuid "; - $sql .= ")"; - $sql .= "values "; - $sql .= "("; - $sql .= "'".$contact_relation_uuid."', "; - $sql .= "'".$_SESSION['domain_uuid']."', "; - $sql .= "'".$relation_contact_uuid."', "; - $sql .= "'".$relation_reciprocal_label."', "; - $sql .= "'".$contact_uuid."' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); + //set the uuid + if ($action == "update") { + $contact_relation_uuid = check_str($_POST["contact_relation_uuid"]); } - $_SESSION["message"] = $text['message-add']; - header("Location: contact_edit.php?id=".$contact_uuid); - return; - } //if ($action == "add") + //check for all required data + $msg = ''; + if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + require_once "resources/header.php"; + require_once "resources/persist_form_var.php"; + echo "
\n"; + echo "
\n"; + echo $msg."
"; + echo "
\n"; + persistformvar($_POST); + echo "
\n"; + require_once "resources/footer.php"; + return; + } - if ($action == "update") { - $sql = "update v_contact_relations set "; - $sql .= "relation_label = '".$relation_label."', "; - $sql .= "relation_contact_uuid = '".$relation_contact_uuid."' "; - $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and contact_relation_uuid = '".$contact_relation_uuid."'"; - $db->exec(check_sql($sql)); - unset($sql); + //add or update the database + if ($_POST["persistformvar"] != "true") { - $_SESSION["message"] = $text['message-update']; - header("Location: contact_edit.php?id=".$contact_uuid); - return; - } //if ($action == "update") - } //if ($_POST["persistformvar"] != "true") -} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) + //update last modified + $sql = "update v_contacts set "; + $sql .= "last_mod_date = now(), "; + $sql .= "last_mod_user = '".$_SESSION['username']."' "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; + $db->exec(check_sql($sql)); + unset($sql); + + if ($action == "add") { + $contact_relation_uuid = uuid(); + $sql = "insert into v_contact_relations "; + $sql .= "("; + $sql .= "contact_relation_uuid, "; + $sql .= "domain_uuid, "; + $sql .= "contact_uuid, "; + $sql .= "relation_label, "; + $sql .= "relation_contact_uuid "; + $sql .= ")"; + $sql .= "values "; + $sql .= "("; + $sql .= "'".$contact_relation_uuid."', "; + $sql .= "'".$_SESSION['domain_uuid']."', "; + $sql .= "'".$contact_uuid."', "; + $sql .= "'".$relation_label."', "; + $sql .= "'".$relation_contact_uuid."' "; + $sql .= ")"; + $db->exec(check_sql($sql)); + unset($sql); + + if ($relation_reciprocal) { + $contact_relation_uuid = uuid(); + $sql = "insert into v_contact_relations "; + $sql .= "("; + $sql .= "contact_relation_uuid, "; + $sql .= "domain_uuid, "; + $sql .= "contact_uuid, "; + $sql .= "relation_label, "; + $sql .= "relation_contact_uuid "; + $sql .= ")"; + $sql .= "values "; + $sql .= "("; + $sql .= "'".$contact_relation_uuid."', "; + $sql .= "'".$_SESSION['domain_uuid']."', "; + $sql .= "'".$relation_contact_uuid."', "; + $sql .= "'".$relation_reciprocal_label."', "; + $sql .= "'".$contact_uuid."' "; + $sql .= ")"; + $db->exec(check_sql($sql)); + unset($sql); + } + + $_SESSION["message"] = $text['message-add']; + header("Location: contact_edit.php?id=".$contact_uuid); + return; + } //if ($action == "add") + + if ($action == "update") { + $sql = "update v_contact_relations set "; + $sql .= "relation_label = '".$relation_label."', "; + $sql .= "relation_contact_uuid = '".$relation_contact_uuid."' "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and contact_relation_uuid = '".$contact_relation_uuid."'"; + $db->exec(check_sql($sql)); + unset($sql); + + $_SESSION["message"] = $text['message-update']; + header("Location: contact_edit.php?id=".$contact_uuid); + return; + } //if ($action == "update") + } //if ($_POST["persistformvar"] != "true") + } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) //pre-populate the form if (count($_GET) > 0 && $_POST["persistformvar"] != "true") { diff --git a/app/contacts/contact_setting_edit.php b/app/contacts/contact_setting_edit.php index fd98a172d9..47bae1a29c 100644 --- a/app/contacts/contact_setting_edit.php +++ b/app/contacts/contact_setting_edit.php @@ -48,10 +48,13 @@ else { $action = "add"; } -if (strlen($_GET["contact_uuid"]) > 0) { - $contact_uuid = check_str($_GET["contact_uuid"]); -} -$domain_uuid = $_SESSION['domain_uuid']; +//get the contact uuid + if (strlen($_GET["contact_uuid"]) > 0) { + $contact_uuid = check_str($_GET["contact_uuid"]); + } + +//set the session domain uuid as a variable + $domain_uuid = $_SESSION['domain_uuid']; //get http post variables and set them to php variables if (count($_POST) > 0) { @@ -64,97 +67,110 @@ $domain_uuid = $_SESSION['domain_uuid']; $contact_setting_description = check_str($_POST["contact_setting_description"]); } -if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { +//process the form data + if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { - $msg = ''; - if ($action == "update") { - $contact_setting_uuid = check_str($_POST["contact_setting_uuid"]); - } + //set the uuid + if ($action == "update") { + $contact_setting_uuid = check_str($_POST["contact_setting_uuid"]); + } - //check for all required data - //if (strlen($domain_setting_category) == 0) { $msg .= $text['message-required'].$text['label-category']."
\n"; } - //if (strlen($domain_setting_subcategory) == 0) { $msg .= $text['message-required'].$text['label-subcategory']."
\n"; } - //if (strlen($domain_setting_name) == 0) { $msg .= $text['message-required'].$text['label-type']."
\n"; } - //if (strlen($domain_setting_value) == 0) { $msg .= $text['message-required'].$text['label-value']."
\n"; } - //if (strlen($domain_setting_order) == 0) { $msg .= $text['message-required'].$text['label-order']."
\n"; } - //if (strlen($domain_setting_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."
\n"; } - //if (strlen($domain_setting_description) == 0) { $msg .= $text['message-required'].$text['label-description']."
\n"; } - if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { - require_once "resources/header.php"; - require_once "resources/persist_form_var.php"; - echo "
\n"; - echo "
\n"; - echo $msg."
"; - echo "
\n"; - persistformvar($_POST); - echo "
\n"; - require_once "resources/footer.php"; - return; - } - - //add or update the database - if ($_POST["persistformvar"] != "true") { - $contact_setting_order = ($contact_setting_order != '') ? $contact_setting_order : 'null'; - - //add the domain - if ($action == "add" && permission_exists('domain_setting_add')) { - $sql = "insert into v_contact_settings "; - $sql .= "("; - $sql .= "contact_setting_uuid, "; - $sql .= "contact_uuid, "; - $sql .= "domain_uuid, "; - $sql .= "contact_setting_category, "; - $sql .= "contact_setting_subcategory, "; - $sql .= "contact_setting_name, "; - $sql .= "contact_setting_value, "; - $sql .= "contact_setting_order, "; - $sql .= "contact_setting_enabled, "; - $sql .= "contact_setting_description "; - $sql .= ")"; - $sql .= "values "; - $sql .= "("; - $sql .= "'".uuid()."', "; - $sql .= "'$contact_uuid', "; - $sql .= "'$domain_uuid', "; - $sql .= "'$contact_setting_category', "; - $sql .= "'$contact_setting_subcategory', "; - $sql .= "'$contact_setting_name', "; - $sql .= "'$contact_setting_value', "; - $sql .= "$contact_setting_order, "; - $sql .= "'$contact_setting_enabled', "; - $sql .= "'$contact_setting_description' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); - } //if ($action == "add") - - //update the domain - if ($action == "update") { - $sql = "update v_contact_settings set "; - $sql .= "contact_setting_category = '$contact_setting_category', "; - $sql .= "contact_setting_subcategory = '$contact_setting_subcategory', "; - $sql .= "contact_setting_name = '$contact_setting_name', "; - $sql .= "contact_setting_value = '$contact_setting_value', "; - $sql .= "contact_setting_order = $contact_setting_order, "; - $sql .= "contact_setting_enabled = '$contact_setting_enabled', "; - $sql .= "contact_setting_description = '$contact_setting_description' "; - $sql .= "where contact_uuid = '$contact_uuid' "; - $sql .= "and contact_setting_uuid = '$contact_setting_uuid'"; - $db->exec(check_sql($sql)); - unset($sql); - } //if ($action == "update") - - //redirect the browser - if ($action == "update") { - $_SESSION["message"] = $text['message-update']; - } - if ($action == "add") { - $_SESSION["message"] = $text['message-add']; - } - header("Location: contact_edit.php?id=".$contact_uuid); + //check for all required data + $msg = ''; + //if (strlen($domain_setting_category) == 0) { $msg .= $text['message-required'].$text['label-category']."
\n"; } + //if (strlen($domain_setting_subcategory) == 0) { $msg .= $text['message-required'].$text['label-subcategory']."
\n"; } + //if (strlen($domain_setting_name) == 0) { $msg .= $text['message-required'].$text['label-type']."
\n"; } + //if (strlen($domain_setting_value) == 0) { $msg .= $text['message-required'].$text['label-value']."
\n"; } + //if (strlen($domain_setting_order) == 0) { $msg .= $text['message-required'].$text['label-order']."
\n"; } + //if (strlen($domain_setting_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."
\n"; } + //if (strlen($domain_setting_description) == 0) { $msg .= $text['message-required'].$text['label-description']."
\n"; } + if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + require_once "resources/header.php"; + require_once "resources/persist_form_var.php"; + echo "
\n"; + echo "
\n"; + echo $msg."
"; + echo "
\n"; + persistformvar($_POST); + echo "
\n"; + require_once "resources/footer.php"; return; - } //if ($_POST["persistformvar"] != "true") -} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) + } + + //add or update the database + if ($_POST["persistformvar"] != "true") { + + //set the order + $contact_setting_order = ($contact_setting_order != '') ? $contact_setting_order : 'null'; + + //update last modified + $sql = "update v_contacts set "; + $sql .= "last_mod_date = now(), "; + $sql .= "last_mod_user = '".$_SESSION['username']."' "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; + $db->exec(check_sql($sql)); + unset($sql); + + //add the domain + if ($action == "add" && permission_exists('domain_setting_add')) { + $sql = "insert into v_contact_settings "; + $sql .= "("; + $sql .= "contact_setting_uuid, "; + $sql .= "contact_uuid, "; + $sql .= "domain_uuid, "; + $sql .= "contact_setting_category, "; + $sql .= "contact_setting_subcategory, "; + $sql .= "contact_setting_name, "; + $sql .= "contact_setting_value, "; + $sql .= "contact_setting_order, "; + $sql .= "contact_setting_enabled, "; + $sql .= "contact_setting_description "; + $sql .= ")"; + $sql .= "values "; + $sql .= "("; + $sql .= "'".uuid()."', "; + $sql .= "'$contact_uuid', "; + $sql .= "'$domain_uuid', "; + $sql .= "'$contact_setting_category', "; + $sql .= "'$contact_setting_subcategory', "; + $sql .= "'$contact_setting_name', "; + $sql .= "'$contact_setting_value', "; + $sql .= "$contact_setting_order, "; + $sql .= "'$contact_setting_enabled', "; + $sql .= "'$contact_setting_description' "; + $sql .= ")"; + $db->exec(check_sql($sql)); + unset($sql); + } //if ($action == "add") + + //update the domain + if ($action == "update") { + $sql = "update v_contact_settings set "; + $sql .= "contact_setting_category = '$contact_setting_category', "; + $sql .= "contact_setting_subcategory = '$contact_setting_subcategory', "; + $sql .= "contact_setting_name = '$contact_setting_name', "; + $sql .= "contact_setting_value = '$contact_setting_value', "; + $sql .= "contact_setting_order = $contact_setting_order, "; + $sql .= "contact_setting_enabled = '$contact_setting_enabled', "; + $sql .= "contact_setting_description = '$contact_setting_description' "; + $sql .= "where contact_uuid = '$contact_uuid' "; + $sql .= "and contact_setting_uuid = '$contact_setting_uuid'"; + $db->exec(check_sql($sql)); + unset($sql); + } //if ($action == "update") + + //redirect the browser + if ($action == "update") { + $_SESSION["message"] = $text['message-update']; + } + if ($action == "add") { + $_SESSION["message"] = $text['message-add']; + } + header("Location: contact_edit.php?id=".$contact_uuid); + return; + } //if ($_POST["persistformvar"] != "true") + } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) //pre-populate the form if (count($_GET)>0 && $_POST["persistformvar"] != "true") { diff --git a/app/contacts/contact_time_edit.php b/app/contacts/contact_time_edit.php index 5055f73aec..4b86a57c0d 100644 --- a/app/contacts/contact_time_edit.php +++ b/app/contacts/contact_time_edit.php @@ -47,9 +47,10 @@ else { $action = "add"; } -if (strlen($_GET["contact_uuid"]) > 0) { - $contact_uuid = check_str($_GET["contact_uuid"]); -} +//get the contact uuid + if (strlen($_GET["contact_uuid"]) > 0) { + $contact_uuid = check_str($_GET["contact_uuid"]); + } //get http post variables and set them to php variables if (count($_POST)>0) { @@ -58,81 +59,91 @@ if (strlen($_GET["contact_uuid"]) > 0) { $time_description = check_str($_POST["time_description"]); } -if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { +//process the form data + if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { - $msg = ''; - if ($action == "update") { - $contact_time_uuid = check_str($_POST["contact_time_uuid"]); - } + //set the uuid + if ($action == "update") { + $contact_time_uuid = check_str($_POST["contact_time_uuid"]); + } - //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 "
\n"; - echo "
\n"; - echo $msg."
"; - echo "
\n"; - persistformvar($_POST); - echo "
\n"; - require_once "resources/footer.php"; - return; - } + //check for all required data + $msg = ''; + if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + require_once "resources/header.php"; + require_once "resources/persist_form_var.php"; + echo "
\n"; + echo "
\n"; + echo $msg."
"; + echo "
\n"; + persistformvar($_POST); + echo "
\n"; + require_once "resources/footer.php"; + return; + } - //add or update the database - if ($_POST["persistformvar"] != "true") { + //add or update the database + if ($_POST["persistformvar"] != "true") { + //update last modified + $sql = "update v_contacts set "; + $sql .= "last_mod_date = now(), "; + $sql .= "last_mod_user = '".$_SESSION['username']."' "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; + $db->exec(check_sql($sql)); + unset($sql); - if ($action == "add") { - $contact_time_uuid = uuid(); - $sql = "insert into v_contact_times "; - $sql .= "( "; - $sql .= "domain_uuid, "; - $sql .= "contact_time_uuid, "; - $sql .= "contact_uuid, "; - $sql .= "user_uuid, "; - $sql .= "time_start, "; - $sql .= "time_stop, "; - $sql .= "time_description "; - $sql .= ") "; - $sql .= "values "; - $sql .= "( "; - $sql .= "'".$domain_uuid."', "; - $sql .= "'".$contact_time_uuid."', "; - $sql .= "'".$contact_uuid."', "; - $sql .= "'".$_SESSION["user"]["user_uuid"]."', "; - $sql .= "'".$time_start."', "; - $sql .= "'".$time_stop."', "; - $sql .= "'".$time_description."' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); + if ($action == "add") { + $contact_time_uuid = uuid(); + $sql = "insert into v_contact_times "; + $sql .= "( "; + $sql .= "domain_uuid, "; + $sql .= "contact_time_uuid, "; + $sql .= "contact_uuid, "; + $sql .= "user_uuid, "; + $sql .= "time_start, "; + $sql .= "time_stop, "; + $sql .= "time_description "; + $sql .= ") "; + $sql .= "values "; + $sql .= "( "; + $sql .= "'".$domain_uuid."', "; + $sql .= "'".$contact_time_uuid."', "; + $sql .= "'".$contact_uuid."', "; + $sql .= "'".$_SESSION["user"]["user_uuid"]."', "; + $sql .= "'".$time_start."', "; + $sql .= "'".$time_stop."', "; + $sql .= "'".$time_description."' "; + $sql .= ")"; + $db->exec(check_sql($sql)); + unset($sql); - $_SESSION["message"] = $text['message-add']; - header("Location: contact_edit.php?id=".$contact_uuid); - return; - } //if ($action == "add") + $_SESSION["message"] = $text['message-add']; + header("Location: contact_edit.php?id=".$contact_uuid); + return; + } //if ($action == "add") - if ($action == "update") { - $sql = "update v_contact_times "; - $sql .= "set "; - $sql .= "time_start = '".$time_start."', "; - $sql .= "time_stop = '".$time_stop."', "; - $sql .= "time_description = '".$time_description."' "; - $sql .= "where "; - $sql .= "contact_time_uuid = '".$contact_time_uuid."' "; - $sql .= "and domain_uuid = '".$domain_uuid."' "; - $sql .= "and contact_uuid = '".$contact_uuid."' "; - $sql .= "and user_uuid = '".$_SESSION["user"]["user_uuid"]."' "; - $db->exec(check_sql($sql)); - unset($sql); + if ($action == "update") { + $sql = "update v_contact_times "; + $sql .= "set "; + $sql .= "time_start = '".$time_start."', "; + $sql .= "time_stop = '".$time_stop."', "; + $sql .= "time_description = '".$time_description."' "; + $sql .= "where "; + $sql .= "contact_time_uuid = '".$contact_time_uuid."' "; + $sql .= "and domain_uuid = '".$domain_uuid."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; + $sql .= "and user_uuid = '".$_SESSION["user"]["user_uuid"]."' "; + $db->exec(check_sql($sql)); + unset($sql); - $_SESSION["message"] = $text['message-update']; - header("Location: contact_edit.php?id=".$contact_uuid); - return; - } //if ($action == "update") - } //if ($_POST["persistformvar"] != "true") -} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) + $_SESSION["message"] = $text['message-update']; + header("Location: contact_edit.php?id=".$contact_uuid); + return; + } //if ($action == "update") + } //if ($_POST["persistformvar"] != "true") + } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) //pre-populate the form if (count($_GET)>0 && $_POST["persistformvar"] != "true") { diff --git a/app/contacts/contact_url_edit.php b/app/contacts/contact_url_edit.php index ca0686c03a..30e39265e3 100644 --- a/app/contacts/contact_url_edit.php +++ b/app/contacts/contact_url_edit.php @@ -48,12 +48,13 @@ else { $action = "add"; } -if (strlen($_GET["contact_uuid"]) > 0) { - $contact_uuid = check_str($_GET["contact_uuid"]); -} +//get the contact uuid + if (strlen($_GET["contact_uuid"]) > 0) { + $contact_uuid = check_str($_GET["contact_uuid"]); + } //get http post variables and set them to php variables - if (count($_POST)>0) { + if (count($_POST) > 0) { $url_label = check_str($_POST["url_label"]); $url_label_custom = check_str($_POST["url_label_custom"]); $url_address = check_str($_POST["url_address"]); @@ -64,87 +65,98 @@ if (strlen($_GET["contact_uuid"]) > 0) { $url_label = ($url_label_custom != '') ? $url_label_custom : $url_label; } -if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { +//process the form data + if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { - $msg = ''; - if ($action == "update") { - $contact_url_uuid = check_str($_POST["contact_url_uuid"]); - } + //set the uuid + if ($action == "update") { + $contact_url_uuid = check_str($_POST["contact_url_uuid"]); + } - //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 "
\n"; - echo "
\n"; - echo $msg."
"; - echo "
\n"; - persistformvar($_POST); - echo "
\n"; - require_once "resources/footer.php"; - return; - } + //check for all required data + $msg = ''; + if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { + require_once "resources/header.php"; + require_once "resources/persist_form_var.php"; + echo "
\n"; + echo "
\n"; + echo $msg."
"; + echo "
\n"; + persistformvar($_POST); + echo "
\n"; + require_once "resources/footer.php"; + return; + } - //add or update the database - if ($_POST["persistformvar"] != "true") { + //add or update the database + if ($_POST["persistformvar"] != "true") { - //if primary, unmark other primary numbers - if ($url_primary) { - $sql = "update v_contact_urls set url_primary = 0 "; - $sql .= "where domain_uuid = '".$domain_uuid."' "; - $sql .= "and contact_uuid = '".$contact_uuid."' "; - $db->exec(check_sql($sql)); - unset($sql); - } + //update last modified + $sql = "update v_contacts set "; + $sql .= "last_mod_date = now(), "; + $sql .= "last_mod_user = '".$_SESSION['username']."' "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; + $db->exec(check_sql($sql)); + unset($sql); - if ($action == "add") { - $contact_url_uuid = uuid(); - $sql = "insert into v_contact_urls "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "contact_uuid, "; - $sql .= "contact_url_uuid, "; - $sql .= "url_label, "; - $sql .= "url_address, "; - $sql .= "url_primary, "; - $sql .= "url_description "; - $sql .= ")"; - $sql .= "values "; - $sql .= "("; - $sql .= "'".$_SESSION['domain_uuid']."', "; - $sql .= "'".$contact_uuid."', "; - $sql .= "'".$contact_url_uuid."', "; - $sql .= "'".$url_label."', "; - $sql .= "'".$url_address."', "; - $sql .= (($url_primary) ? 1 : 0).", "; - $sql .= "'".$url_description."' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); + //if primary, unmark other primary numbers + if ($url_primary) { + $sql = "update v_contact_urls set url_primary = 0 "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; + $db->exec(check_sql($sql)); + unset($sql); + } - $_SESSION["message"] = $text['message-add']; - header("Location: contact_edit.php?id=".$contact_uuid); - return; - } //if ($action == "add") + if ($action == "add") { + $contact_url_uuid = uuid(); + $sql = "insert into v_contact_urls "; + $sql .= "("; + $sql .= "domain_uuid, "; + $sql .= "contact_uuid, "; + $sql .= "contact_url_uuid, "; + $sql .= "url_label, "; + $sql .= "url_address, "; + $sql .= "url_primary, "; + $sql .= "url_description "; + $sql .= ")"; + $sql .= "values "; + $sql .= "("; + $sql .= "'".$_SESSION['domain_uuid']."', "; + $sql .= "'".$contact_uuid."', "; + $sql .= "'".$contact_url_uuid."', "; + $sql .= "'".$url_label."', "; + $sql .= "'".$url_address."', "; + $sql .= (($url_primary) ? 1 : 0).", "; + $sql .= "'".$url_description."' "; + $sql .= ")"; + $db->exec(check_sql($sql)); + unset($sql); - if ($action == "update") { - $sql = "update v_contact_urls set "; - $sql .= "contact_uuid = '".$contact_uuid."', "; - $sql .= "url_label = '".$url_label."', "; - $sql .= "url_address = '".$url_address."', "; - $sql .= "url_primary = ".(($url_primary) ? 1 : 0).", "; - $sql .= "url_description = '".$url_description."' "; - $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and contact_url_uuid = '".$contact_url_uuid."'"; - $db->exec(check_sql($sql)); - unset($sql); + $_SESSION["message"] = $text['message-add']; + header("Location: contact_edit.php?id=".$contact_uuid); + return; + } //if ($action == "add") - $_SESSION["message"] = $text['message-update']; - header("Location: contact_edit.php?id=".$contact_uuid); - return; - } //if ($action == "update") - } //if ($_POST["persistformvar"] != "true") -} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) + if ($action == "update") { + $sql = "update v_contact_urls set "; + $sql .= "contact_uuid = '".$contact_uuid."', "; + $sql .= "url_label = '".$url_label."', "; + $sql .= "url_address = '".$url_address."', "; + $sql .= "url_primary = ".(($url_primary) ? 1 : 0).", "; + $sql .= "url_description = '".$url_description."' "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and contact_url_uuid = '".$contact_url_uuid."'"; + $db->exec(check_sql($sql)); + unset($sql); + + $_SESSION["message"] = $text['message-update']; + header("Location: contact_edit.php?id=".$contact_uuid); + return; + } //if ($action == "update") + } //if ($_POST["persistformvar"] != "true") + } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) //pre-populate the form if (count($_GET)>0 && $_POST["persistformvar"] != "true") { diff --git a/app/contacts/contacts.php b/app/contacts/contacts.php index 0bf9eb1e9c..82ebd227d9 100644 --- a/app/contacts/contacts.php +++ b/app/contacts/contacts.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2013 + Portions created by the Initial Developer are Copyright (C) 2008-2015 the Initial Developer. All Rights Reserved. Contributor(s): @@ -55,7 +55,8 @@ else { foreach ($_SESSION['groups'] as $group_data) { $user_group_uuids[] = $group_data['group_uuid']; } - //add user's uuid to group uuid list to include private (non-shared) contacts + +//add user's uuid to group uuid list to include private (non-shared) contacts $user_group_uuids[] = $_SESSION["user_uuid"]; //get contact sync sources @@ -177,7 +178,10 @@ else { $sql .= "order by ".$order_by." ".$order." "; } else { - $sql .= "order by contact_organization desc, contact_name_given asc, contact_name_family asc "; + $sql .= "order by last_mod_date desc "; + if ($db_type == "pgsql") { + $sql .= "nulls last "; + } } $sql .= "limit ".$rows_per_page." offset ".$offset." "; $prep_statement = $db->prepare(check_sql($sql)); diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php index b22127f6cf..d6051689c1 100644 --- a/app/destinations/destination_edit.php +++ b/app/destinations/destination_edit.php @@ -214,15 +214,6 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $dialplan["dialplan_description"] = ($dialplan_description != '') ? $dialplan_description : $destination_description; $dialplan_detail_order = 10; - //add the public condition - $y = 0; - $dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid; - $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition"; - $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "context"; - $dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "public"; - $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $dialplan_detail_order; - $y++; - //increment the dialplan detail order $dialplan_detail_order = $dialplan_detail_order + 10; @@ -369,7 +360,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (!permission_exists('destination_domain')) { $sql .= "and domain_uuid = '".$domain_uuid."' "; } - echo $sql."

"; + //echo $sql."

"; $db->exec(check_sql($sql)); unset($sql); } @@ -552,7 +543,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo " if (document.getElementById('tr_caller_id_name')) { document.getElementById('tr_caller_id_name').style.display = 'none'; }\n"; echo " if (document.getElementById('tr_caller_id_number')) { document.getElementById('tr_caller_id_number').style.display = 'none'; }\n"; echo " document.getElementById('tr_actions').style.display = 'none';\n"; - echo " document.getElementById('tr_fax_detection').style.display = 'none';\n"; + echo " if (document.getElementById('tr_fax_detection')) { document.getElementById('tr_fax_detection').style.display = 'none'; }\n"; echo " document.getElementById('tr_cid_name_prefix').style.display = 'none';\n"; echo " if (document.getElementById('tr_sell')) { document.getElementById('tr_sell').style.display = 'none'; }\n"; echo " if (document.getElementById('tr_buy')) { document.getElementById('tr_buy').style.display = 'none'; }\n"; @@ -564,7 +555,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo " if (document.getElementById('tr_caller_id_name')) { document.getElementById('tr_caller_id_name').style.display = ''; }\n"; echo " if (document.getElementById('tr_caller_id_number')) { document.getElementById('tr_caller_id_number').style.display = ''; }\n"; echo " document.getElementById('tr_actions').style.display = '';\n"; - echo " document.getElementById('tr_fax_detection').style.display = '';\n"; + echo " if (document.getElementById('tr_fax_detection')) { document.getElementById('tr_fax_detection').style.display = ''; }\n"; echo " document.getElementById('tr_cid_name_prefix').style.display = '';\n"; echo " if (document.getElementById('tr_sell')) { document.getElementById('tr_sell').style.display = ''; }\n"; echo " if (document.getElementById('tr_buy')) { document.getElementById('tr_buy').style.display = ''; }\n"; diff --git a/app/destinations/destinations.php b/app/destinations/destinations.php index 79384d6794..a8b6e99cf5 100644 --- a/app/destinations/destinations.php +++ b/app/destinations/destinations.php @@ -50,10 +50,80 @@ else { $document['title'] = $text['title-destinations']; require_once "resources/paging.php"; +//get total destination count from the database + $sql = "select count(*) as num_rows from v_destinations "; + if ($_GET['showall'] && permission_exists('destination_all')) { + if (strlen($search) > 0) { + $sql .= "where "; + } + } else { + $sql .= "where domain_uuid = '".$domain_uuid."' "; + if (strlen($search) > 0) { + $sql .= "and "; + } + } + if (strlen($search) > 0) { + $sql .= "("; + $sql .= " destination_type like '%".$search."%' "; + $sql .= " or destination_number like '%".$search."%' "; + $sql .= " or destination_context like '%".$search."%' "; + $sql .= " or destination_enabled like '%".$search."%' "; + $sql .= " or destination_description like '%".$search."%' "; + $sql .= ") "; + } + $prep_statement = $db->prepare($sql); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + $num_rows = $row['num_rows']; + } + else { + $num_rows = 0; + } + +//prepare to page the results + $rows_per_page = 150; + $param = "&search=".$search; + if ($_GET['showall'] && permission_exists('destination_all')) { + $param .= "&showall=true"; + } + $page = $_GET['page']; + if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } + list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page); + $offset = $rows_per_page * $page; + +//get the list + $sql = "select * from v_destinations "; + if ($_GET['showall'] && permission_exists('destination_all')) { + if (strlen($search) > 0) { + $sql .= " where "; + } + } else { + $sql .= "where domain_uuid = '$domain_uuid' "; + if (strlen($search) > 0) { + $sql .= " and "; + } + } + if (strlen($search) > 0) { + $sql .= " ("; + $sql .= " destination_type like '%".$search."%' "; + $sql .= " or destination_number like '%".$search."%' "; + $sql .= " or destination_context like '%".$search."%' "; + $sql .= " or destination_enabled like '%".$search."%' "; + $sql .= " or destination_description like '%".$search."%' "; + $sql .= ") "; + } + if (strlen($order_by) > 0) { $sql .= "order by $order_by $order "; } + $sql .= "limit $rows_per_page offset $offset "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $destinations = $prep_statement->fetchAll(); + unset ($prep_statement, $sql); + //show the content echo "\n"; echo " \n"; - echo " \n"; + echo " \n"; echo " \n"; echo " \n"; echo "
".$text['header-destinations']."".$text['header-destinations']." (".$num_rows.")
\n"; if (permission_exists('destination_all')) { @@ -76,77 +146,6 @@ else { echo "
\n"; - //get total destination count from the database - $sql = "select count(*) as num_rows from v_destinations "; - if ($_GET['showall'] && permission_exists('destination_all')) { - if (strlen($search) > 0) { - $sql .= "where "; - } - } else { - $sql .= "where domain_uuid = '".$domain_uuid."' "; - if (strlen($search) > 0) { - $sql .= "and "; - } - } - if (strlen($search) > 0) { - $sql .= "("; - $sql .= " destination_type like '%".$search."%' "; - $sql .= " or destination_number like '%".$search."%' "; - $sql .= " or destination_context like '%".$search."%' "; - $sql .= " or destination_enabled like '%".$search."%' "; - $sql .= " or destination_description like '%".$search."%' "; - $sql .= ") "; - } - $prep_statement = $db->prepare($sql); - if ($prep_statement) { - $prep_statement->execute(); - $row = $prep_statement->fetch(PDO::FETCH_ASSOC); - $total_destinations = $row['num_rows']; - } - else { - $num_rows = 0; - } - - //prepare to page the results - $rows_per_page = 150; - $param = "&search=".$search; - if ($_GET['showall'] && permission_exists('destination_all')) { - $param .= "&showall=true"; - } - $page = $_GET['page']; - if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } - list($paging_controls, $rows_per_page, $var3) = paging($total_destinations, $param, $rows_per_page); - $offset = $rows_per_page * $page; - - //get the list - $sql = "select * from v_destinations "; - if ($_GET['showall'] && permission_exists('destination_all')) { - if (strlen($search) > 0) { - $sql .= " where "; - } - } else { - $sql .= "where domain_uuid = '$domain_uuid' "; - if (strlen($search) > 0) { - $sql .= " and "; - } - } - if (strlen($search) > 0) { - $sql .= " ("; - $sql .= " destination_type like '%".$search."%' "; - $sql .= " or destination_number like '%".$search."%' "; - $sql .= " or destination_context like '%".$search."%' "; - $sql .= " or destination_enabled like '%".$search."%' "; - $sql .= " or destination_description like '%".$search."%' "; - $sql .= ") "; - } - if (strlen($order_by) > 0) { $sql .= "order by $order_by $order "; } - $sql .= "limit $rows_per_page offset $offset "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - $destination = $prep_statement->fetchAll(); - $destination_count = count($destination); - unset ($prep_statement, $sql); - $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; @@ -163,15 +162,15 @@ else { echo th_order_by('destination_description', $text['label-destination_description'], $order_by, $order, '', '', $param); echo ""; if (permission_exists('destination_add')) { - if ($_SESSION['limit']['destinations']['numeric'] == '' || ($_SESSION['limit']['destinations']['numeric'] != '' && $total_destinations < $_SESSION['limit']['destinations']['numeric'])) { + if ($_SESSION['limit']['destinations']['numeric'] == '' || ($_SESSION['limit']['destinations']['numeric'] != '' && $num_rows < $_SESSION['limit']['destinations']['numeric'])) { echo "".$v_link_label_add.""; } } echo "\n"; echo "\n"; - if ($destination_count > 0) { - foreach($destination as $row) { + if ($num_rows > 0) { + foreach($destinations as $row) { $tr_link = "href='destination_edit.php?id=".$row['destination_uuid']."'"; echo "\n"; if ($_GET['showall'] && permission_exists('destination_all')) { @@ -193,7 +192,7 @@ else { echo "\n"; if ($c==0) { $c=1; } else { $c=0; } } //end foreach - unset($sql, $destination, $row_count); + unset($sql, $destinations, $row_count); } //end if results echo "\n"; @@ -204,7 +203,7 @@ else { echo "\n"; } if (permission_exists('destination_add')) { - if ($_SESSION['limit']['destinations']['numeric'] == '' || ($_SESSION['limit']['destinations']['numeric'] != '' && $total_destinations < $_SESSION['limit']['destinations']['numeric'])) { + if ($_SESSION['limit']['destinations']['numeric'] == '' || ($_SESSION['limit']['destinations']['numeric'] != '' && $num_rows < $_SESSION['limit']['destinations']['numeric'])) { echo "".$v_link_label_add.""; } } diff --git a/app/devices/app_config.php b/app/devices/app_config.php index d8f6591886..6f3f3cfaac 100644 --- a/app/devices/app_config.php +++ b/app/devices/app_config.php @@ -39,6 +39,18 @@ $apps[$x]['permissions'][$y]['groups'][] = "admin"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $y++; + $apps[$x]['permissions'][$y]['name'] = 'device_mac_address'; + $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + $apps[$x]['permissions'][$y]['groups'][] = 'admin'; + $y++; + $apps[$x]['permissions'][$y]['name'] = 'device_label'; + $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + $apps[$x]['permissions'][$y]['groups'][] = 'admin'; + $y++; + $apps[$x]['permissions'][$y]['name'] = 'device_template'; + $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + $apps[$x]['permissions'][$y]['groups'][] = 'admin'; + $y++; $apps[$x]['permissions'][$y]['name'] = "device_extension_view"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $apps[$x]['permissions'][$y]['groups'][] = "admin"; @@ -105,6 +117,15 @@ $y++; $apps[$x]['permissions'][$y]['name'] = 'device_domain'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + $apps[$x]['permissions'][$y]['groups'][] = 'admin'; + $y++; + $apps[$x]['permissions'][$y]['name'] = 'device_username_password'; + $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + $apps[$x]['permissions'][$y]['groups'][] = 'admin'; + $y++; + $apps[$x]['permissions'][$y]['name'] = 'device_alternate'; + $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + $apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = "device_profile_view"; $apps[$x]['permissions'][$y]['groups'][] = "admin"; @@ -127,6 +148,25 @@ $y++; $apps[$x]['permissions'][$y]['name'] = 'device_all'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + $y++; + $apps[$x]['permissions'][$y]['name'] = 'device_vendor'; + $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + $apps[$x]['permissions'][$y]['groups'][] = 'admin'; + $y++; + $apps[$x]['permissions'][$y]['name'] = 'device_model'; + $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + $y++; + $apps[$x]['permissions'][$y]['name'] = 'device_firmware'; + $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + $y++; + $apps[$x]['permissions'][$y]['name'] = 'device_enable'; + $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + $apps[$x]['permissions'][$y]['groups'][] = 'admin'; + $y++; + $apps[$x]['permissions'][$y]['name'] = 'device_description'; + $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + $apps[$x]['permissions'][$y]['groups'][] = 'admin'; + $y++; //schema details $y = 0; //table array index diff --git a/app/devices/app_languages.php b/app/devices/app_languages.php index 75ecf92aa3..577792fd96 100644 --- a/app/devices/app_languages.php +++ b/app/devices/app_languages.php @@ -1690,7 +1690,7 @@ $text['label-blf']['ar-eg'] = ""; $text['label-blf']['he'] = ""; $text['label-callers']['en-us'] = "Callers"; -$text['label-callers']['es-cl'] = "Llaamadas"; +$text['label-callers']['es-cl'] = "Llamadas"; $text['label-callers']['pt-pt'] = ""; $text['label-callers']['fr-fr'] = ""; $text['label-callers']['pt-br'] = ""; diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php index cc2f8ddcb7..af2231ef23 100644 --- a/app/devices/device_edit.php +++ b/app/devices/device_edit.php @@ -128,10 +128,25 @@ require_once "resources/require.php"; //get http post variables and set them to php variables if (count($_POST) > 0) { + //device mac address + if (permission_exists('device_mac_address')) { + $device_mac_address = check_str($_POST["device_mac_address"]); + $device_mac_address = strtolower(preg_replace('#[^a-fA-F0-9./]#', '', $device_mac_address)); + $_POST["device_mac_address"] = $device_mac_address; + } + else { + $orm = new orm; + $orm->name('devices'); + $orm->uuid($device_uuid); + $result = $orm->find()->get(); + //$message = $orm->message; + foreach ($result as &$row) { + $device_mac_address = $row["device_mac_address"]; + $_POST["device_mac_address"] = $device_mac_address; + } + unset ($prep_statement); + } //devices - $device_mac_address = check_str($_POST["device_mac_address"]); - $device_mac_address = strtolower(preg_replace('#[^a-fA-F0-9./]#', '', $device_mac_address)); - $_POST["device_mac_address"] = $device_mac_address; $device_label = check_str($_POST["device_label"]); $device_vendor = check_str($_POST["device_vendor"]); $device_uuid_alternate = check_str($_POST["device_uuid_alternate"]); @@ -217,6 +232,7 @@ require_once "resources/require.php"; //array cleanup $x = 0; + //unset($_POST["autocomplete"]); foreach ($_POST["device_lines"] as $row) { //unset the empty row if (strlen($row["line_number"]) == 0) { @@ -287,7 +303,7 @@ require_once "resources/require.php"; } //write the provision files - if (strlen($_SESSION['switch']['provision']['dir']) > 0) { + if (strlen($_SESSION['provision']['path']['text']) > 0) { require_once "app/provision/provision_write.php"; } @@ -502,6 +518,7 @@ require_once "resources/require.php"; \n"; + //echo ""; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + if (permission_exists('device_line_view')) { + echo " "; + echo " "; + echo " "; - echo " "; - if (permission_exists('device_key_add') || permission_exists('device_key_edit')) { + if (permission_exists('device_profile_edit')) { //device profile $sql = "select * from v_device_profiles "; $sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) "; @@ -733,7 +769,9 @@ require_once "resources/require.php"; echo " "; echo " "; } + } + if (permission_exists('device_key_edit')) { $vendor_count = 0; foreach($device_keys as $row) { if ($previous_vendor != $row['device_key_vendor']) { @@ -1060,7 +1098,7 @@ require_once "resources/require.php"; } //device settings - if (permission_exists('device_setting_add')) { + if (permission_exists('device_setting_edit')) { echo " "; echo " "; echo " \n"; } - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; } - else { - $label = $device_alternate[0]['device_label']; - if (strlen($label) == 0) { $label = $device_alternate[0]['device_description']; } - if (strlen($label) == 0) { $label = $device_alternate[0]['device_mac_address']; } - echo "
"; @@ -512,7 +529,7 @@ require_once "resources/require.php"; echo "\n"; echo " \n"; - if ($action != "add") { + if (permission_exists('device_add') && $action != "add") { echo " \n"; } echo " \n"; @@ -524,192 +541,211 @@ require_once "resources/require.php"; echo " ".$text['label-device_mac_address']."\n"; echo "\n"; - echo " \n"; + if (permission_exists('device_mac_address')) { + echo " \n"; + echo "
\n"; + echo $text['description-device_mac_address']."\n"; + } + else { + echo $device_mac_address; + } echo " \n"; - echo "
\n"; - echo $text['description-device_mac_address']."\n"; echo "
\n"; echo " ".$text['label-device_label']."\n"; echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-device_label']."\n"; + if (permission_exists('device_label')) { + echo " \n"; + echo "
\n"; + echo $text['description-device_label']."\n"; + } + else { + echo $device_label; + } + echo "
\n"; - echo " ".$text['label-device_template']."\n"; - echo "\n"; - $device = new device; - $template_dir = $device->get_template_dir(); + if (permission_exists('device_template')) { + echo "
\n"; + echo " ".$text['label-device_template']."\n"; + echo "\n"; + $device = new device; + $template_dir = $device->get_template_dir(); - echo "\n"; + echo "\n"; - if ($dh = opendir($template_dir)) { - while($dir = readdir($dh)) { - if($file != "." && $dir != ".." && $dir[0] != '.') { - if(is_dir($template_dir . "/" . $dir)) { - echo ""; - if($dh_sub = opendir($template_dir.'/'.$dir)) { - while($dir_sub = readdir($dh_sub)) { - if($file_sub != '.' && $dir_sub != '..' && $dir_sub[0] != '.') { - if(is_dir($template_dir . '/' . $dir .'/'. $dir_sub)) { - if ($device_template == $dir."/".$dir_sub) { - echo "\n"; - } - else { - echo "\n"; + if (is_dir($template_dir)) { + $templates = scandir($template_dir); + foreach($templates as $dir) { + if($file != "." && $dir != ".." && $dir[0] != '.') { + if(is_dir($template_dir . "/" . $dir)) { + echo ""; + $dh_sub=$template_dir . "/" . $dir; + if(is_dir($dh_sub)) { + $templates_sub = scandir($dh_sub); + foreach($templates_sub as $dir_sub) { + if($file_sub != '.' && $dir_sub != '..' && $dir_sub[0] != '.') { + if(is_dir($template_dir . '/' . $dir .'/'. $dir_sub)) { + if ($device_template == $dir."/".$dir_sub) { + echo "\n"; + } + else { + echo "\n"; + } + } } } + closedir($dh_sub); } + echo ""; } - closedir($dh_sub); } - echo ""; + } + closedir($dh); + } + echo "\n"; + echo "
\n"; + echo $text['description-device_template']."\n"; + echo "
".$text['label-lines'].""; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if (permission_exists('device_line_password')) { + echo " \n"; + } + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + + $x = 0; + foreach($device_lines as $row) { + //determine whether to hide the element + if (strlen($device_line_uuid) == 0) { + $element['hidden'] = false; + $element['visibility'] = "visibility:visible;"; + } + else { + $element['hidden'] = true; + $element['visibility'] = "visibility:hidden;"; + } + //add the primary key uuid + if (strlen($row['device_line_uuid']) > 0) { + echo " \n"; + } + //show each row in the array + echo " \n"; + echo " \n"; + + echo " \n"; + + echo " \n"; + + echo " \n"; + + echo " \n"; + + echo " \n"; + + if (permission_exists('device_line_password')) { + echo " \n"; + } + + echo " \n"; + + echo " \n"; + + echo " \n"; + + echo " \n"; + + echo " \n"; + echo " \n"; + $x++; } - closedir($dh); - } - echo "\n"; - echo "
\n"; - echo $text['description-device_template']."\n"; - echo "\n"; - echo "\n"; - - echo " "; - echo " "; - echo " \n"; - echo " \n"; - $x++; + echo " "; + echo " "; } - echo "
".$text['label-line']."".$text['label-server_address']."".$text['label-outbound_proxy']."".$text['label-display_name']."".$text['label-user_id']."".$text['label-auth_id']."".$text['label-password']."".$text['label-sip_port']."".$text['label-sip_transport']."".$text['label-register_expires']."".$text['label-enabled']." 
\n"; + $selected = "selected=\"selected\" "; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + if (strlen($row['device_line_uuid']) > 0) { + if (permission_exists('device_delete')) { + echo " $v_link_label_delete\n"; } } + echo "
".$text['label-lines'].""; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - if (permission_exists('device_line_password')) { - echo " \n"; - } - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - - $x = 0; - foreach($device_lines as $row) { - //determine whether to hide the element - if (strlen($device_line_uuid) == 0) { - $element['hidden'] = false; - $element['visibility'] = "visibility:visible;"; - } - else { - $element['hidden'] = true; - $element['visibility'] = "visibility:hidden;"; - } - //add the primary key uuid - if (strlen($row['device_line_uuid']) > 0) { - echo " \n"; - } - //show each row in the array - echo " \n"; - echo " \n"; - - echo " \n"; - - echo " \n"; - - echo " \n"; - - echo " \n"; - - echo " \n"; - - if (permission_exists('device_line_password')) { - echo " \n"; - } - - echo " \n"; - - echo " \n"; - - echo " \n"; - - echo " \n"; - - echo "
".$text['label-line']."".$text['label-server_address']."".$text['label-outbound_proxy']."".$text['label-display_name']."".$text['label-user_id']."".$text['label-auth_id']."".$text['label-password']."".$text['label-sip_port']."".$text['label-sip_transport']."".$text['label-register_expires']."".$text['label-enabled']." 
\n"; - $selected = "selected=\"selected\" "; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - if (strlen($row['device_line_uuid']) > 0) { - if (permission_exists('device_delete')) { - echo " $v_link_label_delete\n"; - } + echo "
\n"; + if (strlen($text['description-lines']) > 0) { + echo "
".$text['description-lines']."\n"; } - echo "
\n"; - if (strlen($text['description-lines']) > 0) { - echo "
".$text['description-lines']."\n"; - } - echo "
".$text['label-settings'].""; @@ -1148,75 +1186,85 @@ require_once "resources/require.php"; echo "
\n"; - echo " ".$text['label-device']."\n"; - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
\n"; - echo $text['description-device']."\n"; - echo "
\n"; - echo " ".$text['label-device_uuid_alternate']."\n"; - echo "\n"; - if (strlen($device_uuid_alternate) == 0) { - echo " "; + if (permission_exists('device_username_password')) { + echo "
\n"; + echo " ".$text['label-device']."\n"; + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo $text['description-device']."\n"; + echo "
\n"; - echo " \n"; - echo " "; - echo " \n"; - echo " \n"; - echo "
$label $v_link_label_delete
\n"; - unset($label); + + if (permission_exists('device_alternate')) { + echo "\n"; + echo "\n"; + echo " ".$text['label-device_uuid_alternate']."\n"; + echo "\n"; + echo "\n"; + if (strlen($device_uuid_alternate) == 0) { + echo " "; + } + else { + $label = $device_alternate[0]['device_label']; + if (strlen($label) == 0) { $label = $device_alternate[0]['device_description']; } + if (strlen($label) == 0) { $label = $device_alternate[0]['device_mac_address']; } + echo " \n"; + echo " \n"; + echo " "; + echo " \n"; + echo " \n"; + echo "
$label $v_link_label_delete
\n"; + unset($label); + } + echo $text['description-device_uuid_alternate']."\n"; + echo "\n"; + echo "\n"; } - echo $text['description-device_uuid_alternate']."\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo " ".$text['label-device_vendor']."\n"; - echo "\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-device_vendor']."\n"; - echo "\n"; - echo "\n"; + if (permission_exists('device_vendor')) { + echo "\n"; + echo "\n"; + echo " ".$text['label-device_vendor']."\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-device_vendor']."\n"; + echo "\n"; + echo "\n"; + } - echo "\n"; - echo "\n"; - echo " ".$text['label-device_model']."\n"; - echo "\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-device_model']."\n"; - echo "\n"; - echo "\n"; + if (permission_exists('device_model')) { + echo "\n"; + echo "\n"; + echo " ".$text['label-device_model']."\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-device_model']."\n"; + echo "\n"; + echo "\n"; + } - echo "\n"; - echo "\n"; - echo " ".$text['label-device_firmware_version']."\n"; - echo "\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-device_firmware_version']."\n"; - echo "\n"; - echo "\n"; + if (permission_exists('device_firmware')) { + echo "\n"; + echo "\n"; + echo " ".$text['label-device_firmware_version']."\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-device_firmware_version']."\n"; + echo "\n"; + echo "\n"; + } if (permission_exists('device_domain')) { echo "\n"; @@ -1248,38 +1296,46 @@ require_once "resources/require.php"; echo " \n"; } - echo "\n"; - echo "\n"; - echo " ".$text['label-device_provision_enable']."\n"; - echo "\n"; - echo "\n"; - echo " \n"; + if ($device_provision_enable == "true" || strlen($device_provision_enable) == 0) { + echo " \n"; + } + else { + echo " \n"; + } + if ($device_provision_enable == "false") { + echo " \n"; + } + else { + echo " \n"; + } + echo " \n"; + echo "
\n"; + echo $text['description-device_provision_enable']."\n"; + echo "\n"; + echo "\n"; } - else { - echo " \n"; - } - if ($device_provision_enable == "false") { - echo " \n"; - } - else { - echo " \n"; - } - echo " \n"; - echo "
\n"; - echo $text['description-device_provision_enable']."\n"; - echo "\n"; - echo "\n"; echo "\n"; echo "\n"; echo " ".$text['label-device_description']."\n"; echo "\n"; echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-device_description']."\n"; + if (permission_exists('device_description')) { + echo " \n"; + echo "
\n"; + echo $text['description-device_description']."\n"; + } + else { + echo $device_description."\n"; + } + echo "\n"; echo "\n"; echo " \n"; diff --git a/app/devices/device_profile_edit.php b/app/devices/device_profile_edit.php index 092fa5e6eb..db58b6063a 100644 --- a/app/devices/device_profile_edit.php +++ b/app/devices/device_profile_edit.php @@ -138,7 +138,7 @@ require_once "resources/require.php"; } //write the provision files - if (strlen($_SESSION['switch']['provision']['dir']) > 0) { + if (strlen($_SESSION['provision']['path']['text']) > 0) { require_once "app/provision/provision_write.php"; } diff --git a/app/devices/devices.php b/app/devices/devices.php index 264a9d1464..cc466bc5b8 100644 --- a/app/devices/devices.php +++ b/app/devices/devices.php @@ -33,6 +33,10 @@ else { exit; } +//additional includes + require_once "resources/header.php"; + require_once "resources/paging.php"; + //add multi-lingual support $language = new text; $text = $language->get(); @@ -44,15 +48,116 @@ else { $order = check_str($_GET["order"]); } -//additional includes - require_once "resources/header.php"; - require_once "resources/paging.php"; +//get total devices count from the database + $sql = "select count(*) as num_rows from v_devices where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $prep_statement = $db->prepare($sql); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + $total_devices = $row['num_rows']; + } + unset($sql, $prep_statement, $row); + +//prepare to page the results + $sql = "select count(*) as num_rows from v_devices as d "; + if ($_GET['showall'] && permission_exists('device_all')) { + if (strlen($search) > 0) { + $sql .= "where "; + } + } else { + $sql .= "where ("; + $sql .= " d.domain_uuid = '$domain_uuid' "; + if (permission_exists('device_all')) { + $sql .= " or d.domain_uuid is null "; + } + $sql .= ") "; + if (strlen($search) > 0) { + $sql .= "and "; + } + } + if (strlen($search) > 0) { + $sql .= "("; + $sql .= " d.device_mac_address like '%".$search."%' "; + $sql .= " or d.device_label like '%".$search."%' "; + $sql .= " or d.device_vendor like '%".$search."%' "; + $sql .= " or d.device_provision_enable like '%".$search."%' "; + $sql .= " or d.device_template like '%".$search."%' "; + $sql .= " or d.device_description like '%".$search."%' "; + $sql .= ") "; + } + $prep_statement = $db->prepare($sql); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + if ($row['num_rows'] > 0) { + $num_rows = $row['num_rows']; + } + else { + $num_rows = '0'; + } + } + +//prepare to page the results + $rows_per_page = 150; + $param = ""; + $page = $_GET['page']; + if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } + list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page); + $offset = $rows_per_page * $page; + +//get the list + $sql = "select d.*, d2.device_label as alternate_label "; + $sql .= "from v_devices as d, v_devices as d2 "; + $sql .= "where ( "; + $sql .= " d.device_uuid_alternate = d2.device_uuid "; + $sql .= " or d.device_uuid_alternate is null and d.device_uuid = d2.device_uuid "; + $sql .= ") "; + if ($_GET['showall'] && permission_exists('device_all')) { + //echo __line__."
\n"; + } else { + $sql .= "and ("; + $sql .= " d.domain_uuid = '$domain_uuid' "; + if (permission_exists('device_all')) { + $sql .= " or d.domain_uuid is null "; + } + $sql .= ") "; + } + if (strlen($search) > 0) { + $sql .= "and ("; + $sql .= " d.device_mac_address like '%".$search."%' "; + $sql .= " or d.device_label like '%".$search."%' "; + $sql .= " or d.device_vendor like '%".$search."%' "; + $sql .= " or d.device_provision_enable like '%".$search."%' "; + $sql .= " or d.device_template like '%".$search."%' "; + $sql .= " or d.device_description like '%".$search."%' "; + $sql .= ") "; + } + if (strlen($order_by) == 0) { + $sql .= "order by d.device_label, d.device_description asc "; + } + else { + $sql .= "order by $order_by $order "; + } + $sql .= "limit $rows_per_page offset $offset "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $devices = $prep_statement->fetchAll(PDO::FETCH_NAMED); + unset ($prep_statement, $sql); + +//alternate_found + $device_alternate = false; + foreach($devices as $row) { + if (strlen($row['device_uuid_alternate']) > 0) { + $device_alternate = true; + break; + } + } //show the content echo "\n"; echo " \n"; echo " \n"; @@ -77,114 +182,10 @@ else { echo "
"; - echo " ".$text['header-devices'].""; + echo " ".$text['header-devices']." (".$num_rows.")"; echo "

"; echo " ".$text['description-devices']; echo "
\n"; echo "
"; - //get total devices count from the database - $sql = "select count(*) as num_rows from v_devices where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $prep_statement = $db->prepare($sql); - if ($prep_statement) { - $prep_statement->execute(); - $row = $prep_statement->fetch(PDO::FETCH_ASSOC); - $total_devices = $row['num_rows']; - } - unset($sql, $prep_statement, $row); - - //prepare to page the results - $sql = "select count(*) as num_rows from v_devices as d "; - if ($_GET['showall'] && permission_exists('device_all')) { - if (strlen($search) > 0) { - $sql .= "where "; - } - } else { - $sql .= "where ("; - $sql .= " d.domain_uuid = '$domain_uuid' "; - if (permission_exists('device_all')) { - $sql .= " or d.domain_uuid is null "; - } - $sql .= ") "; - if (strlen($search) > 0) { - $sql .= "and "; - } - } - if (strlen($search) > 0) { - $sql .= "("; - $sql .= " d.device_mac_address like '%".$search."%' "; - $sql .= " or d.device_label like '%".$search."%' "; - $sql .= " or d.device_vendor like '%".$search."%' "; - $sql .= " or d.device_provision_enable like '%".$search."%' "; - $sql .= " or d.device_template like '%".$search."%' "; - $sql .= " or d.device_description like '%".$search."%' "; - $sql .= ") "; - } - $prep_statement = $db->prepare($sql); - if ($prep_statement) { - $prep_statement->execute(); - $row = $prep_statement->fetch(PDO::FETCH_ASSOC); - if ($row['num_rows'] > 0) { - $num_rows = $row['num_rows']; - } - else { - $num_rows = '0'; - } - } - - //prepare to page the results - $rows_per_page = 150; - $param = ""; - $page = $_GET['page']; - if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } - list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page); - $offset = $rows_per_page * $page; - - //get the list - $sql = "select d.*, d2.device_label as alternate_label "; - $sql .= "from v_devices as d, v_devices as d2 "; - $sql .= "where ( "; - $sql .= " d.device_uuid_alternate = d2.device_uuid "; - $sql .= " or d.device_uuid_alternate is null and d.device_uuid = d2.device_uuid "; - $sql .= ") "; - if ($_GET['showall'] && permission_exists('device_all')) { - //echo __line__."
\n"; - } else { - $sql .= "and ("; - $sql .= " d.domain_uuid = '$domain_uuid' "; - if (permission_exists('device_all')) { - $sql .= " or d.domain_uuid is null "; - } - $sql .= ") "; - } - if (strlen($search) > 0) { - $sql .= "and ("; - $sql .= " d.device_mac_address like '%".$search."%' "; - $sql .= " or d.device_label like '%".$search."%' "; - $sql .= " or d.device_vendor like '%".$search."%' "; - $sql .= " or d.device_provision_enable like '%".$search."%' "; - $sql .= " or d.device_template like '%".$search."%' "; - $sql .= " or d.device_description like '%".$search."%' "; - $sql .= ") "; - } - if (strlen($order_by) == 0) { - $sql .= "order by d.device_label, d.device_description asc "; - } - else { - $sql .= "order by $order_by $order "; - } - $sql .= "limit $rows_per_page offset $offset "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - $devices = $prep_statement->fetchAll(PDO::FETCH_NAMED); - unset ($prep_statement, $sql); - $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; - //alternate_found - $device_alternate = false; - foreach($devices as $row) { - if (strlen($row['device_uuid_alternate']) > 0) { - $device_alternate = true; - break; - } - } echo "\n"; echo "\n"; if ($_GET['showall'] && permission_exists('device_all')) { diff --git a/app/dialplan/dialplan_edit.php b/app/dialplan/dialplan_edit.php index 9531b7d0cd..68ec9b3b1b 100644 --- a/app/dialplan/dialplan_edit.php +++ b/app/dialplan/dialplan_edit.php @@ -58,9 +58,7 @@ else { else { $action = "add"; } - -//get the app uuid - if (is_uuid($_REQUEST["app_uuid"])) { + if (strlen($_REQUEST["app_uuid"]) > 0) { $app_uuid = $_REQUEST["app_uuid"]; } diff --git a/app/dialplan/resources/switch/conf/dialplan/040_call_block.xml b/app/dialplan/resources/switch/conf/dialplan/040_call_block.xml index 2f76cf98b6..dfa876b8c8 100644 --- a/app/dialplan/resources/switch/conf/dialplan/040_call_block.xml +++ b/app/dialplan/resources/switch/conf/dialplan/040_call_block.xml @@ -1,7 +1,7 @@ - - + + \ No newline at end of file diff --git a/app/dialplan/resources/switch/conf/dialplan/240_page.xml b/app/dialplan/resources/switch/conf/dialplan/240_page.xml index 0c080a2213..6a48aa368f 100644 --- a/app/dialplan/resources/switch/conf/dialplan/240_page.xml +++ b/app/dialplan/resources/switch/conf/dialplan/240_page.xml @@ -4,8 +4,9 @@ - + + diff --git a/app/dialplan/resources/switch/conf/dialplan/250_page-extension.xml b/app/dialplan/resources/switch/conf/dialplan/250_page-extension.xml index ef0ee75364..f604b2632a 100644 --- a/app/dialplan/resources/switch/conf/dialplan/250_page-extension.xml +++ b/app/dialplan/resources/switch/conf/dialplan/250_page-extension.xml @@ -1,7 +1,7 @@ - + diff --git a/app/dialplan_inbound/dialplan_inbound_add.php b/app/dialplan_inbound/dialplan_inbound_add.php index 77b8100e8a..25dbfb37fd 100644 --- a/app/dialplan_inbound/dialplan_inbound_add.php +++ b/app/dialplan_inbound/dialplan_inbound_add.php @@ -184,33 +184,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $db->exec(check_sql($sql)); unset($sql); - //add condition public context - $dialplan_detail_uuid = uuid(); - $sql = "insert into v_dialplan_details "; - $sql .= "("; - $sql .= "domain_uuid, "; - $sql .= "dialplan_uuid, "; - $sql .= "dialplan_detail_uuid, "; - $sql .= "dialplan_detail_tag, "; - $sql .= "dialplan_detail_type, "; - $sql .= "dialplan_detail_data, "; - $sql .= "dialplan_detail_group, "; - $sql .= "dialplan_detail_order "; - $sql .= ") "; - $sql .= "values "; - $sql .= "("; - $sql .= "'$domain_uuid', "; - $sql .= "'$dialplan_uuid', "; - $sql .= "'$dialplan_detail_uuid', "; - $sql .= "'condition', "; - $sql .= "'context', "; - $sql .= "'public', "; - $sql .= "'0', "; - $sql .= "'10' "; - $sql .= ")"; - $db->exec(check_sql($sql)); - unset($sql); - //add condition 1 $dialplan_detail_uuid = uuid(); $sql = "insert into v_dialplan_details "; diff --git a/app/dialplan_outbound/app_config.php b/app/dialplan_outbound/app_config.php index d6809327f9..86d4512543 100644 --- a/app/dialplan_outbound/app_config.php +++ b/app/dialplan_outbound/app_config.php @@ -41,4 +41,6 @@ $apps[$x]['permissions'][5]['groups'][] = "superadmin"; $apps[$x]['permissions'][5]['description'] = "Add outbound routes for any gateways on any domain."; + $apps[$x]['permissions'][6]['name'] = "outbound_route_toll_allow_lua"; + ?> \ No newline at end of file diff --git a/app/dialplan_outbound/dialplan_outbound_add.php b/app/dialplan_outbound/dialplan_outbound_add.php index 5029f7f899..7a9c4a48e1 100644 --- a/app/dialplan_outbound/dialplan_outbound_add.php +++ b/app/dialplan_outbound/dialplan_outbound_add.php @@ -937,19 +937,21 @@ function type_onchange(dialplan_detail_type) { echo "\n"; echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; + if (permission_exists('outbound_route_toll_allow_lua')) { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } echo "\n"; echo "\n"; - echo " \n"; - echo " \n"; - echo "
\n"; - echo " ".$text['label-toll_allow']."\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-enable-toll_allow']."\n"; - echo "
\n"; + echo " ".$text['label-toll_allow']."\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-enable-toll_allow']."\n"; + echo "
\n"; diff --git a/app/extensions/app_config.php b/app/extensions/app_config.php index e66d930253..77a68de9ea 100644 --- a/app/extensions/app_config.php +++ b/app/extensions/app_config.php @@ -118,6 +118,9 @@ $apps[$x]['permissions'][$y]['name'] = "extension_user_context"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $y++; + $apps[$x]['permissions'][$y]['name'] = "extension_absolute_codec_string"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + $y++; //schema details $y = 0; //table array index @@ -384,6 +387,14 @@ $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "absolute_codec_string"; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + + $y = 1; //table array index $z = 0; //field array index diff --git a/app/extensions/app_languages.php b/app/extensions/app_languages.php index 7f16108a30..d70072975a 100644 --- a/app/extensions/app_languages.php +++ b/app/extensions/app_languages.php @@ -468,6 +468,19 @@ $text['label-sip_bypass_media']['ro'] = "SIP Bypass Media"; $text['label-sip_bypass_media']['ar-eg'] = ""; $text['label-sip_bypass_media']['he'] = ""; +$text['label-absolute_codec_string']['en-us'] = "Absolute Codec String"; +$text['label-absolute_codec_string']['es-cl'] = ""; +$text['label-absolute_codec_string']['pt-pt'] = ""; +$text['label-absolute_codec_string']['fr-fr'] = ""; +$text['label-absolute_codec_string']['pt-br'] = ""; +$text['label-absolute_codec_string']['pl'] = ""; +$text['label-absolute_codec_string']['uk'] = ""; +$text['label-absolute_codec_string']['sv-se'] = ""; +$text['label-absolute_codec_string']['de-at'] = ""; +$text['label-absolute_codec_string']['ro'] = ""; +$text['label-absolute_codec_string']['ar-eg'] = ""; +$text['label-absolute_codec_string']['he'] = ""; + $text['label-rewrite_tls_contact_port']['en-us'] = "Rewrite TLS Contact Port"; $text['label-rewrite_tls_contact_port']['es-cl'] = "Reescribir Contacto Puerto TLS"; $text['label-rewrite_tls_contact_port']['pt-pt'] = "Reescreva Contacto Porto TLS"; @@ -1339,6 +1352,19 @@ $text['description-mwi_account']['ro'] = "Contul MWI cu utilizator@domeniu al me $text['description-mwi_account']['ar-eg'] = ""; $text['description-mwi_account']['he'] = ""; +$text['description-absolute_codec_string']['en-us'] = "Absolute Codec String for the extension"; +$text['description-absolute_codec_string']['es-cl'] = ""; +$text['description-absolute_codec_string']['pt-pt'] = ""; +$text['description-absolute_codec_string']['fr-fr'] = ""; +$text['description-absolute_codec_string']['pt-br'] = ""; +$text['description-absolute_codec_string']['pl'] = ""; +$text['description-absolute_codec_string']['uk'] = ""; +$text['description-absolute_codec_string']['sv-se'] = ""; +$text['description-absolute_codec_string']['de-at'] = ""; +$text['description-absolute_codec_string']['ro'] = ""; +$text['description-absolute_codec_string']['ar-eg'] = ""; +$text['description-absolute_codec_string']['he'] = ""; + $text['description-missed_call']['en-us'] = "Select the notification type, and enter the appropriate destination."; $text['description-missed_call']['es-cl'] = "Seleccione el tipo de notificación, y entrar en el destino apropiado."; $text['description-missed_call']['pt-pt'] = "Selecione o tipo de notificação e digite o destino apropriado."; @@ -1793,4 +1819,4 @@ $text['button-add']['ro'] = "Adaugă"; $text['button-add']['ar-eg'] = "اضافة"; $text['button-add']['he'] = "הוספה"; -?> \ No newline at end of file +?> diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php index 882809e939..a31b0d5b29 100644 --- a/app/extensions/extension_edit.php +++ b/app/extensions/extension_edit.php @@ -135,6 +135,7 @@ else { $nibble_account = check_str($_POST["nibble_account"]); $mwi_account = check_str($_POST["mwi_account"]); $sip_bypass_media = check_str($_POST["sip_bypass_media"]); + $absolute_codec_string = check_str($_POST["absolute_codec_string"]); $dial_string = check_str($_POST["dial_string"]); $enabled = check_str($_POST["enabled"]); $description = check_str($_POST["description"]); @@ -462,6 +463,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "mwi_account, "; } $sql .= "sip_bypass_media, "; + if (permission_exists('extension_absolute_codec_string')) { + $sql .= "absolute_codec_string, "; + } if (permission_exists('extension_dial_string')) { $sql .= "dial_string, "; } @@ -527,6 +531,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "'$mwi_account', "; } $sql .= "'$sip_bypass_media', "; + if (permission_exists('extension_absolute_codec_string')) { + $sql .= "'$absolute_codec_string', "; + } if (permission_exists('extension_dial_string')) { $sql .= "'$dial_string', "; } @@ -680,6 +687,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { } $sql .= "mwi_account = '$mwi_account', "; $sql .= "sip_bypass_media = '$sip_bypass_media', "; + if (permission_exists('extension_absolute_codec_string')) { + $sql .= "absolute_codec_string = '$absolute_codec_string', "; + } if (permission_exists('extension_dial_string')) { $sql .= "dial_string = '$dial_string', "; } @@ -841,6 +851,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $nibble_account = $row["nibble_account"]; $mwi_account = $row["mwi_account"]; $sip_bypass_media = $row["sip_bypass_media"]; + $absolute_codec_string = $row["absolute_codec_string"]; $dial_string = $row["dial_string"]; $enabled = $row["enabled"]; $description = $row["description"]; @@ -982,7 +993,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo "}\n"; echo ""; - echo "\n"; + echo "\n"; + echo ""; echo "\n"; echo "\n"; if ($action == "add") { @@ -1042,7 +1054,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo " ".$text['label-password']."\n"; echo "\n"; echo "\n"; @@ -1257,13 +1269,16 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $template_dir = $device->get_template_dir(); echo "\n"; echo " \n"; foreach ($destinations as &$row) { - if ($outbound_caller_id_name == $row["destination_caller_id_name"]) { - echo " \n"; + $tmp = $row["destination_caller_id_name"]; + if(strlen($tmp) == 0){ + $tmp = $row["destination_description"]; } - else { - echo " \n"; + if(strlen($tmp) > 0){ + if ($outbound_caller_id_name == $tmp) { + echo " \n"; + } + else { + echo " \n"; + } } } echo " \n"; @@ -1397,11 +1418,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo " \n"; @@ -1863,6 +1890,19 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; + if (permission_exists('extension_absolute_codec_string')) { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + if (permission_exists('extension_domain')) { echo "\n"; echo "\n"; echo "\n"; - if ($result_count > 0) { - foreach($result as $row) { + if ($num_rows > 0) { + foreach($extensions as $row) { $tr_link = (permission_exists('extension_edit')) ? " href='extension_edit.php?id=".$row['extension_uuid']."'" : null; echo "\n"; echo " \n"; if ($c==0) { $c=1; } else { $c=0; } } //end foreach - unset($sql, $result, $row_count); + unset($sql, $extensions, $row_count); } //end if results echo "\n"; @@ -205,7 +204,6 @@ require_once "resources/paging.php"; echo "
\n"; - echo " \n"; + echo " \n"; echo "
\n"; echo " ".$text['description-password']."\n"; echo "
\n"; + echo " ".$text['label-absolute_codec_string']."\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-absolute_codec_string']."\n"; + echo "
\n"; @@ -1964,4 +2004,4 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { //include the footer require_once "resources/footer.php"; -?> \ No newline at end of file +?> diff --git a/app/extensions/extensions.php b/app/extensions/extensions.php index 6f225149c7..a2d7b28597 100644 --- a/app/extensions/extensions.php +++ b/app/extensions/extensions.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2012 + Portions created by the Initial Developer are Copyright (C) 2008-2014 the Initial Developer. All Rights Reserved. Contributor(s): @@ -50,22 +50,6 @@ $document['title'] = $text['title-extensions']; require_once "resources/paging.php"; -//show the content - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
".$text['header-extensions']."
\n"; - echo " ".$text['description-extensions']."\n"; - echo "
\n"; - echo " "; - echo " "; - echo "
\n"; - echo "
"; - //get total extension count from the database $sql = "select count(*) as num_rows from v_extensions where domain_uuid = '".$_SESSION['domain_uuid']."' "; $prep_statement = $db->prepare($sql); @@ -128,10 +112,25 @@ require_once "resources/paging.php"; $sql .= " limit $rows_per_page offset $offset "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - $result_count = count($result); + $extensions = $prep_statement->fetchAll(PDO::FETCH_NAMED); unset ($prep_statement, $sql); +//show the content + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
".$text['header-extensions']." (".$num_rows.")
\n"; + echo " ".$text['description-extensions']."\n"; + echo "
\n"; + echo " "; + echo " "; + echo "
\n"; + echo "
"; + $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; @@ -153,8 +152,8 @@ require_once "resources/paging.php"; echo "
"; @@ -181,7 +180,7 @@ require_once "resources/paging.php"; echo "
"; echo "

"; - //show the footer require_once "resources/footer.php"; ?> \ No newline at end of file diff --git a/app/extensions/resources/classes/extension.php b/app/extensions/resources/classes/extension.php index 488236303a..78f09074ed 100644 --- a/app/extensions/resources/classes/extension.php +++ b/app/extensions/resources/classes/extension.php @@ -65,6 +65,7 @@ public $nibble_account; public $mwi_account; public $sip_bypass_media; + public $absolute_codec_string; public $dial_string; public $enabled; public $description; @@ -360,6 +361,9 @@ $xml .= " \n"; break; } + if (strlen($row['absolute_codec_string']) > 0) { + $xml .= " \n"; + } if (strlen($row['forward_all_enabled']) > 0) { $xml .= " \n"; } @@ -494,4 +498,4 @@ } } -?> \ No newline at end of file +?> diff --git a/app/fax/app_languages.php b/app/fax/app_languages.php index f56a1089cc..93ad7aa319 100644 --- a/app/fax/app_languages.php +++ b/app/fax/app_languages.php @@ -1,6 +1,6 @@ \n"; - echo "
\n"; - echo " ".$text['title-fax'].""; - echo "

\n"; - echo " ".$text['description']."\n"; - echo "
\n"; - echo "
\n"; - +//get the fax extensions if (if_group("superadmin") || if_group("admin")) { //show all fax extensions $sql = "select count(*) as num_rows from v_fax "; @@ -109,9 +100,20 @@ require_once "resources/paging.php"; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC); - $result_count = count($result); unset ($prep_statement, $sql); +//show the content + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo " ".$text['title-fax']." (".$num_rows.")"; + echo "

\n"; + echo " ".$text['description']."\n"; + echo "
\n"; + echo "
\n"; + $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; @@ -130,7 +132,7 @@ require_once "resources/paging.php"; echo "\n"; echo "\n"; - if ($result_count > 0) { + if ($num_rows > 0) { foreach($result as $row) { //remove the backslash $row['fax_email'] = str_replace("\\", "", $row['fax_email']); @@ -182,7 +184,7 @@ require_once "resources/paging.php"; //alternate the CSS class if ($c==0) { $c=1; } else { $c=0; } } //end foreach - unset($sql, $result, $row_count); + unset($sql, $result); } //end if results echo "\n"; diff --git a/app/fax/fax_files.php b/app/fax/fax_files.php index b79431d31f..8f83b675dd 100644 --- a/app/fax/fax_files.php +++ b/app/fax/fax_files.php @@ -172,24 +172,6 @@ else { require_once "resources/header.php"; require_once "resources/paging.php"; -//show the header - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
\n"; - if ($_REQUEST['box'] == 'inbox' && permission_exists('fax_inbox_view')) { - echo " ".$text['header-inbox'].": ".$fax_name." (".$fax_extension.")\n"; - } - if ($_REQUEST['box'] == 'sent' && permission_exists('fax_sent_view')) { - echo " ".$text['header-sent'].": ".$fax_name." (".$fax_extension.")\n"; - } - echo " \n"; - echo " \n"; - echo "
\n"; - echo "
\n"; - //prepare to page the results $sql = "select count(*) as num_rows from v_fax_files "; $sql .= "where fax_uuid = '$fax_uuid' "; @@ -234,10 +216,27 @@ else { $sql .= "limit $rows_per_page offset $offset "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - $result_count = count($result); + $fax_files = $prep_statement->fetchAll(PDO::FETCH_NAMED); unset ($prep_statement, $sql); +//show the header + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + if ($_REQUEST['box'] == 'inbox' && permission_exists('fax_inbox_view')) { + echo " ".$text['header-inbox'].": ".$fax_name." (".$fax_extension.")\n"; + } + if ($_REQUEST['box'] == 'sent' && permission_exists('fax_sent_view')) { + echo " ".$text['header-sent'].": ".$fax_name." (".$fax_extension.")\n"; + } + echo " \n"; + echo " \n"; + echo "
\n"; + echo "
\n"; + //show the table and content $c = 0; $row_style["0"] = "row_style0"; @@ -255,8 +254,8 @@ else { echo th_order_by('fax_date', $text['label-fax_date'], $order_by, $order, "&id=".$_GET['id']."&box=".$_GET['box']."&page=".$_GET['page']); echo " \n"; echo "\n"; - if ($result_count > 0) { - foreach($result as $row) { + if ($num_rows > 0) { + foreach($fax_files as $row) { $file = basename($row['fax_file_path']); if (strtolower(substr($file, -3)) == "tif" || strtolower(substr($file, -3)) == "pdf") { $file_name = substr($file, 0, (strlen($file) -4)); @@ -382,7 +381,7 @@ else { echo "\n"; $c = ($c) ? 0 : 1; } //end foreach - unset($sql, $result, $row_count); + unset($sql, $fax_files); } //end if results //show the paging controls diff --git a/app/fax/fax_send.php b/app/fax/fax_send.php index cbd205bb87..e134e37bbe 100644 --- a/app/fax/fax_send.php +++ b/app/fax/fax_send.php @@ -608,7 +608,7 @@ function gs_cmd($args) { $fax_uri = $route_array[0]; $t38 = "fax_enable_t38=true,fax_enable_t38_request=true,"; } - $cmd = "api originate {for_fax=1,absolute_codec_string='PCMU,PCMA',accountcode='".$fax_accountcode."',sip_h_X-accountcode='".$fax_accountcode."',domain_uuid=".$_SESSION["domain_uuid"].",domain_name=".$_SESSION["domain_name"].",mailto_address='".$mailto_address."',mailfrom_address='".$mailfrom_address."',origination_caller_id_name='".$fax_caller_id_name."',origination_caller_id_number='".$fax_caller_id_number."',fax_ident='".$fax_caller_id_number."',fax_header='".$fax_caller_id_name."',fax_uri=".$fax_uri.",fax_file='".$fax_file."',fax_retry_attempts=1,fax_retry_limit=20,fax_retry_sleep=180,fax_verbose=true,fax_use_ecm=off,".$t38."api_hangup_hook='lua fax_retry.lua'}".$fax_uri." &txfax('".$fax_file."')"; + $cmd = "api originate {for_fax=1,accountcode='".$fax_accountcode."',sip_h_X-accountcode='".$fax_accountcode."',domain_uuid=".$_SESSION["domain_uuid"].",domain_name=".$_SESSION["domain_name"].",mailto_address='".$mailto_address."',mailfrom_address='".$mailfrom_address."',origination_caller_id_name='".$fax_caller_id_name."',origination_caller_id_number='".$fax_caller_id_number."',fax_ident='".$fax_caller_id_number."',fax_header='".$fax_caller_id_name."',fax_uri=".$fax_uri.",fax_file='".$fax_file."',fax_retry_attempts=1,fax_retry_limit=20,fax_retry_sleep=180,fax_verbose=true,fax_use_ecm=off,".$t38."api_hangup_hook='lua fax_retry.lua'}".$fax_uri." &txfax('".$fax_file."')"; //send the command to event socket $response = event_socket_request($fp, $cmd); $response = str_replace("\n", "", $response); diff --git a/app/fifo/app_menu.php b/app/fifo/app_menu.php index 136a9c66a7..23d13ed651 100644 --- a/app/fifo/app_menu.php +++ b/app/fifo/app_menu.php @@ -3,9 +3,9 @@ $apps[$x]['menu'][0]['title']['en-us'] = "Queues"; $apps[$x]['menu'][0]['title']['es-cl'] = "Colas"; $apps[$x]['menu'][0]['title']['es-mx'] = "Colas"; -$apps[$x]['menu'][0]['title']['de-de'] = ""; -$apps[$x]['menu'][0]['title']['de-ch'] = ""; -$apps[$x]['menu'][0]['title']['de-at'] = ""; +$apps[$x]['menu'][0]['title']['de-de'] = "Warteschlangen"; +$apps[$x]['menu'][0]['title']['de-ch'] = "Warteschlangen"; +$apps[$x]['menu'][0]['title']['de-at'] = "Warteschlangen"; $apps[$x]['menu'][0]['title']['fr-fr'] = "Queues"; $apps[$x]['menu'][0]['title']['fr-ca'] = ""; $apps[$x]['menu'][0]['title']['fr-ch'] = ""; @@ -19,4 +19,4 @@ $apps[$x]['menu'][0]['path'] = "/app/dialplan/dialplans.php?app_uuid=16589224-c8 $apps[$x]['menu'][0]['groups'][] = "admin"; $apps[$x]['menu'][0]['groups'][] = "superadmin"; -?> \ No newline at end of file +?> diff --git a/app/follow_me/app_config.php b/app/follow_me/app_config.php index d5803f4437..7302d85b29 100644 --- a/app/follow_me/app_config.php +++ b/app/follow_me/app_config.php @@ -144,6 +144,8 @@ $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign"; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_follow_me"; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "follow_me_uuid"; $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "follow_me_destination_uuid"; $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid"; @@ -172,4 +174,4 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en'] = ""; $z++; -?> +?> \ No newline at end of file diff --git a/app/follow_me/app_menu.php b/app/follow_me/app_menu.php index 15e922e343..6054e217f0 100644 --- a/app/follow_me/app_menu.php +++ b/app/follow_me/app_menu.php @@ -2,9 +2,9 @@ $apps[$x]['menu'][0]['title']['en-us'] = "Follow Me"; $apps[$x]['menu'][0]['title']['es-mx'] = "Sígueme"; - $apps[$x]['menu'][0]['title']['de-de'] = ""; - $apps[$x]['menu'][0]['title']['de-ch'] = ""; - $apps[$x]['menu'][0]['title']['de-at'] = ""; + $apps[$x]['menu'][0]['title']['de-de'] = "Follow Me"; + $apps[$x]['menu'][0]['title']['de-ch'] = "Follow Me"; + $apps[$x]['menu'][0]['title']['de-at'] = "Follow Me"; $apps[$x]['menu'][0]['title']['fr-fr'] = "Follow Me"; $apps[$x]['menu'][0]['title']['fr-ca'] = ""; $apps[$x]['menu'][0]['title']['fr-ch'] = ""; @@ -18,4 +18,4 @@ $apps[$x]['menu'][0]['groups'][] = "admin"; $apps[$x]['menu'][0]['groups'][] = "superadmin"; -?> \ No newline at end of file +?> diff --git a/app/gateways/app_config.php b/app/gateways/app_config.php index 049daf4f95..672be36cc3 100644 --- a/app/gateways/app_config.php +++ b/app/gateways/app_config.php @@ -189,6 +189,11 @@ $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "hostname"; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(255)"; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "enabled"; $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; diff --git a/app/gateways/app_languages.php b/app/gateways/app_languages.php index 414807c343..4af02a678b 100644 --- a/app/gateways/app_languages.php +++ b/app/gateways/app_languages.php @@ -442,6 +442,15 @@ $text['label-expire_seconds']['de-at'] = "Expire Seconds"; $text['label-expire_seconds']['ar-eg'] = ""; $text['label-expire_seconds']['he'] = ""; +$text['label-hostname']['en-us'] = "Hostname"; +$text['label-hostname']['pt-pt'] = "Hostname"; +$text['label-hostname']['fr-fr'] = "Nom d'hôte"; +$text['label-hostname']['pt-br'] = "Hostname"; +$text['label-hostname']['pl'] = "Nazwa hosta"; +$text['label-hostname']['sv-se'] = "Hostname"; +$text['label-hostname']['uk'] = "Назва хоста"; +$text['label-hostname']['de-at'] = "Hostname"; + $text['label-enabled']['en-us'] = "Enabled"; $text['label-enabled']['es-cl'] = "Activado"; $text['label-enabled']['pt-pt'] = "Habilitado"; @@ -870,6 +879,15 @@ $text['description-expire_seconds']['de-at'] = "Geben Sie an, nach wie vielen Se $text['description-expire_seconds']['ar-eg'] = ""; $text['description-expire_seconds']['he'] = ""; +$text['description-hostname']['en-us'] = "Enter the hostname / switchname."; +$text['description-hostname']['pt-pt'] = "Introduza o hostname"; +$text['description-hostname']['fr-fr'] = "Entrer le nom de l'hôte / du switch."; +$text['description-hostname']['pt-br'] = "Insira o hostname"; +$text['description-hostname']['pl'] = "Wprowadź nazwę hosta / PBXu."; +$text['description-hostname']['sv-se'] = "Fyll i hostname / switchname."; +$text['description-hostname']['uk'] = "Введіть назву хоста / switchname."; +$text['description-hostname']['de-at'] = "Geben Sie den Hostnamen / Switchnamen an."; + $text['description-enabled']['en-us'] = "Enable or Disable the Gateway"; $text['description-enabled']['es-cl'] = "Activar o Desactivar la Pasarela"; $text['description-enabled']['pt-pt'] = "Habilitar ou Desabilitar o Gateway"; diff --git a/app/gateways/gateway_edit.php b/app/gateways/gateway_edit.php index 0ddb0a4f9a..a60a801163 100644 --- a/app/gateways/gateway_edit.php +++ b/app/gateways/gateway_edit.php @@ -95,6 +95,7 @@ else { $extension_in_contact = check_str($_POST["extension_in_contact"]); $context = check_str($_POST["context"]); $profile = check_str($_POST["profile"]); + $hostname = check_str($_POST["hostname"]); $enabled = check_str($_POST["enabled"]); $description = check_str($_POST["description"]); } @@ -198,6 +199,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "extension_in_contact, "; $sql .= "context, "; $sql .= "profile, "; + $sql .= "hostname, "; $sql .= "enabled, "; $sql .= "description "; $sql .= ")"; @@ -232,6 +234,12 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "'$extension_in_contact', "; $sql .= "'$context', "; $sql .= "'$profile', "; + if (strlen($hostname) == 0) { + $sql .= "null, "; + } + else { + $sql .= "'$hostname', "; + } $sql .= "'$enabled', "; $sql .= "'$description' "; $sql .= ")"; @@ -278,6 +286,12 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { else { $sql .= "domain_uuid = '$domain_uuid', "; } + if (strlen($hostname) == 0) { + $sql .= "hostname = null, "; + } + else { + $sql .= "hostname = '$hostname', "; + } $sql .= "enabled = '$enabled', "; $sql .= "description = '$description' "; $sql .= "where gateway_uuid = '$gateway_uuid'"; @@ -374,6 +388,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $extension_in_contact = $row["extension_in_contact"]; $context = $row["context"]; $profile = $row["profile"]; + $hostname = $row["hostname"]; $enabled = $row["enabled"]; $description = $row["description"]; } @@ -871,6 +886,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; + echo "\n"; + echo "\n"; + echo " ".$text['label-hostname']."\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-hostname']."\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; echo " ".$text['label-enabled']."\n"; diff --git a/app/gateways/gateways.php b/app/gateways/gateways.php index bc890546dc..f517fd5354 100644 --- a/app/gateways/gateways.php +++ b/app/gateways/gateways.php @@ -136,7 +136,7 @@ else { } $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); + $gateways = $prep_statement->fetchAll(PDO::FETCH_NAMED); unset ($prep_statement, $sql); $rows_per_page = 150; @@ -159,6 +159,7 @@ else { echo "".$text['label-action']."\n"; echo "".$text['label-state']."\n"; } + echo th_order_by('hostname', $text['label-hostname'], $order_by, $order); echo th_order_by('enabled', $text['label-enabled'], $order_by, $order); echo th_order_by('description', $text['label-description'], $order_by, $order); echo ""; @@ -171,7 +172,7 @@ else { echo "\n"; if ($num_rows > 0) { - foreach($result as $row) { + foreach($gateways as $row) { $tr_link = (permission_exists('gateway_edit')) ? "href='gateway_edit.php?id=".$row['gateway_uuid']."'" : null; echo "\n"; echo " "; @@ -211,6 +212,7 @@ else { echo "  \n"; echo "  \n"; } + echo " ".$row["hostname"]."\n"; if ($row["enabled"] == "true") { echo " ".$text['label-true']."\n"; } @@ -230,11 +232,11 @@ else { } if ($c==0) { $c=1; } else { $c=0; } } //end foreach - unset($sql, $result, $row_count); + unset($sql, $gateways, $row_count); } //end if results echo "\n"; - echo "\n"; + echo "\n"; echo " \n"; echo " \n"; echo " \n"; diff --git a/app/provision/app_defaults.php b/app/provision/app_defaults.php index 942c228efd..7e80fd2e59 100644 --- a/app/provision/app_defaults.php +++ b/app/provision/app_defaults.php @@ -103,6 +103,13 @@ $array[$x]['default_setting_description'] = ''; $x++; $array[$x]['default_setting_category'] = 'provision'; + $array[$x]['default_setting_subcategory'] = 'path'; + $array[$x]['default_setting_name'] = 'text'; + $array[$x]['default_setting_value'] = ''; + $array[$x]['default_setting_enabled'] = 'false'; + $array[$x]['default_setting_description'] = ''; + $x++; + $array[$x]['default_setting_category'] = 'provision'; $array[$x]['default_setting_subcategory'] = 'voicemail_number'; $array[$x]['default_setting_name'] = 'text'; $array[$x]['default_setting_value'] = '*97'; diff --git a/app/provision/index.php b/app/provision/index.php index edd3b02cc2..73f2f73915 100644 --- a/app/provision/index.php +++ b/app/provision/index.php @@ -77,6 +77,7 @@ openlog("fusion-provisioning", LOG_PID | LOG_PERROR, LOG_LOCAL0); $domain_uuid = $row["domain_uuid"]; } unset($result, $prep_statement); + $_SESSION['domain_uuid'] = $domain_uuid; //get the domain name $domain_name = $_SESSION['domains'][$domain_uuid]['domain_name']; @@ -240,7 +241,7 @@ openlog("fusion-provisioning", LOG_PID | LOG_PERROR, LOG_LOCAL0); header('WWW-Authenticate: Basic realm="'.$_SESSION['domain_name']." ".date('r').'"'); header('HTTP/1.0 401 Unauthorized'); header("Content-Type: text/plain"); - echo 'Authorization Required'; + header("Content-Length: 0"); exit; } else { if ($_SERVER['PHP_AUTH_USER'] == $provision["http_auth_username"] && $_SERVER['PHP_AUTH_PW'] == $provision["http_auth_password"]) { @@ -251,7 +252,9 @@ openlog("fusion-provisioning", LOG_PID | LOG_PERROR, LOG_LOCAL0); header('WWW-Authenticate: Basic realm="'.$_SESSION['domain_name']." ".date('r').'"'); unset($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']); usleep(rand(1000000,3000000));//1-3 seconds. - echo 'Authorization Required'; + $content = 'Authorization Required'; + header("Content-Length: ".strval(strlen($content))); + echo $content; exit; } } @@ -311,4 +314,4 @@ openlog("fusion-provisioning", LOG_PID | LOG_PERROR, LOG_LOCAL0); return $needed_parts ? false : $data; } -?> \ No newline at end of file +?> diff --git a/app/provision/resources/classes/provision.php b/app/provision/resources/classes/provision.php index 237de12212..66fa4645cb 100644 --- a/app/provision/resources/classes/provision.php +++ b/app/provision/resources/classes/provision.php @@ -465,7 +465,7 @@ include "root.php"; $sql .= "or device_profile_uuid = '".$device_profile_uuid."' "; } $sql .= ") "; - $sql .= "AND (device_key_vendor = '".$device_vendor."' or device_key_vendor is null) "; + $sql .= "AND (lower(device_key_vendor) = '".$device_vendor."' or device_key_vendor is null) "; $sql .= "ORDER BY device_key_category asc, device_key_id asc, device_uuid desc"; $prep_statement = $this->db->prepare(check_sql($sql)); $prep_statement->execute(); @@ -822,8 +822,8 @@ include "root.php"; //$file_size = round(filesize($new_path)/1024, 2); //echo $this->template_dir."/".$device_template."/".$file_name." $file_size\n"; //write the configuration to the directory - if (strlen($_SESSION['switch']['provision']['dir']) > 0) { - $dir_array = explode(";", $_SESSION['switch']['provision']['dir']); + if (strlen($provision["path"]) > 0) { + $dir_array = explode(";", $provision["path"]); foreach($dir_array as $directory) { if (file_exists($this->template_dir."/".$device_template."/".$file_name)) { diff --git a/app/registrations/status_registrations_inc.php b/app/registrations/status_registrations_inc.php index e4efaba3ac..03fedb8c5e 100644 --- a/app/registrations/status_registrations_inc.php +++ b/app/registrations/status_registrations_inc.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2014 + Portions created by the Initial Developer are Copyright (C) 2008-2015 the Initial Developer. All Rights Reserved. Contributor(s): @@ -127,7 +127,7 @@ require_once "resources/check_auth.php"; echo "
 
\n"; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; - echo " ".$text['header-registrations'].": ".count($registrations)."\n"; + echo " ".$text['header-registrations']." (".count($registrations).")\n"; echo ""; echo " \"".$text['label-refresh_pause']."\""; diff --git a/app/ring_groups/app_languages.php b/app/ring_groups/app_languages.php index 41e87e22f2..4ce8421826 100644 --- a/app/ring_groups/app_languages.php +++ b/app/ring_groups/app_languages.php @@ -88,6 +88,17 @@ $text['option-rollover']['uk'] = ""; $text['option-rollover']['de-at'] = "Überrollen"; $text['option-rollover']['he'] = ""; +$text['option-random']['en-us'] = "Random"; +$text['option-random']['es-cl'] = "Aleatorio"; +$text['option-random']['pt-pt'] = ""; +$text['option-random']['fr-fr'] = ""; +$text['option-random']['pt-br'] = ""; +$text['option-random']['pl'] = ""; +$text['option-random']['sv-se'] = ""; +$text['option-random']['uk'] = ""; +$text['option-random']['de-at'] = ""; +$text['option-random']['he'] = ""; + $text['option-ptring']['en-us'] = "pt-ring"; $text['option-ptring']['es-cl'] = "pt-ring"; $text['option-ptring']['fr-fr'] = "Portugal"; diff --git a/app/ring_groups/ring_group_edit.php b/app/ring_groups/ring_group_edit.php index 9d7083e70e..929f7086d6 100644 --- a/app/ring_groups/ring_group_edit.php +++ b/app/ring_groups/ring_group_edit.php @@ -499,6 +499,7 @@ else { echo " \n"; echo " \n"; echo " \n"; + echo " \n"; echo " \n"; echo "
\n"; echo $text['description-strategy']."\n"; diff --git a/app/time_conditions/app_defaults.php b/app/time_conditions/app_defaults.php index 249ed0f0f5..2fa4411a74 100644 --- a/app/time_conditions/app_defaults.php +++ b/app/time_conditions/app_defaults.php @@ -3,54 +3,68 @@ if ($domains_processed == 1) { //define holiday presets - $preset[] = json_encode(array("new_years_day" => array("mday" => "1", "mon" => "1"))); - $preset[] = json_encode(array("martin_luther_king_jr_day" => array("wday" => "2", "mon" => "1", "mweek" => "3"))); - $preset[] = json_encode(array("presidents_day" => array("wday" => "2", "mon" => "2", "mweek" => "3"))); - $preset[] = json_encode(array("memorial_day" => array("mday" => "25-31", "wday" => "2", "mon" => "5"))); - $preset[] = json_encode(array("independence_day" => array("mday" => "4", "mon" => "7"))); - $preset[] = json_encode(array("labor_day" => array("wday" => "2", "mon" => "9", "mweek" => "1"))); - $preset[] = json_encode(array("columbus_day" => array("wday" => "2", "mon" => "10", "mweek" => "2"))); - $preset[] = json_encode(array("veterans_day" => array("mday" => "11", "mon" => "11"))); - $preset[] = json_encode(array("thanksgiving_day" => array("wday" => "5-6", "mon" => "11", "mweek" => "4"))); - $preset[] = json_encode(array("christmas_day" => array("mday" => "25", "mon" => "12"))); + $preset['usa'][] = json_encode(array("new_years_day" => array("mday" => "1", "mon" => "1"))); + $preset['usa'][] = json_encode(array("martin_luther_king_jr_day" => array("wday" => "2", "mon" => "1", "mweek" => "3"))); + $preset['usa'][] = json_encode(array("presidents_day" => array("wday" => "2", "mon" => "2", "mweek" => "3"))); + $preset['usa'][] = json_encode(array("memorial_day" => array("mday" => "25-31", "wday" => "2", "mon" => "5"))); + $preset['usa'][] = json_encode(array("independence_day" => array("mday" => "4", "mon" => "7"))); + $preset['usa'][] = json_encode(array("labor_day" => array("wday" => "2", "mon" => "9", "mweek" => "1"))); + $preset['usa'][] = json_encode(array("columbus_day" => array("wday" => "2", "mon" => "10", "mweek" => "2"))); + $preset['usa'][] = json_encode(array("veterans_day" => array("mday" => "11", "mon" => "11"))); + $preset['usa'][] = json_encode(array("thanksgiving_day" => array("wday" => "5-6", "mon" => "11", "mweek" => "4"))); + $preset['usa'][] = json_encode(array("christmas_day" => array("mday" => "25", "mon" => "12"))); - //define array of settings - $x = 0; - foreach ($preset as $json) { - $array[$x]['default_setting_category'] = 'time_conditions'; - $array[$x]['default_setting_subcategory'] = 'preset'; - $array[$x]['default_setting_name'] = 'array'; - $array[$x]['default_setting_value'] = $json; - $array[$x]['default_setting_enabled'] = 'true'; - $array[$x]['default_setting_description'] = 'Holiday'; - $x++; - } + $preset['england'][] = json_encode(array("new_years_day" => array("mday" => "1", "mon" => "1"))); + $preset['england'][] = json_encode(array("christmas_day" => array("mday" => "25", "mon" => "12"))); + $preset['england'][] = json_encode(array("boxing_day" => array("mday" => "26", "mon" => "12"))); + $preset['england'][] = json_encode(array("may_day" => array("mon" => "5", "mweek" => "1", "wday" => "2"))); + $preset['england'][] = json_encode(array("spring_bank_holiday" => array("mon" => "5", "mday" => "25-31", "wday" => "2"))); + $preset['england'][] = json_encode(array("august_bank_holiday" => array("mon" => "8", "mday" => "25-31", "wday" => "2"))); - //get an array of the default settings - $sql = "select * from v_default_settings "; + //iterate and migrate old presets first + $sql = "update v_default_settings "; + $sql .= "set default_setting_subcategory = 'preset_usa' "; + $sql .= ", default_setting_description = 'usa Holiday' "; $sql .= "where default_setting_category = 'time_conditions' "; $sql .= "and default_setting_subcategory = 'preset' "; - $sql .= "and default_setting_name = 'array' "; $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 - $x = 0; - foreach ($array as $setting) { - $found = false; - $missing[$x] = $setting; - foreach ($default_settings as $row) { - if (trim($row['default_setting_value']) == trim($setting['default_setting_value'])) { - $found = true; - //remove items from the array that were found - unset($missing[$x]); - } - } - $x++; + if ($prep_statement) { + $prep_statement->execute(); + unset ($prep_statement, $sql); } + //iterate and add each, if necessary + $x = 0; + foreach ($preset as $region => $data) { + $sql = "select * from v_default_settings "; + $sql .= "where default_setting_category = 'time_conditions' "; + $sql .= "and default_setting_subcategory = 'preset_$region' "; + $sql .= "and default_setting_name = 'array' "; + $prep_statement = $db->prepare($sql); + if ($prep_statement) { + $prep_statement->execute(); + $default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED); + unset ($prep_statement, $sql); + foreach ($data as $json) { + $found = false; + $missing[$x]['default_setting_category'] = 'time_conditions'; + $missing[$x]['default_setting_subcategory'] = "preset_$region"; + $missing[$x]['default_setting_name'] = 'array'; + $missing[$x]['default_setting_value'] = $json; + $missing[$x]['default_setting_enabled'] = 'true'; + $missing[$x]['default_setting_description'] = "$region Holiday"; + foreach ($default_settings as $row) { + if (trim($row['default_setting_value']) == trim($json)) { + $found = true; + //remove items from the array that were found + unset($missing[$x]); + } + } + $x++; + } + } + } + //add the missing default settings foreach ($missing as $row) { //add the default settings @@ -63,6 +77,39 @@ if ($domains_processed == 1) { } unset($missing); + $array[$x]['default_setting_category'] = 'time_conditions'; + $array[$x]['default_setting_subcategory'] = 'region'; + $array[$x]['default_setting_name'] = 'text'; + $array[$x]['default_setting_value'] = 'usa'; + $array[$x]['default_setting_enabled'] = 'true'; + $array[$x]['default_setting_description'] = 'What region to use by default when choosing Time Conditions'; + $x++; + + //iterate and add each, if necessary + foreach ($array as $index => $default_settings) { + + //add the default setting + $sql = "select count(*) as num_rows from v_default_settings "; + $sql .= "where default_setting_category = '".$default_settings['default_setting_category']."' "; + $sql .= "and default_setting_subcategory = '".$default_settings['default_setting_subcategory']."' "; + $sql .= "and default_setting_name = '".$default_settings['default_setting_name']."' "; + $prep_statement = $db->prepare($sql); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + unset($prep_statement); + if ($row['num_rows'] == 0) { + $orm = new orm; + $orm->name('default_settings'); + $orm->save($array[$index]); + $message = $orm->message; + //print_r($message); + } + unset($row); + } + + } + //unset the array variable unset($array); } diff --git a/app/time_conditions/app_languages.php b/app/time_conditions/app_languages.php index 402e6a4027..91dbe32ace 100644 --- a/app/time_conditions/app_languages.php +++ b/app/time_conditions/app_languages.php @@ -583,6 +583,28 @@ $text['label-alternate-destination']['uk'] = ""; $text['label-alternate-destination']['de-at'] = "Alternatives Ziel"; $text['label-alternate-destination']['he'] = ""; +$text['label-group']['en-us'] = "Group"; +$text['label-group']['es-cl'] = "Grupo"; +$text['label-group']['pt-pt'] = ""; +$text['label-group']['fr-fr'] = ""; +$text['label-group']['pt-br'] = ""; +$text['label-group']['pl'] = ""; +$text['label-group']['sv-se'] = ""; +$text['label-group']['uk'] = ""; +$text['label-group']['de-at'] = ""; +$text['label-group']['he'] = ""; + +$text['label-destination']['en-us'] = "Destination"; +$text['label-destination']['es-cl'] = "Destino"; +$text['label-destination']['pt-pt'] = "Destino"; +$text['label-destination']['fr-fr'] = "Destination"; +$text['label-destination']['pt-br'] = ""; +$text['label-destination']['pl'] = "Destynacja"; +$text['label-destination']['sv-se'] = "Destination"; +$text['label-destination']['uk'] = ""; +$text['label-destination']['de-at'] = "Ziel"; +$text['label-destination']['he'] = ""; + $text['header-time_conditions']['en-us'] = "Time Conditions"; $text['header-time_conditions']['es-cl'] = "Condiciones de Tiempo"; $text['header-time_conditions']['pt-pt'] = "Condições Temporais"; diff --git a/app/time_conditions/time_condition_edit.php b/app/time_conditions/time_condition_edit.php index 42d7b79a62..f3e70b9f77 100644 --- a/app/time_conditions/time_condition_edit.php +++ b/app/time_conditions/time_condition_edit.php @@ -44,10 +44,12 @@ require_once "resources/header.php"; $destination = new destinations; //load available presets - foreach ($_SESSION['time_conditions']['preset'] as $json) { + $preset_region = "preset_".$_SESSION['time_conditions']['region']['text']; + foreach ($_SESSION['time_conditions'][$preset_region] as $json) { $available_presets[] = json_decode($json, true); } - + unset($preset_region); + //set the action as an add or an update if (isset($_REQUEST["id"])) { $action = "update"; @@ -248,7 +250,14 @@ require_once "resources/header.php"; $is_preset = (in_array($group_id, $_REQUEST['preset'])) ? true : false; //set group and order number - $dialplan_detail_group = $group_id; + + $dialplan_detail_group_user = check_str($_POST["group_$group_id"]); + if($dialplan_detail_group_user!='') { + $dialplan_detail_group = $dialplan_detail_group_user; + } else { + $dialplan_detail_group = $group_id; + } + $dialplan_detail_order = 0; foreach ($conditions as $cond_num => $cond_var) { @@ -836,7 +845,7 @@ function add_custom_condition($destination, $group_id, $dialplan_action = '') { echo " ".$text['label-settings']; echo "
\n"; - echo " \n"; + echo "
\n"; echo " \n"; echo " \n"; echo " \n"; @@ -846,11 +855,16 @@ function add_custom_condition($destination, $group_id, $dialplan_action = '') { echo " "; echo " "; echo " "; + echo " "; + echo " \n"; + echo " \n"; + echo " "; echo " "; - echo " "; + echo " \n"; echo " "; echo "
".$text['label-condition']."".$text['label-condition_value']."
".$text['label-destination']."".$text['label-group']."
"; + echo " "; //$destination = new destinations; echo $destination->select('dialplan', 'dialplan_action['.$group_id.']', $dialplan_action); echo "
"; echo "
"; @@ -1092,4 +1106,4 @@ echo "
"; //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file diff --git a/app/voicemail_greetings/voicemail_greetings.php b/app/voicemail_greetings/voicemail_greetings.php index 623a832287..865c66353a 100644 --- a/app/voicemail_greetings/voicemail_greetings.php +++ b/app/voicemail_greetings/voicemail_greetings.php @@ -46,7 +46,7 @@ require_once "resources/check_auth.php"; } //deny access if the user extension is not assigned - if (!(if_group("superadmin") || if_group("admin"))) { + if (!permission_exists('voicemail_greeting_view')) { if (!is_extension_assigned($voicemail_id)) { echo "access denied"; return; diff --git a/app/voicemails/app_defaults.php b/app/voicemails/app_defaults.php index d81acb5140..0fab2304d7 100644 --- a/app/voicemails/app_defaults.php +++ b/app/voicemails/app_defaults.php @@ -48,6 +48,13 @@ if ($domains_processed == 1) { $array[$x]['default_setting_enabled'] = 'true'; $array[$x]['default_setting_description'] = 'Define whether to keep voicemail files on the local system after sending attached via email.'; $x++; + $array[$x]['default_setting_category'] = 'voicemail'; + $array[$x]['default_setting_subcategory'] = 'storage_type'; + $array[$x]['default_setting_name'] = 'text'; + $array[$x]['default_setting_value'] = 'base64'; + $array[$x]['default_setting_enabled'] = 'false'; + $array[$x]['default_setting_description'] = 'Define which storage type (base_64 stores in the database).'; + $x++; //iterate and add each, if necessary foreach ($array as $index => $default_settings) { diff --git a/app/voicemails/resources/classes/voicemail.php b/app/voicemails/resources/classes/voicemail.php index ca5b55ba00..27f7e304af 100644 --- a/app/voicemails/resources/classes/voicemail.php +++ b/app/voicemails/resources/classes/voicemail.php @@ -161,7 +161,7 @@ if ($result_count > 0) { foreach($result as &$row) { //set the greeting directory - $path = $_SESSION['switch']['storage']['dir'].'/voicemail/default/'.$_SESSION['domain_name'].'/'.$row['voicemail_id']; + $path = $_SESSION['switch']['voicemail']['dir'].'/default/'.$_SESSION['domain_name'].'/'.$row['voicemail_id']; if (file_exists($path.'/msg_'.$row['voicemail_message_uuid'].'.wav')) { $row['file_path'] = $path.'/msg_'.$row['voicemail_message_uuid'].'.wav'; } @@ -239,7 +239,7 @@ } //delete the recording - $file_path = $_SESSION['switch']['storage']['dir']."/voicemail/default/".$_SESSION['domain_name']."/".$this->voicemail_id; + $file_path = $_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$this->voicemail_id; foreach (glob($file_path."/msg_".$this->voicemail_message_uuid.".*") as $file_name) { unlink($file_name); } @@ -278,7 +278,7 @@ session_cache_limiter('public'); //set source folder path - $path = $_SESSION['switch']['storage']['dir'].'/voicemail/default/'.$_SESSION['domain_name'].'/'.$this->voicemail_id; + $path = $_SESSION['switch']['voicemail']['dir'].'/default/'.$_SESSION['domain_name'].'/'.$this->voicemail_id; //prepare base64 content from db, if enabled if ($_SESSION['voicemail']['storage_type']['text'] == 'base64') { diff --git a/app/voicemails/voicemail_messages.php b/app/voicemails/voicemail_messages.php index 13942dabdb..0d27347945 100644 --- a/app/voicemails/voicemail_messages.php +++ b/app/voicemails/voicemail_messages.php @@ -185,17 +185,13 @@ if (!(check_str($_REQUEST["action"]) == "download" && check_str($_REQUEST["src"] $previous_voicemail_id = $field['voicemail_id']; unset($sql, $result, $result_count); - } - echo "
"; echo "

"; - } else { echo "
".$text['message-messages_not_found']."

"; } - echo "
"; //autoplay message diff --git a/app/voicemails/voicemails.php b/app/voicemails/voicemails.php index c4cb62fc62..4224259456 100644 --- a/app/voicemails/voicemails.php +++ b/app/voicemails/voicemails.php @@ -57,11 +57,73 @@ else { require_once "resources/header.php"; require_once "resources/paging.php"; +//prepare to page the results + $sql = "select count(*) as num_rows from v_voicemails "; + $sql .= "where domain_uuid = '$domain_uuid' "; + if (strlen($search) > 0) { + $sql .= "and ("; + $sql .= " voicemail_id like '%".$search."%' "; + $sql .= " or voicemail_mail_to like '%".$search."%' "; + $sql .= " or voicemail_local_after_email like '%".$search."%' "; + $sql .= " or voicemail_enabled like '%".$search."%' "; + $sql .= " or voicemail_description like '%".$search."%' "; + $sql .= ") "; + } + if (!permission_exists('voicemail_delete')) { + $x = 0; + if (count($voicemail_uuids) > 0) { + $sql .= "and ("; + foreach($voicemail_uuids as $row) { + if ($x == 0) { + $sql .= "voicemail_uuid = '".$row['voicemail_uuid']."' "; + } + else { + $sql .= " or voicemail_uuid = '".$row['voicemail_uuid']."'"; + } + $x++; + } + $sql .= ")"; + } + else { + $sql .= "and voicemail_uuid is null "; + } + } + $prep_statement = $db->prepare($sql); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + if ($row['num_rows'] > 0) { + $num_rows = $row['num_rows']; + } + else { + $num_rows = '0'; + } + } + +//prepare to page the results + $rows_per_page = 150; + $param = ""; + if ($search != '') { $param .= "&search=".$search; } + if ($order_by != '') { $param .= "&order_by=".$order_by."&order=".$order; } + $page = $_GET['page']; + if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } + list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page); + $offset = $rows_per_page * $page; + +//get the list + $sql = str_replace('count(*) as num_rows', '*', $sql); + $sql .= ($order_by != '') ? "order by ".$order_by." ".$order." " : "order by voicemail_id asc "; + $sql .= "limit ".$rows_per_page." offset ".$offset." "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $voicemails = $prep_statement->fetchAll(PDO::FETCH_NAMED); + unset ($prep_statement, $sql); + //show the content echo "\n"; echo " \n"; echo " \n"; echo "
"; - echo " ".$text['title-voicemails'].""; + echo " ".$text['title-voicemails']." (".$num_rows.")"; echo "

"; echo " ".$text['description-voicemail']; echo "

"; @@ -75,74 +137,11 @@ else { echo "
\n"; - //prepare to page the results - $sql = "select count(*) as num_rows from v_voicemails "; - $sql .= "where domain_uuid = '$domain_uuid' "; - if (strlen($search) > 0) { - $sql .= "and ("; - $sql .= " voicemail_id like '%".$search."%' "; - $sql .= " or voicemail_mail_to like '%".$search."%' "; - $sql .= " or voicemail_local_after_email like '%".$search."%' "; - $sql .= " or voicemail_enabled like '%".$search."%' "; - $sql .= " or voicemail_description like '%".$search."%' "; - $sql .= ") "; - } - if (!permission_exists('voicemail_delete')) { - $x = 0; - if (count($voicemail_uuids) > 0) { - $sql .= "and ("; - foreach($voicemail_uuids as $row) { - if ($x == 0) { - $sql .= "voicemail_uuid = '".$row['voicemail_uuid']."' "; - } - else { - $sql .= " or voicemail_uuid = '".$row['voicemail_uuid']."'"; - } - $x++; - } - $sql .= ")"; - } - else { - $sql .= "and voicemail_uuid is null "; - } - } - $prep_statement = $db->prepare($sql); - if ($prep_statement) { - $prep_statement->execute(); - $row = $prep_statement->fetch(PDO::FETCH_ASSOC); - if ($row['num_rows'] > 0) { - $num_rows = $row['num_rows']; - } - else { - $num_rows = '0'; - } - } - - //prepare to page the results - $rows_per_page = 150; - $param = ""; - if ($search != '') { $param .= "&search=".$search; } - if ($order_by != '') { $param .= "&order_by=".$order_by."&order=".$order; } - $page = $_GET['page']; - if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } - list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page); - $offset = $rows_per_page * $page; - - //get the list - $sql = str_replace('count(*) as num_rows', '*', $sql); - $sql .= ($order_by != '') ? "order by ".$order_by." ".$order." " : "order by voicemail_id asc "; - $sql .= "limit ".$rows_per_page." offset ".$offset." "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - $result_count = count($result); - unset ($prep_statement, $sql); - $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; - if ($result_count > 0) { + if ($num_rows > 0) { echo "\n"; echo "\n"; @@ -165,7 +164,7 @@ else { echo "\n"; echo "\n"; - foreach($result as $row) { + foreach($voicemails as $row) { $tr_link = (permission_exists('voicemail_edit')) ? "href='voicemail_edit.php?id=".$row['voicemail_uuid']."'" : null; echo "\n"; echo " \n"; if ($c==0) { $c=1; } else { $c=0; } } //end foreach - unset($sql, $result, $row_count); + unset($sql, $voicemails, $row_count); echo "\n"; echo "
"; @@ -202,7 +201,7 @@ else { echo "
\n"; diff --git a/app/xml_cdr/xml_cdr.php b/app/xml_cdr/xml_cdr.php index 83a15eb7ad..a667148085 100644 --- a/app/xml_cdr/xml_cdr.php +++ b/app/xml_cdr/xml_cdr.php @@ -471,21 +471,21 @@ else { switch ($row['direction']) { case "inbound" : if ($row['billsec'] == 0) - echo "\n"; + echo "\n"; else - echo "\n"; + echo "\n"; break; case "outbound" : if ($row['billsec'] == 0) - echo "\n"; + echo "\n"; else - echo "\n"; + echo "\n"; break; case "local" : if ($row['billsec'] == 0) - echo "\n"; + echo "\n"; else - echo "\n"; + echo "\n"; break; default: echo " "; diff --git a/app/xml_cdr/xml_cdr_details.php b/app/xml_cdr/xml_cdr_details.php index 2009380b4a..aca8978688 100644 --- a/app/xml_cdr/xml_cdr_details.php +++ b/app/xml_cdr/xml_cdr_details.php @@ -47,7 +47,7 @@ else { //get the cdr string from the database $sql = "select * from v_xml_cdr "; if ($_GET['showall'] && permission_exists('xml_cdr_all')) { - if ($sql_where) { $sql .= "where uuid = '$uuid' "; } + $sql .= "where uuid = '$uuid' "; } else { $sql .= "where uuid = '$uuid' and domain_uuid = '$domain_uuid' "; } diff --git a/core/databases/app_defaults.php b/core/databases/app_defaults.php index dfd247334e..ea4d04d6c9 100644 --- a/core/databases/app_defaults.php +++ b/core/databases/app_defaults.php @@ -131,6 +131,9 @@ if ($domains_processed == 1) { if (strlen($_SESSION['switch']['sounds']['dir']) > 0) { $tmp .= correct_path(" sounds_dir = [[".$_SESSION['switch']['sounds']['dir']."]];\n"); } + if (strlen($_SESSION['switch']['phrases']['dir']) > 0) { + $tmp .= correct_path(" phrases_dir = [[".$_SESSION['switch']['phrases']['dir']."]];\n"); + } if (strlen($_SESSION['switch']['db']['dir']) > 0) { $tmp .= correct_path(" database_dir = [[".$_SESSION['switch']['db']['dir']."]];\n"); } @@ -182,7 +185,25 @@ if ($domains_processed == 1) { } $tmp .= "\n"; } - + $tmp .= "--set defaults\n"; + $tmp .= " expire = {}\n"; + $tmp .= " expire[\"directory\"] = \"3600\";\n"; + $tmp .= " expire[\"dialplan\"] = \"3600\";\n"; + $tmp .= " expire[\"languages\"] = \"3600\";\n"; + $tmp .= " expire[\"sofia.conf\"] = \"3600\";\n"; + $tmp .= " expire[\"acl.conf\"] = \"3600\";\n"; + $tmp .= "\n"; + $tmp .= "--set xml_handler\n"; + $tmp .= " xml_handler = {}\n"; + $tmp .= " xml_handler[\"fs_path\"] = false;\n"; + $tmp .= "\n"; + $tmp .= "--set the debug options\n"; + $tmp .= " debug[\"params\"] = false;\n"; + $tmp .= " debug[\"sql\"] = false;\n"; + $tmp .= " debug[\"xml_request\"] = false;\n"; + $tmp .= " debug[\"xml_string\"] = false;\n"; + $tmp .= " debug[\"cache\"] = false;\n"; + $tmp .= "\n"; $tmp .= "--additional info\n"; $tmp .= " domain_count = ".count($_SESSION["domains"]).";\n"; $tmp .= correct_path(" temp_dir = [[".$_SESSION['server']['temp']['dir']."]];\n"); diff --git a/core/default_settings/app_defaults.php b/core/default_settings/app_defaults.php index 70ef5f0caf..a058969777 100644 --- a/core/default_settings/app_defaults.php +++ b/core/default_settings/app_defaults.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2010 + Portions created by the Initial Developer are Copyright (C) 2008-2015 the Initial Developer. All Rights Reserved. Contributor(s): @@ -30,12 +30,26 @@ if ($domains_processed == 1) { //define array of settings $x = 0; $array[$x]['default_setting_category'] = 'domain'; + $array[$x]['default_setting_subcategory'] = 'time_zone'; + $array[$x]['default_setting_name'] = 'name'; + $array[$x]['default_setting_value'] = ''; + $array[$x]['default_setting_enabled'] = 'true'; + $array[$x]['default_setting_description'] = ''; + $x++; + $array[$x]['default_setting_category'] = 'domain'; $array[$x]['default_setting_subcategory'] = 'language'; $array[$x]['default_setting_name'] = 'code'; $array[$x]['default_setting_value'] = 'en-us'; $array[$x]['default_setting_enabled'] = 'true'; $array[$x]['default_setting_description'] = ''; $x++; + $array[$x]['default_setting_category'] = 'domain'; + $array[$x]['default_setting_subcategory'] = 'bridge'; + $array[$x]['default_setting_name'] = 'text'; + $array[$x]['default_setting_value'] = 'outbound'; + $array[$x]['default_setting_enabled'] = 'true'; + $array[$x]['default_setting_description'] = 'outbound,loopback,lcr'; + $x++; $array[$x]['default_setting_category'] = 'security'; $array[$x]['default_setting_subcategory'] = 'password_length'; $array[$x]['default_setting_name'] = 'var'; diff --git a/core/default_settings/default_setting_edit.php b/core/default_settings/default_setting_edit.php index c7d6b4b27f..c51a15a101 100644 --- a/core/default_settings/default_setting_edit.php +++ b/core/default_settings/default_setting_edit.php @@ -92,6 +92,38 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { // fix null $default_setting_order = ($default_setting_order != '') ? $default_setting_order : 'null'; + //update switch timezone variables + if ($default_setting_category == "domain" && $default_setting_subcategory == "time_zone" && $default_setting_name == "name" ) { + //get the action + $sql = "select * from v_vars "; + $sql .= "where var_name = 'timezone' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); + $var_action = "add"; + foreach ($result as $row) { + $var_action = "update"; + } + unset ($prep_statement); + + //update the timezone + if ($var_action == "update") { + $sql = "update v_vars "; + $sql .= "set var_value = '".$default_setting_value."' "; + $sql .= "where var_name = 'timezone' "; + } + else { + $sql = "insert into v_vars "; + $sql .= "(var_uuid, var_name, var_value, var_cat, var_enabled) "; + $sql .= "values ('".uuid()."', 'timezone', '$default_setting_value', 'Defaults', 'true'); "; + } + $db->query($sql); + unset($sql); + + //synchronize the configuration + save_var_xml(); + } + if ($action == "add" && permission_exists('default_setting_add')) { $sql = "insert into v_default_settings "; $sql .= "("; @@ -566,4 +598,4 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file diff --git a/core/domain_settings/domain_setting_edit.php b/core/domain_settings/domain_setting_edit.php index d3d07bbf39..d125093b49 100644 --- a/core/domain_settings/domain_setting_edit.php +++ b/core/domain_settings/domain_setting_edit.php @@ -47,9 +47,10 @@ else { $action = "add"; } -if (strlen($_GET["domain_uuid"]) > 0) { - $domain_uuid = check_str($_GET["domain_uuid"]); -} +//set the domain_uuid + if (strlen($_GET["domain_uuid"]) > 0) { + $domain_uuid = check_str($_GET["domain_uuid"]); + } //get http post variables and set them to php variables if (count($_POST) > 0) { @@ -92,7 +93,75 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { //add or update the database if ($_POST["persistformvar"] != "true") { - $domain_setting_order = ($domain_setting_order != '') ? $domain_setting_order : 'null'; + // fix null + $domain_setting_order = ($domain_setting_order != '') ? $domain_setting_order : 'null'; + + //update switch timezone variables + if ($domain_setting_category == "domain" && $domain_setting_subcategory == "time_zone" && $domain_setting_name == "name" ) { + //get the dialplan_uuid + $sql = "select * from v_dialplans "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; + $sql .= "and app_uuid = '9f356fe7-8cf8-4c14-8fe2-6daf89304458' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); + foreach ($result as $row) { + $dialplan_uuid = $row["dialplan_uuid"]; + } + unset ($prep_statement); + + //get the action + $sql = "select * from v_dialplan_details "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; + $sql .= "and dialplan_uuid = '".$dialplan_uuid."' "; + $sql .= "and dialplan_detail_tag = 'action' "; + $sql .= "and dialplan_detail_type = 'set' "; + $sql .= "and dialplan_detail_data like 'timezone=%' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); + $detail_action = "add"; + foreach ($result as $row) { + $dialplan_detail_uuid = $row["dialplan_detail_uuid"]; + $detail_action = "update"; + } + unset ($prep_statement); + + //update the timezone + if ($detail_action == "update") { + $sql = "update v_dialplan_details "; + $sql .= "set dialplan_detail_data = 'timezone=".$domain_setting_value."' "; + $sql .= "where dialplan_detail_uuid = '".$dialplan_detail_uuid."' "; + } + else { + $dialplan_detail_uuid = uuid(); + $dialplan_detail_group = 0; + $sql = "insert into v_dialplan_details "; + $sql .= "("; + $sql .= "domain_uuid, "; + $sql .= "dialplan_detail_uuid, "; + $sql .= "dialplan_uuid, "; + $sql .= "dialplan_detail_tag, "; + $sql .= "dialplan_detail_type, "; + $sql .= "dialplan_detail_data, "; + $sql .= "dialplan_detail_inline, "; + $sql .= "dialplan_detail_group "; + $sql .= ") "; + $sql .= "values "; + $sql .= "("; + $sql .= "'".$domain_uuid."', "; + $sql .= "'".$dialplan_detail_uuid."', "; + $sql .= "'".$dialplan_uuid."', "; + $sql .= "'action', "; + $sql .= "'set', "; + $sql .= "'timezone=".$domain_setting_value."', "; + $sql .= "'true', "; + $sql .= "'".$dialplan_detail_group."' "; + $sql .= "); "; + } + $db->query($sql); + unset($sql); + } //add the domain if ($action == "add" && permission_exists('domain_setting_add')) { diff --git a/core/domain_settings/domains.php b/core/domain_settings/domains.php index 7ddf64c420..47bc275265 100644 --- a/core/domain_settings/domains.php +++ b/core/domain_settings/domains.php @@ -75,7 +75,7 @@ else { $domain->db = $db; $domain->set(); - // on domain change, redirect user + //redirect the user if ($_SESSION["login"]["destination"] != '') { // to default, or domain specific, login destination header("Location: ".PROJECT_PATH.$_SESSION["login"]["destination"]["url"]); @@ -87,10 +87,14 @@ else { } } +//redirect the user + if (file_exists($_SERVER["DOCUMENT_ROOT"]."/app/domains/domains.php")) { + $href = '/app/domains/domains.php'; + } + //includes require_once "resources/header.php"; $document['title'] = $text['title-domains']; - require_once "resources/paging.php"; //get the http values and set them as variables @@ -100,24 +104,6 @@ else { $order = check_str($_GET["order"]); } -//show the header and the search - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
".$text['header-domains']."\n"; - echo "
\n"; - echo " "; - echo " "; - echo "
\n"; - echo "
\n"; - echo " ".$text['description-domains']."

\n"; - echo "
\n"; - //prepare to page the results $sql = "select count(*) as num_rows from v_domains "; if (strlen($search) > 0) { @@ -146,12 +132,12 @@ else { list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page); $offset = $rows_per_page * $page; -//get the list +//get the domains $sql = "select * from v_domains "; if (strlen($search) > 0) { $sql .= "where ("; - $sql .= " domain_name like '%".$search."%' "; - $sql .= " or domain_description like '%".$search."%' "; + $sql .= " domain_name like '%".$search."%' "; + $sql .= " or domain_description like '%".$search."%' "; $sql .= ") "; } if (strlen($order_by) == 0) { @@ -177,6 +163,24 @@ else { $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; +//show the header and the search + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
".$text['header-domains']."\n"; + echo "
\n"; + echo " "; + echo " "; + echo "
\n"; + echo "
\n"; + echo " ".$text['description-domains']."

\n"; + echo "
\n"; + echo "\n"; echo "\n"; echo th_order_by('domain_name', $text['label-domain'], $order_by, $order); @@ -190,7 +194,6 @@ else { echo "\n"; if (count($domains) > 0) { - global $c, $row_style, $text, $v_link_label_edit, $v_link_label_delete; foreach ($domains as $domain_uuid => $domain) { $tr_link = (permission_exists('domain_edit')) ? "href='domain_edit.php?id=".$domain_uuid."'" : null; echo "\n"; @@ -245,4 +248,5 @@ else { //include the footer require_once "resources/footer.php"; + ?> \ No newline at end of file diff --git a/core/user_settings/app_languages.php b/core/user_settings/app_languages.php index 10c282542e..8eee3f3dc0 100644 --- a/core/user_settings/app_languages.php +++ b/core/user_settings/app_languages.php @@ -9,7 +9,7 @@ $text['title-user_dashboard']['pl'] = "Panel użytkowników"; $text['title-user_dashboard']['he'] = "ממשק משתמש"; $text['title-user_dashboard']['uk'] = "Панель користувача"; $text['title-user_dashboard']['sv-se'] = "Användarpanel"; -$text['title-user_dashboard']['de-at'] = "Benutzer-Übersichtsseite"; +$text['title-user_dashboard']['de-at'] = "Benutzerübersicht"; $text['title-user_dashboard']['ro'] = "Panou control utilizator"; $text['title-user_dashboard']['fa'] = ""; $text['title-user_dashboard']['ar-eg'] = "الصفحه الرئيسيه للمستخدم"; @@ -359,7 +359,7 @@ $text['label-followme']['pl'] = "Podążaj za mną"; $text['label-followme']['he'] = "עקוב אחרי"; $text['label-followme']['uk'] = "Follow Me"; $text['label-followme']['sv-se'] = "Följ Mig"; -$text['label-followme']['de-at'] = "Follow Me"; +$text['label-followme']['de-at'] = "Anrufweiterschaltung"; $text['label-followme']['ro'] = "Urmează-mă"; $text['label-followme']['fa'] = ""; $text['label-followme']['ar-eg'] = "خدمة اتبعني"; @@ -457,7 +457,7 @@ $text['label-callforward']['pl'] = "Przekierowanie rozmowy"; $text['label-callforward']['he'] = "עקוב אחרי"; $text['label-callforward']['uk'] = "Переадресація дзвінків"; $text['label-callforward']['sv-se'] = "Vidarekoppling"; -$text['label-callforward']['de-at'] = "Anrufweiterleitung"; +$text['label-callforward']['de-at'] = "Rufumleitung"; $text['label-callforward']['ro'] = "Redirecționare apel"; $text['label-callforward']['fa'] = ""; $text['label-callforward']['ar-eg'] = "تحويل المكالمات"; @@ -471,7 +471,7 @@ $text['header-user_dashboard']['pl'] = "Panel użytkowników"; $text['header-user_dashboard']['he'] = "ממשק משתמש"; $text['header-user_dashboard']['uk'] = "Панель користувача"; $text['header-user_dashboard']['sv-se'] = "Användarpanel"; -$text['header-user_dashboard']['de-at'] = "Benutzer-Übersichtsseite"; +$text['header-user_dashboard']['de-at'] = "Benutzerübersicht"; $text['header-user_dashboard']['ro'] = "Panou control utilizator"; $text['header-user_dashboard']['fa'] = ""; $text['header-user_dashboard']['ar-eg'] = "الصفحه الرئيسيه للمستخدم"; diff --git a/core/user_settings/app_menu.php b/core/user_settings/app_menu.php index 900b3e5024..9f663d7579 100644 --- a/core/user_settings/app_menu.php +++ b/core/user_settings/app_menu.php @@ -29,7 +29,7 @@ $apps[$x]['menu'][1]['title']['pl'] = "Panel użytkowników"; $apps[$x]['menu'][1]['title']['he'] = "ממשק משתמש"; $apps[$x]['menu'][1]['title']['uk'] = "Панель користувача"; $apps[$x]['menu'][1]['title']['sv-se'] = "Användarpanel"; -$apps[$x]['menu'][1]['title']['de-at'] = "Benutzer-Übersichtsseite"; +$apps[$x]['menu'][1]['title']['de-at'] = "Benutzerübersicht"; $apps[$x]['menu'][1]['title']['ro'] = "Panou control utilizator"; $apps[$x]['menu'][1]['title']['ar-eg'] = "الصفحه الرئيسيه للمستخدم"; $apps[$x]['menu'][1]['uuid'] = "92c8ffdb-3c82-4f08-aec0-82421ec41bb5"; diff --git a/core/users/app_languages.php b/core/users/app_languages.php index 6d0316c86b..8c7a342be3 100644 --- a/core/users/app_languages.php +++ b/core/users/app_languages.php @@ -651,7 +651,7 @@ $text['label-additional_info']['ro'] = ""; $text['label-additional_info']['de-at'] = "Zusätzliche Information"; $text['label-additional_info']['he'] = "מידע נוסף"; -$text['header-user_manager']['en-us'] = "User Manager"; +$text['header-user_manager']['en-us'] = "Users"; $text['header-user_manager']['es-cl'] = "Administración de Usuario"; $text['header-user_manager']['pt-pt'] = "Gestão de Utilizadores"; $text['header-user_manager']['fr-fr'] = "Gestion des utilisateurs"; diff --git a/core/users/signup.php b/core/users/signup.php index 458dac1b8e..9d00b2d919 100644 --- a/core/users/signup.php +++ b/core/users/signup.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2012 + Portions created by the Initial Developer are Copyright (C) 2008-2015 the Initial Developer. All Rights Reserved. Contributor(s): @@ -298,12 +298,12 @@ if (count($_POST) > 0 && check_str($_POST["persistform"]) != "1") { echo "
"; echo " "; echo " "; - echo " "; + echo " "; echo " "; echo " "; echo " "; - echo " "; + echo " "; echo " "; echo " "; echo " "; diff --git a/core/users/users.php b/core/users/users.php index 804184c6f4..e3fe2d73c8 100644 --- a/core/users/users.php +++ b/core/users/users.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2013 + Portions created by the Initial Developer are Copyright (C) 2008-2015 the Initial Developer. All Rights Reserved. Contributor(s): @@ -34,6 +34,7 @@ else { exit; } +//additional includes require_once "resources/paging.php"; //set the variables @@ -41,35 +42,6 @@ else { $order = check_str($_GET["order"]); $search_value = check_str($_REQUEST["search_value"]); -//page title and description - echo "
".$text['label-username']."
".$text['label-password']."
".$text['label-confirm_password']."
\n"; - echo ""; - echo "\n"; - echo "\n"; - echo ""; - echo "\n"; - echo ""; - - echo "\n"; - echo "\n"; - echo "\n"; - //get the list of superadmins $superadmins = superadmin_list($db); @@ -157,10 +129,39 @@ else { $sql .= " limit ".$rows_per_page." offset ".$offset." "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - $result_count = count($result); + $users = $prep_statement->fetchAll(PDO::FETCH_NAMED); + $user_count = count($users); unset ($prep_statement, $sql); +//page title and description + echo "
".$text['header-user_manager'].""; - if (permission_exists('user_all')) { - if ($_GET['showall'] == 'true') { - echo "\n"; - echo ""; - } - else { - echo "\n"; - } - } - echo ""; - echo ""; - echo "
\n"; - echo $text['description-user_manager']."\n"; - echo "
\n"; - echo "
\n"; - echo "
\n"; + echo ""; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo ""; + + echo "\n"; + echo "\n"; + echo "\n"; + //alternate the row style $c = 0; $row_style["0"] = "row_style0"; @@ -185,8 +186,8 @@ else { echo "\n"; echo "\n"; - if ($result_count > 0) { - foreach($result as $row) { + if ($user_count > 0) { + foreach($users as $row) { if (if_superadmin($superadmins, $row['user_uuid']) && !if_group("superadmin")) { //hide } else { @@ -233,7 +234,7 @@ else { if ($c==0) { $c=1; } else { $c=0; } } } //end foreach - unset($sql, $result, $row_count); + unset($sql, $users, $user_count); } //end if results echo "\n"; diff --git a/core/users/usersupdate.php b/core/users/usersupdate.php index 56857dc39d..10bab4cc32 100644 --- a/core/users/usersupdate.php +++ b/core/users/usersupdate.php @@ -462,7 +462,7 @@ if (count($_POST) > 0 && $_POST["persistform"] != "1") { echo " "; echo " "; echo " "; - echo " "; + echo " "; echo " "; echo " "; echo " "; diff --git a/resources/functions.php b/resources/functions.php index faffbe9bf5..c1bd498810 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -27,7 +27,7 @@ if (!function_exists('software_version')) { function software_version() { - return '4.0.0'; + return '4.0.1'; } } @@ -771,15 +771,13 @@ function format_string ($format, $data) { //get the format and use it to format the phone number function format_phone($phone_number) { - if (is_numeric($phone_number)) { - foreach ($_SESSION["format"]["phone"] as &$format) { - $format_count = substr_count($format, 'x'); - $format_count = $format_count + substr_count($format, 'R'); - $format_count = $format_count + substr_count($format, 'r'); - if ($format_count == strlen($phone_number)) { - //format the number - $phone_number = format_string($format, $phone_number); - } + foreach ($_SESSION["format"]["phone"] as &$format) { + $format_count = substr_count($format, 'x'); + $format_count = $format_count + substr_count($format, 'R'); + $format_count = $format_count + substr_count($format, 'r'); + if ($format_count == strlen($phone_number)) { + //format the number + $phone_number = format_string($format, $phone_number); } } return $phone_number; @@ -1328,4 +1326,4 @@ function number_pad($number,$n) { } } -?> \ No newline at end of file +?> diff --git a/resources/install/scripts/app/call_block/index.lua b/resources/install/scripts/app/call_block/index.lua index 8821a099ef..91c7056b40 100644 --- a/resources/install/scripts/app/call_block/index.lua +++ b/resources/install/scripts/app/call_block/index.lua @@ -112,6 +112,7 @@ This method causes the script to get its manadatory arguments directly from the --set the cache if (found_cid_num) then -- caller id exists if (found_enabled == "true") then + --set the cache cache = "found_cid_num=" .. found_cid_num .. "&found_uuid=" .. found_uuid .. "&found_enabled=" .. found_enabled .. "&found_action=" .. found_action .. "&found_count=" .. found_count; result = trim(api:execute("memcache", "set app:call_block:" .. params["domain_name"] .. ":" .. params["cid_num"] .. " '"..cache.."' "..expire["call_block"])); @@ -172,15 +173,16 @@ This method causes the script to get its manadatory arguments directly from the if (source == "database") then dbh:query("UPDATE v_call_block SET call_block_count = " .. found_count + 1 .. " WHERE call_block_uuid = '" .. found_uuid .. "'") end - session:setVariable("call_block", "block") + session:execute("set", "call_blocked=true"); logger("W", "NOTICE", "number " .. params["cid_num"] .. " blocked with " .. found_count .. " previous hits, domain_name: " .. params["domain_name"]) if (found_action == "Reject") then session:hangup("CALL_REJECTED") - end - if (found_action == "Busy") then + elseif (found_action == "Busy") then session:hangup("USER_BUSY") - end - if (details[0] =="Voicemail") then + elseif (found_action =="Hold") then + session:setAutoHangup(false) + session:execute("transfer", "*9664") + elseif (details[0] =="Voicemail") then session:setAutoHangup(false) session:execute("transfer", "*99" .. details[2] .. " XML " .. details[1]) end diff --git a/resources/install/scripts/app/conference_center/index.lua b/resources/install/scripts/app/conference_center/index.lua index 58d61f10fb..395db64a75 100644 --- a/resources/install/scripts/app/conference_center/index.lua +++ b/resources/install/scripts/app/conference_center/index.lua @@ -13,7 +13,7 @@ -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- --- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, +-- THIS SOFTWARE IS PROVIDED AS ''IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, -- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, @@ -385,7 +385,7 @@ end --check if someone has already joined the conference - local_hostname = trim(api:execute("hostname", "")); + local_hostname = trim(api:execute("switchname", "")); freeswitch.consoleLog("notice", "[conference center] local_hostname is " .. local_hostname .. "\n"); sql = "SELECT hostname FROM channels WHERE application = 'conference' AND dest = '" .. destination_number .. "' AND cid_num <> '".. caller_id_number .."' LIMIT 1"; if (debug["sql"]) then diff --git a/resources/install/scripts/app/failure_handler/index.lua b/resources/install/scripts/app/failure_handler/index.lua index 6e174911ce..72410b3ddf 100644 --- a/resources/install/scripts/app/failure_handler/index.lua +++ b/resources/install/scripts/app/failure_handler/index.lua @@ -31,43 +31,69 @@ require "resources.functions.config"; require "resources.functions.explode"; require "resources.functions.trim"; + require "resources.functions.base64"; --check the missed calls function missed() if (missed_call_app ~= nil and missed_call_data ~= nil) then if (missed_call_app == "email") then - headers = '{"X-FusionPBX-Domain-UUID":"'..domain_uuid..'",'; - headers = headers..'"X-FusionPBX-Domain-Name":"'..domain_name..'",'; - headers = headers..'"X-FusionPBX-Call-UUID":"'..uuid..'",'; - headers = headers..'"X-FusionPBX-Email-Type":"missed"}'; + --set the sounds path for the language, dialect and voice + default_language = session:getVariable("default_language"); + default_dialect = session:getVariable("default_dialect"); + default_voice = session:getVariable("default_voice"); + if (not default_language) then default_language = 'en'; end + if (not default_dialect) then default_dialect = 'us'; end + if (not default_voice) then default_voice = 'callie'; end - subject = "Missed Call from ${caller_id_name} <${caller_id_number}>"; - subject = subject:gsub("${caller_id_name}", caller_id_name); - subject = subject:gsub("${caller_id_number}", caller_id_number); - subject = subject:gsub("${sip_to_user}", sip_to_user); - subject = subject:gsub("${dialed_user}", dialed_user); + --prepare the files + file_subject = scripts_dir.."/app/missed_calls/resources/templates/"..default_language.."/"..default_dialect.."/email_subject.tpl"; + file_body = scripts_dir.."/app/missed_calls/resources/templates/"..default_language.."/"..default_dialect.."/email_body.tpl"; + if (not file_exists(file_subject)) then + file_subject = scripts_dir.."/app/missed_calls/resources/templates/en/us/email_subject.tpl"; + file_body = scripts_dir.."/app/missed_calls/resources/templates/en/us/email_body.tpl"; + end + + --prepare the headers + headers = '{"X-FusionPBX-Domain-UUID":"'..domain_uuid..'",'; + headers = headers..'"X-FusionPBX-Domain-Name":"'..domain_name..'",'; + headers = headers..'"X-FusionPBX-Call-UUID":"'..uuid..'",'; + headers = headers..'"X-FusionPBX-Email-Type":"missed"}'; - body = "Missed Call from ${caller_id_name} <${caller_id_number}> to ${sip_to_user} ext ${dialed_user}"; - body = body:gsub("${caller_id_name}", caller_id_name); - body = body:gsub("${caller_id_number}", caller_id_number); - body = body:gsub("${sip_to_user}", sip_to_user); - body = body:gsub("${dialed_user}", dialed_user); + --prepare the subject + local f = io.open(file_subject, "r"); + local subject = f:read("*all"); + f:close(); + subject = subject:gsub("${caller_id_name}", caller_id_name); + subject = subject:gsub("${caller_id_number}", caller_id_number); + subject = subject:gsub("${sip_to_user}", sip_to_user); + subject = subject:gsub("${dialed_user}", dialed_user); + subject = trim(subject); + subject = '=?utf-8?B?'..base64.encode(subject)..'?='; - body = body:gsub(" ", " "); - body = body:gsub("%s+", ""); - body = body:gsub(" ", " "); - body = body:gsub("\n", ""); - body = body:gsub("\n", ""); - body = body:gsub("'", "'"); - body = body:gsub([["]], """); - body = trim(body); - - cmd = "luarun email.lua "..missed_call_data.." "..missed_call_data.." "..headers.." '"..subject.."' '"..body.."'"; - if (debug["info"]) then - freeswitch.consoleLog("notice", "[missed call] cmd: " .. cmd .. "\n"); - end - api = freeswitch.API(); - result = api:executeString(cmd); + --prepare the body + local f = io.open(file_body, "r"); + local body = f:read("*all"); + f:close(); + body = body:gsub("${caller_id_name}", caller_id_name); + body = body:gsub("${caller_id_number}", caller_id_number); + body = body:gsub("${sip_to_user}", sip_to_user); + body = body:gsub("${dialed_user}", dialed_user); + body = body:gsub(" ", " "); + body = body:gsub("%s+", ""); + body = body:gsub(" ", " "); + body = body:gsub("\n", ""); + body = body:gsub("\n", ""); + body = body:gsub("'", "'"); + body = body:gsub([["]], """); + body = trim(body); + + --send the email + cmd = "luarun email.lua "..missed_call_data.." "..missed_call_data.." "..headers.." '"..subject.."' '"..body.."'"; + if (debug["info"]) then + freeswitch.consoleLog("notice", "[missed call] cmd: " .. cmd .. "\n"); + end + api = freeswitch.API(); + result = api:executeString(cmd); end end end diff --git a/resources/install/scripts/app/fax/resources/scripts/hangup_rx.lua b/resources/install/scripts/app/fax/resources/scripts/hangup_rx.lua index d70db541e9..81ac0ffd13 100644 --- a/resources/install/scripts/app/fax/resources/scripts/hangup_rx.lua +++ b/resources/install/scripts/app/fax/resources/scripts/hangup_rx.lua @@ -22,6 +22,9 @@ -- Contributor(s): -- Mark J. Crane +--set the debug options + debug["sql"] = false; + --create the api object api = freeswitch.API(); diff --git a/resources/install/scripts/app/hangup/index.lua b/resources/install/scripts/app/hangup/index.lua index 9a77d819cc..fa15e2f520 100644 --- a/resources/install/scripts/app/hangup/index.lua +++ b/resources/install/scripts/app/hangup/index.lua @@ -28,7 +28,8 @@ require "resources.functions.config"; require "resources.functions.explode"; require "resources.functions.trim"; - -- require "resources.functions.file_exists"; + require "resources.functions.base64"; + require "resources.functions.file_exists"; --create the api object api = freeswitch.API(); @@ -37,37 +38,62 @@ function missed() if (missed_call_app ~= nil and missed_call_data ~= nil) then if (missed_call_app == "email") then - headers = '{"X-FusionPBX-Domain-UUID":"'..domain_uuid..'",'; - headers = headers..'"X-FusionPBX-Domain-Name":"'..domain_name..'",'; - headers = headers..'"X-FusionPBX-Call-UUID":"'..uuid..'",'; - headers = headers..'"X-FusionPBX-Email-Type":"missed"}'; + --set the sounds path for the language, dialect and voice + default_language = env:getHeader("default_language"); + default_dialect = env:getHeader("default_dialect"); + default_voice = env:getHeader("default_voice"); + if (not default_language) then default_language = 'en'; end + if (not default_dialect) then default_dialect = 'us'; end + if (not default_voice) then default_voice = 'callie'; end - subject = "Missed Call from ${caller_id_name} <${caller_id_number}>"; - subject = subject:gsub("${caller_id_name}", caller_id_name); - subject = subject:gsub("${caller_id_number}", caller_id_number); - subject = subject:gsub("${sip_to_user}", sip_to_user); - subject = subject:gsub("${dialed_user}", dialed_user); + --prepare the files + file_subject = scripts_dir.."/app/missed_calls/resources/templates/"..default_language.."/"..default_dialect.."/email_subject.tpl"; + file_body = scripts_dir.."/app/missed_calls/resources/templates/"..default_language.."/"..default_dialect.."/email_body.tpl"; + if (not file_exists(file_subject)) then + file_subject = scripts_dir.."/app/missed_calls/resources/templates/en/us/email_subject.tpl"; + file_body = scripts_dir.."/app/missed_calls/resources/templates/en/us/email_body.tpl"; + end - body = "Missed Call from ${caller_id_name} <${caller_id_number}> to ${sip_to_user} ext ${dialed_user}"; - body = body:gsub("${caller_id_name}", caller_id_name); - body = body:gsub("${caller_id_number}", caller_id_number); - body = body:gsub("${sip_to_user}", sip_to_user); - body = body:gsub("${dialed_user}", dialed_user); + --prepare the headers + headers = '{"X-FusionPBX-Domain-UUID":"'..domain_uuid..'",'; + headers = headers..'"X-FusionPBX-Domain-Name":"'..domain_name..'",'; + headers = headers..'"X-FusionPBX-Call-UUID":"'..uuid..'",'; + headers = headers..'"X-FusionPBX-Email-Type":"missed"}'; - body = body:gsub(" ", " "); - body = body:gsub("%s+", ""); - body = body:gsub(" ", " "); - body = body:gsub("\n", ""); - body = body:gsub("\n", ""); - body = body:gsub("'", "'"); - body = body:gsub([["]], """); - body = trim(body); + --prepare the subject + local f = io.open(file_subject, "r"); + local subject = f:read("*all"); + f:close(); + subject = subject:gsub("${caller_id_name}", caller_id_name); + subject = subject:gsub("${caller_id_number}", caller_id_number); + subject = subject:gsub("${sip_to_user}", sip_to_user); + subject = subject:gsub("${dialed_user}", dialed_user); + subject = trim(subject); + subject = '=?utf-8?B?'..base64.encode(subject)..'?='; - cmd = "luarun email.lua "..missed_call_data.." "..missed_call_data.." "..headers.." '"..subject.."' '"..body.."'"; - if (debug["info"]) then - freeswitch.consoleLog("notice", "[missed call] cmd: " .. cmd .. "\n"); - end - result = api:executeString(cmd); + --prepare the body + local f = io.open(file_body, "r"); + local body = f:read("*all"); + f:close(); + body = body:gsub("${caller_id_name}", caller_id_name); + body = body:gsub("${caller_id_number}", caller_id_number); + body = body:gsub("${sip_to_user}", sip_to_user); + body = body:gsub("${dialed_user}", dialed_user); + body = body:gsub(" ", " "); + body = body:gsub("%s+", ""); + body = body:gsub(" ", " "); + body = body:gsub("\n", ""); + body = body:gsub("\n", ""); + body = body:gsub("'", "'"); + body = body:gsub([["]], """); + body = trim(body); + + --send the emails + cmd = "luarun email.lua "..missed_call_data.." "..missed_call_data.." "..headers.." '"..subject.."' '"..body.."'"; + if (debug["info"]) then + freeswitch.consoleLog("notice", "[missed call] cmd: " .. cmd .. "\n"); + end + result = api:executeString(cmd); end end end diff --git a/resources/install/scripts/app/missed_calls/resources/templates/en/us/email_body.tpl b/resources/install/scripts/app/missed_calls/resources/templates/en/us/email_body.tpl new file mode 100644 index 0000000000..cde2b1bac3 --- /dev/null +++ b/resources/install/scripts/app/missed_calls/resources/templates/en/us/email_body.tpl @@ -0,0 +1 @@ +Missed Call from ${caller_id_name} <${caller_id_number}> to ${sip_to_user} ext ${dialed_user} \ No newline at end of file diff --git a/resources/install/scripts/app/missed_calls/resources/templates/en/us/email_subject.tpl b/resources/install/scripts/app/missed_calls/resources/templates/en/us/email_subject.tpl new file mode 100644 index 0000000000..0b961e6975 --- /dev/null +++ b/resources/install/scripts/app/missed_calls/resources/templates/en/us/email_subject.tpl @@ -0,0 +1 @@ +Missed Call from ${caller_id_name} <${caller_id_number}> \ No newline at end of file diff --git a/resources/install/scripts/app/provision/index.lua b/resources/install/scripts/app/provision/index.lua index 5eba2c844a..0173356e3b 100644 --- a/resources/install/scripts/app/provision/index.lua +++ b/resources/install/scripts/app/provision/index.lua @@ -121,7 +121,22 @@ result = session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/voicemail/vm-fail_auth.wav"); end ---remove the previous device and send a sync command to it +--this device already has an alternate find the correct device_uuid and then override current one + if (authorized == 'true' and action == "login" and device_uuid_alternate ~= nil) then + sql = [[SELECT * FROM v_devices ]]; + sql = sql .. [[WHERE device_uuid_alternate = ']]..device_uuid..[[' ]]; + sql = sql .. [[AND domain_uuid = ']]..domain_uuid..[[' ]]; + if (debug["sql"]) then + freeswitch.consoleLog("NOTICE", "[provision] sql: ".. sql .. "\n"); + end + dbh:query(sql, function(row) + if (row.device_uuid_alternate ~= nil) then + device_uuid = row.device_uuid; + end + end); + end + +--remove the alternate device from another device so that it can be added to this device if (authorized == 'true' and action == "login") then sql = [[SELECT * FROM v_device_lines ]]; sql = sql .. [[WHERE device_uuid = ']]..device_uuid_alternate..[[' ]]; @@ -135,7 +150,7 @@ sql = sql .. [[WHERE device_uuid_alternate = ']]..device_uuid_alternate..[[' ]]; sql = sql .. [[AND domain_uuid = ']]..domain_uuid..[[' ]]; if (debug["sql"]) then - --freeswitch.consoleLog("NOTICE", "[provision] sql: ".. sql .. "\n"); + freeswitch.consoleLog("NOTICE", "[provision] sql: ".. sql .. "\n"); end dbh:query(sql); --send a sync command to the previous device diff --git a/resources/install/scripts/app/ring_groups/index.lua b/resources/install/scripts/app/ring_groups/index.lua index 0cbc8832f5..25e07493f7 100644 --- a/resources/install/scripts/app/ring_groups/index.lua +++ b/resources/install/scripts/app/ring_groups/index.lua @@ -12,7 +12,7 @@ -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- --- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, +-- THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, -- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, @@ -27,6 +27,8 @@ -- Mark J Crane -- Luis Daniel Lucio Qurioz +local log = require "resources.functions.log".ring_group + --connect to the database require "resources.functions.database_handle"; dbh = database_handle('system'); @@ -34,6 +36,9 @@ --include functions require "resources.functions.trim"; require "resources.functions.explode"; + require "resources.functions.base64"; + require "resources.functions.file_exists"; + require "resources.functions.channel_utils" --get the variables domain_name = session:getVariable("domain_name"); @@ -97,6 +102,7 @@ status = dbh:query(sql, function(row) domain_uuid = row["domain_uuid"]; ring_group_name = row["ring_group_name"]; + ring_group_extension = row["ring_group_extension"]; ring_group_forward_enabled = row["ring_group_forward_enabled"]; ring_group_forward_destination = row["ring_group_forward_destination"]; ring_group_cid_name_prefix = row["ring_group_cid_name_prefix"]; @@ -119,36 +125,67 @@ function missed() if (missed_call_app ~= nil and missed_call_data ~= nil) then if (missed_call_app == "email") then - headers = '{"X-FusionPBX-Domain-UUID":"'..domain_uuid..'",'; - headers = headers..'"X-FusionPBX-Domain-Name":"'..domain_name..'",'; - headers = headers..'"X-FusionPBX-Call-UUID":"'..uuid..'",'; - headers = headers..'"X-FusionPBX-Email-Type":"missed"}'; + --set the sounds path for the language, dialect and voice + default_language = session:getVariable("default_language"); + default_dialect = session:getVariable("default_dialect"); + default_voice = session:getVariable("default_voice"); + if (not default_language) then default_language = 'en'; end + if (not default_dialect) then default_dialect = 'us'; end + if (not default_voice) then default_voice = 'callie'; end - subject = "Missed Call from ${caller_id_name} <${caller_id_number}> ${ring_group_name}"; - subject = subject:gsub("${caller_id_name}", caller_id_name); - subject = subject:gsub("${caller_id_number}", caller_id_number); - subject = subject:gsub("${ring_group_name}", ring_group_name); + --prepare the files + file_subject = scripts_dir.."/app/missed_calls/resources/templates/"..default_language.."/"..default_dialect.."/email_subject.tpl"; + file_body = scripts_dir.."/app/missed_calls/resources/templates/"..default_language.."/"..default_dialect.."/email_body.tpl"; + if (not file_exists(file_subject)) then + file_subject = scripts_dir.."/app/missed_calls/resources/templates/en/us/email_subject.tpl"; + file_body = scripts_dir.."/app/missed_calls/resources/templates/en/us/email_body.tpl"; + end - body = "Missed Call from ${caller_id_name} <${caller_id_number}> to ${ring_group_name}"; - body = body:gsub("${caller_id_name}", caller_id_name); - body = body:gsub("${caller_id_number}", caller_id_number); - body = body:gsub("${ring_group_name}", ring_group_name); + --prepare the headers + headers = '{"X-FusionPBX-Domain-UUID":"'..domain_uuid..'",'; + headers = headers..'"X-FusionPBX-Domain-Name":"'..domain_name..'",'; + headers = headers..'"X-FusionPBX-Call-UUID":"'..uuid..'",'; + headers = headers..'"X-FusionPBX-Email-Type":"missed"}'; - body = body:gsub(" ", " "); - body = body:gsub("%s+", ""); - body = body:gsub(" ", " "); - body = body:gsub("\n", ""); - body = body:gsub("\n", ""); - body = body:gsub("'", "'"); - body = body:gsub([["]], """); - body = trim(body); + --prepare the subject + local f = io.open(file_subject, "r"); + local subject = f:read("*all"); + f:close(); + subject = subject:gsub("${caller_id_name}", caller_id_name); + subject = subject:gsub("${caller_id_number}", caller_id_number); + subject = subject:gsub("${ring_group_name}", ring_group_name); + subject = subject:gsub("${ring_group_extension}", ring_group_extension); + subject = subject:gsub("${sip_to_user}", ring_group_name); + subject = subject:gsub("${dialed_user}", ring_group_extension); + subject = trim(subject); + subject = '=?utf-8?B?'..base64.encode(subject)..'?='; - cmd = "luarun email.lua "..missed_call_data.." "..missed_call_data.." "..headers.." '"..subject.."' '"..body.."'"; - if (debug["info"]) then - freeswitch.consoleLog("notice", "[missed call] cmd: " .. cmd .. "\n"); - end - api = freeswitch.API(); - result = api:executeString(cmd); + --prepare the body + local f = io.open(file_body, "r"); + local body = f:read("*all"); + f:close(); + body = body:gsub("${caller_id_name}", caller_id_name); + body = body:gsub("${caller_id_number}", caller_id_number); + body = body:gsub("${ring_group_name}", ring_group_name); + body = body:gsub("${ring_group_extension}", ring_group_extension); + body = body:gsub("${sip_to_user}", ring_group_name); + body = body:gsub("${dialed_user}", ring_group_extension); + body = body:gsub(" ", " "); + body = body:gsub("%s+", ""); + body = body:gsub(" ", " "); + body = body:gsub("\n", ""); + body = body:gsub("\n", ""); + body = body:gsub("'", "'"); + body = body:gsub([["]], """); + body = trim(body); + + --send the email + cmd = "luarun email.lua "..missed_call_data.." "..missed_call_data.." "..headers.." '"..subject.."' '"..body.."'"; + if (debug["info"]) then + freeswitch.consoleLog("notice", "[missed call] cmd: " .. cmd .. "\n"); + end + api = freeswitch.API(); + result = api:executeString(cmd); end end end @@ -158,6 +195,31 @@ --forward the ring group session:execute("transfer", ring_group_forward_destination.." XML "..context); else + --get the strategy of the ring group, if random, we use random() to order the destinations + sql = [[ + SELECT + r.ring_group_strategy + FROM + v_ring_groups as r + WHERE + ring_group_uuid = ']]..ring_group_uuid..[[' + AND r.domain_uuid = ']]..domain_uuid..[[' + AND r.ring_group_enabled = 'true' + ]]; + + + assert(dbh:query(sql, function(row) + if (row.ring_group_strategy == "random") then + if (database["type"] == "mysql") then + sql_order = 'rand()' + else + sql_order = 'random()' --both postgresql and sqlite uses random() instead of rand() + end + else + sql_order='d.destination_delay, d.destination_number asc' + end + end)); + --get the ring group destinations sql = [[ SELECT @@ -172,7 +234,7 @@ AND r.domain_uuid = ']]..domain_uuid..[[' AND r.ring_group_enabled = 'true' ORDER BY - d.destination_delay, d.destination_number asc + ]]..sql_order..[[ ]]; --freeswitch.consoleLog("notice", "SQL:" .. sql .. "\n"); destinations = {}; @@ -291,6 +353,9 @@ if (ring_group_strategy == "sequence") then delimiter = "|"; end + if (ring_group_strategy == "random") then + delimiter = "|"; + end if (ring_group_strategy == "simultaneous") then delimiter = ","; end @@ -374,23 +439,10 @@ extension_uuid = trim(api:executeString(cmd)); --send to user local dial_string_to_user = "[sip_invite_domain="..domain_name..","..group_confirm.."leg_timeout="..destination_timeout..","..delay_name.."="..destination_delay..",dialed_extension=" .. row.destination_number .. ",extension_uuid="..extension_uuid .. row.record_session .. "]user/" .. row.destination_number .. "@" .. domain_name; - if (ring_group_skip_active ~= nil) then - if (ring_group_skip_active == "true") then - cmd = "show channels like "..destination_number; - reply = trim(api:executeString(cmd)); - --freeswitch.consoleLog("notice", "[ring group] reply "..cmd.." " .. reply .. "\n"); - if (reply == "0 total.") then - dial_string = dial_string_to_user - else - if (string.find(reply, domain_name)) then - --active call - else - dial_string = dial_string_to_user; - end - end - else - --look inside the reply to check for the correct domain_name - dial_string = dial_string_to_user; + if (ring_group_skip_active == "true") then + local channels = channels_by_number(destination_number, domain_name) + if (not channels) or #channels == 0 then + dial_string = dial_string_to_user end else dial_string = dial_string_to_user; @@ -562,23 +614,27 @@ app_data = app_data:gsub("%]", "}"); end freeswitch.consoleLog("NOTICE", "[ring group] app_data: "..app_data.."\n"); + -- log.noticef("bridge begin: originate_disposition:%s answered:%s ready:%s bridged:%s", session:getVariable("originate_disposition"), session:answered() and "true" or "false", session:ready() and "true" or "false", session:bridged() and "true" or "false") session:execute("bridge", app_data); + -- log.noticef("bridge done: originate_disposition:%s answered:%s ready:%s bridged:%s", session:getVariable("originate_disposition"), session:answered() and "true" or "false", session:ready() and "true" or "false", session:bridged() and "true" or "false") end --timeout destination if (app_data ~= nil) then - if (session:getVariable("originate_disposition") == "ALLOTTED_TIMEOUT" + if session:ready() and ( + session:getVariable("originate_disposition") == "ALLOTTED_TIMEOUT" or session:getVariable("originate_disposition") == "NO_ANSWER" or session:getVariable("originate_disposition") == "NO_USER_RESPONSE" or session:getVariable("originate_disposition") == "USER_NOT_REGISTERED" or session:getVariable("originate_disposition") == "NORMAL_TEMPORARY_FAILURE" or session:getVariable("originate_disposition") == "NO_ROUTE_DESTINATION" or session:getVariable("originate_disposition") == "USER_BUSY" - or session:getVariable("originate_disposition") == "failure") then - --send missed call notification - missed(); - --execute the time out action - session:execute(ring_group_timeout_app, ring_group_timeout_data); + or session:getVariable("originate_disposition") == "failure" + ) then + --send missed call notification + missed(); + --execute the time out action + session:execute(ring_group_timeout_app, ring_group_timeout_data); end else if (ring_group_timeout_app ~= nil) then diff --git a/resources/install/scripts/app/voicemail/index.lua b/resources/install/scripts/app/voicemail/index.lua index 056127af3b..ee9e79e5cd 100644 --- a/resources/install/scripts/app/voicemail/index.lua +++ b/resources/install/scripts/app/voicemail/index.lua @@ -73,6 +73,7 @@ skip_instructions = session:getVariable("skip_instructions"); skip_greeting = session:getVariable("skip_greeting"); vm_message_ext = session:getVariable("vm_message_ext"); + vm_say_caller_id_number = session:getVariable("vm_say_caller_id_number"); vm_disk_quota = session:getVariable("vm-disk-quota"); if (not vm_disk_quota) then vm_disk_quota = session:getVariable("vm_disk_quota"); diff --git a/resources/install/scripts/app/voicemail/resources/functions/listen_to_recording.lua b/resources/install/scripts/app/voicemail/resources/functions/listen_to_recording.lua index cf4971e5e2..81b763f044 100644 --- a/resources/install/scripts/app/voicemail/resources/functions/listen_to_recording.lua +++ b/resources/install/scripts/app/voicemail/resources/functions/listen_to_recording.lua @@ -31,20 +31,34 @@ max_digits = 1; --flush dtmf digits from the input buffer session:flushDigits(); + --set the callback function + if (session:ready()) then + session:setVariable("playback_terminators", "#"); + session:setInputCallback("on_dtmf", ""); + end --set the display if (session:ready()) then reply = api:executeString("uuid_display "..session:get_uuid().." "..caller_id_number); end --say the message number if (session:ready()) then - if (string.len(dtmf_digits) == 0) then + if (string.len(dtmf_digits) == 0) then dtmf_digits = macro(session, "message_number", 1, 100, ''); end end --say the number if (session:ready()) then if (string.len(dtmf_digits) == 0) then - session:say(message_number, default_language, "NUMBER", "pronounced"); + session:say(message_number, default_language, "number", "pronounced"); + end + end + --say the caller id number + if (session:ready() and caller_id_number ~= nil) then + if (vm_say_caller_id_number ~= nil) then + if (vm_say_caller_id_number == "true") then + session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/voicemail/vm-message_from.wav"); + session:say(caller_id_number, default_language, "name_spelled", "iterated"); + end end end --say the message date @@ -53,10 +67,9 @@ if (current_time_zone ~= nil) then session:execute("set", "timezone="..current_time_zone..""); end - session:say(created_epoch, default_language, "CURRENT_DATE_TIME", "pronounced"); + session:say(created_epoch, default_language, "current_date_time", "pronounced"); end end - --get the recordings from the database if (storage_type == "base64") then sql = [[SELECT * FROM v_voicemail_messages diff --git a/resources/install/scripts/app/voicemail/resources/functions/message_waiting.lua b/resources/install/scripts/app/voicemail/resources/functions/message_waiting.lua index 176910f5a6..b1225075bc 100644 --- a/resources/install/scripts/app/voicemail/resources/functions/message_waiting.lua +++ b/resources/install/scripts/app/voicemail/resources/functions/message_waiting.lua @@ -32,9 +32,9 @@ sql = [[SELECT extension, number_alias from v_extensions WHERE domain_uuid = ']] .. domain_uuid ..[[' AND (mwi_account = ']]..voicemail_id..[[' or mwi_account = ']]..voicemail_id..[[@]]..domain_name..[[')]]; - --if (debug["sql"]) then + if (debug["sql"]) then freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "\n"); - --end + end status = dbh:query(sql, function(row) if (string.len(row["number_alias"]) > 0) then table.insert(accounts, row["number_alias"]); @@ -74,4 +74,4 @@ event:addHeader("MWI-Voice-Message", message_count.."/0 ("..message_count.."/0)"); event:fire(); end - end \ No newline at end of file + end diff --git a/resources/install/scripts/app/voicemail/resources/functions/send_email.lua b/resources/install/scripts/app/voicemail/resources/functions/send_email.lua index f00cb942a5..7009932369 100644 --- a/resources/install/scripts/app/voicemail/resources/functions/send_email.lua +++ b/resources/install/scripts/app/voicemail/resources/functions/send_email.lua @@ -131,6 +131,8 @@ body = body:gsub("${message_duration}", message_length_formatted); body = body:gsub("${account}", id); body = body:gsub("${domain_name}", domain_name); + body = body:gsub("${sip_to_user}", id); + body = body:gsub("${dialed_user}", id); if (voicemail_file == "attach") then body = body:gsub("${message}", text['label-attached'][default_language.."-"..default_dialect]); elseif (voicemail_file == "link") then diff --git a/resources/install/scripts/app/voicemail/resources/scripts/mwi.lua b/resources/install/scripts/app/voicemail/resources/scripts/mwi.lua index 82d9d17973..33d48e8068 100644 --- a/resources/install/scripts/app/voicemail/resources/scripts/mwi.lua +++ b/resources/install/scripts/app/voicemail/resources/scripts/mwi.lua @@ -99,7 +99,7 @@ --send the message waiting event local event = freeswitch.Event("message_waiting"); - if (row["message_count"] == "0") then + if (new_messages == "0") then event:addHeader("MWI-Messages-Waiting", "no"); else event:addHeader("MWI-Messages-Waiting", "yes"); diff --git a/resources/install/scripts/app/voicemail/resources/templates/de/at/email_body.tpl b/resources/install/scripts/app/voicemail/resources/templates/de/at/email_body.tpl index 3d459931aa..7430f13f03 100644 --- a/resources/install/scripts/app/voicemail/resources/templates/de/at/email_body.tpl +++ b/resources/install/scripts/app/voicemail/resources/templates/de/at/email_body.tpl @@ -1,61 +1,61 @@ -
".$text['header-user_manager']." (".$num_rows.")"; + if (permission_exists('user_all')) { + if ($_GET['showall'] == 'true') { + echo "\n"; + echo ""; + } + else { + echo "\n"; + } + } + echo ""; + echo ""; + echo "
\n"; + echo $text['description-user_manager']."\n"; + echo "
\n"; + echo "
\n"; + echo "
".$text['label-username'].""; if (if_group("admin") || if_group("superadmin")) { - echo " "; + echo " "; } else { echo " ".$username; @@ -472,7 +472,7 @@ if (count($_POST) > 0 && $_POST["persistform"] != "1") { echo "
".$text['label-password']."
".$text['label-confirm_password']."
- - - - - - -
-Neue Sprachnachricht -
- - - - - - - - - - - - - - - - - - -
-Nebenstelle - -${account}@${domain_name} -
-Anrufer - -${caller_id_number} -
-Nachricht - -${message} -
-Länge - -${message_duration} -
-
+ + + + + + + +
+ Neue Sprachnachricht +
+ + + + + + + + + + + + + + + + + + +
+ Nebenstelle + + ${account} +
+ Anrufer + + ${caller_id_number} +
+ Nachricht + + ${message} +
+ Länge + + ${message_duration} +
+
diff --git a/resources/install/scripts/app/voicemail/resources/templates/de/de/email_body.tpl b/resources/install/scripts/app/voicemail/resources/templates/de/de/email_body.tpl index 3d459931aa..82275cbc2b 100644 --- a/resources/install/scripts/app/voicemail/resources/templates/de/de/email_body.tpl +++ b/resources/install/scripts/app/voicemail/resources/templates/de/de/email_body.tpl @@ -1,61 +1,61 @@ - - - - - - - -
-Neue Sprachnachricht -
- - - - - - - - - - - - - - - - - - -
-Nebenstelle - -${account}@${domain_name} -
-Anrufer - -${caller_id_number} -
-Nachricht - -${message} -
-Länge - -${message_duration} -
-
+ + + + + + + +
+ Neue Sprachnachricht +
+ + + + + + + + + + + + + + + + + + +
+ Nebenstelle + + ${account} +
+ Anrufer + + ${caller_id_number} +
+ Nachricht + + ${message} +
+ Länge + + ${message_duration} +
+
diff --git a/resources/install/scripts/app/voicemail/resources/templates/en/us/email_body.tpl b/resources/install/scripts/app/voicemail/resources/templates/en/us/email_body.tpl index 4c1d78b5f9..34cb21aaf7 100644 --- a/resources/install/scripts/app/voicemail/resources/templates/en/us/email_body.tpl +++ b/resources/install/scripts/app/voicemail/resources/templates/en/us/email_body.tpl @@ -1,61 +1,61 @@ - - - - - - - -
-New Voicemail -
- - - - - - - - - - - - - - - - - - -
-To - -${account}@${domain_name} -
-From - -${caller_id_number} -
-Message - -${message} -
-Length - -${message_duration} -
-
+ + + + + + + +
+ New Voicemail +
+ + + + + + + + + + + + + + + + + + +
+ To + + ${account} +
+ From + + ${caller_id_number} +
+ Message + + ${message} +
+ Length + + ${message_duration} +
+
\ No newline at end of file diff --git a/resources/install/scripts/app/xml_handler/index.lua b/resources/install/scripts/app/xml_handler/index.lua index d3aabc7f0c..5bc9b52be7 100644 --- a/resources/install/scripts/app/xml_handler/index.lua +++ b/resources/install/scripts/app/xml_handler/index.lua @@ -23,22 +23,6 @@ -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ---set defaults - expire = {} - expire["directory"] = "3600"; - expire["dialplan"] = "3600"; - expire["languages"] = "3600"; - expire["sofia.conf"] = "3600"; - expire["acl.conf"] = "3600"; - load_balancing = false; - ---set the debug options - debug["params"] = false; - debug["sql"] = false; - debug["xml_request"] = false; - debug["xml_string"] = false; - debug["cache"] = false; - --general functions require "resources.functions.trim"; require "resources.functions.file_exists"; diff --git a/resources/install/scripts/app/xml_handler/resources/scripts/configuration/sofia.conf.lua b/resources/install/scripts/app/xml_handler/resources/scripts/configuration/sofia.conf.lua index 6656f619f3..a05f14188c 100644 --- a/resources/install/scripts/app/xml_handler/resources/scripts/configuration/sofia.conf.lua +++ b/resources/install/scripts/app/xml_handler/resources/scripts/configuration/sofia.conf.lua @@ -1,6 +1,6 @@ -- xml_handler.lua -- Part of FusionPBX --- Copyright (C) 2013 Mark J Crane +-- Copyright (C) 2013 - 2015 Mark J Crane -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -116,9 +116,10 @@ sql = sql .. "and g.enabled = 'true' "; sql = sql .. "and (g.domain_uuid = d.domain_uuid or g.domain_uuid is null) "; else - sql = "select * from v_gateways "; - sql = sql .. "where enabled = 'true' and profile = '"..sip_profile_name.."' "; + sql = "select * from v_gateways as g "; + sql = sql .. "where g.enabled = 'true' and g.profile = '"..sip_profile_name.."' "; end + sql = sql .. "and (g.hostname = '" .. hostname.. "' or g.hostname is null or g.hostname = '') "; if (debug["sql"]) then freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "\n"); end diff --git a/resources/install/scripts/app/xml_handler/resources/scripts/dialplan/dialplan.lua b/resources/install/scripts/app/xml_handler/resources/scripts/dialplan/dialplan.lua index c838fcf782..5ccc18f06b 100644 --- a/resources/install/scripts/app/xml_handler/resources/scripts/dialplan/dialplan.lua +++ b/resources/install/scripts/app/xml_handler/resources/scripts/dialplan/dialplan.lua @@ -24,15 +24,22 @@ -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. + local cache = require"resources.functions.cache" + local log = require"resources.functions.log"["xml_handler"] + --get the cache - if (trim(api:execute("module_exists", "mod_memcache")) == "true") then - XML_STRING = trim(api:execute("memcache", "get dialplan:" .. call_context)); - else - XML_STRING = "-ERR NOT FOUND"; + XML_STRING, err = cache.get("dialplan:" .. call_context) + + if debug['cache'] then + if XML_STRING then + log.notice("dialplan:"..call_context.." source: memcache"); + elseif err ~= 'NOT FOUND' then + log.notice("error get element form cache: " .. err); + end end --set the cache - if (XML_STRING == "-ERR NOT FOUND") then + if not XML_STRING then --connect to the database require "resources.functions.database_handle"; @@ -99,7 +106,7 @@ sql = sql .. "ELSE 100 END, "; sql = sql .. "s.dialplan_detail_order asc "; if (debug["sql"]) then - freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "\n"); + log.notice("SQL: " .. sql); end x = 0; dbh:query(sql, function(row) @@ -287,8 +294,9 @@ XML_STRING = table.concat(xml, "\n"); --set the cache - tmp = XML_STRING:gsub("\\", "\\\\"); - result = trim(api:execute("memcache", "set dialplan:" .. call_context .. " '"..tmp:gsub("'", "'").."' "..expire["dialplan"])); + if cache.support() then + cache.set("dialplan:" .. call_context, XML_STRING, expire["dialplan"]) + end --send the xml to the console if (debug["xml_string"]) then @@ -299,17 +307,10 @@ --send to the console if (debug["cache"]) then - freeswitch.consoleLog("notice", "[xml_handler] dialplan:"..call_context.." source: database\n"); + log.notice("dialplan:"..call_context.." source: database"); end --close the database connection dbh:release(); - else - --replace the ' back to a single quote - XML_STRING = XML_STRING:gsub("'", "'"); - - --send to the console - if (debug["cache"]) then - freeswitch.consoleLog("notice", "[xml_handler] dialplan:"..call_context.." source: memcache\n"); - end end + diff --git a/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua b/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua index 0b0d601ad9..325a2685e5 100644 --- a/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua +++ b/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua @@ -99,13 +99,13 @@ dialed_extension = params:getHeader("dialed_extension"); if (dialed_extension == nil) then --freeswitch.consoleLog("notice", "[xml_handler-directory.lua] dialed_extension is null\n"); - load_balancing = false; + xml_handler["fs_path"] = false; else --freeswitch.consoleLog("notice", "[xml_handler-directory.lua] dialed_extension is " .. dialed_extension .. "\n"); end --build the XML string from the database - if (source == "database") or (load_balancing) then + if (source == "database") or (xml_handler["fs_path"]) then --database connection if (continue) then --connect to the database @@ -138,7 +138,7 @@ --if load balancing is set to true then get the hostname if (continue) then - if (load_balancing) then + if (xml_handler["fs_path"]) then --get the domain_name from domains if (domain_name == nil) then @@ -181,9 +181,9 @@ --freeswitch.consoleLog("notice", "[xml_handler] sql: " .. sql .. "\n"); --freeswitch.consoleLog("notice", "[xml_handler-directory.lua] database_hostname is " .. database_hostname .. "\n"); - --hostname was not found set load_balancing to false to prevent a database_hostname concatenation error + --hostname was not found set xml_handler["fs_path"] to false to prevent a database_hostname concatenation error if (database_hostname == nil) then - load_balancing = false; + xml_handler["fs_path"] = false; end --close the database connection @@ -244,6 +244,7 @@ sip_force_expires = row.sip_force_expires; nibble_account = row.nibble_account; sip_bypass_media = row.sip_bypass_media; + absolute_codec_string = row.absolute_codec_string; forward_all_enabled = row.forward_all_enabled; forward_all_destination = row.forward_all_destination; forward_busy_enabled = row.forward_busy_enabled; @@ -261,7 +262,7 @@ dial_string = "{sip_invite_domain=" .. domain_name .. ",presence_id=" .. user .. "@" .. domain_name .. "}${sofia_contact(" .. extension .. "@" .. domain_name .. ")}"; end --set the an alternative dial string if the hostnames don't match - if (load_balancing) then + if (xml_handler["fs_path"]) then if (local_hostname == database_hostname) then freeswitch.consoleLog("notice", "[xml_handler-directory.lua] local_host and database_host are the same\n"); else @@ -271,13 +272,13 @@ --freeswitch.consoleLog("notice", "[xml_handler-directory.lua] dial_string " .. dial_string .. "\n"); end else - --freeswitch.consoleLog("notice", "[xml_handler-directory.lua] seems balancing is false??" .. tostring(load_balancing) .. "\n"); + --freeswitch.consoleLog("notice", "[xml_handler-directory.lua] seems balancing is false??" .. tostring(xml_handler["fs_path"]) .. "\n"); end --show debug informationa - --if (load_balancing) then - -- freeswitch.consoleLog("notice", "[xml_handler] local_hostname: " .. local_hostname.. " database_hostname: " .. database_hostname .. " dial_string: " .. dial_string .. "\n"); - --end + if (xml_handler["fs_path"]) then + freeswitch.consoleLog("notice", "[xml_handler] local_hostname: " .. local_hostname.. " database_hostname: " .. database_hostname .. " dial_string: " .. dial_string .. "\n"); + end end end); end @@ -437,7 +438,7 @@ table.insert(xml, [[ ]]); end if (string.len(sip_force_contact) > 0) then - table.insert(xml, [[ ]]); + table.insert(xml, [[ ]]); end if (string.len(sip_force_expires) > 0) then table.insert(xml, [[ ]]); @@ -445,9 +446,13 @@ if (string.len(nibble_account) > 0) then table.insert(xml, [[ ]]); end + if (string.len(absolute_codec_string) > 0) then + table.insert(xml, [[ ]]); + end if (sip_bypass_media == "bypass-media") then table.insert(xml, [[ ]]); end + if (sip_bypass_media == "bypass-media-after-bridge") then table.insert(xml, [[ ]]); end diff --git a/resources/install/scripts/app/xml_handler/resources/scripts/languages/languages.lua b/resources/install/scripts/app/xml_handler/resources/scripts/languages/languages.lua index 86047db948..6254bff9de 100644 --- a/resources/install/scripts/app/xml_handler/resources/scripts/languages/languages.lua +++ b/resources/install/scripts/app/xml_handler/resources/scripts/languages/languages.lua @@ -144,14 +144,14 @@ --read root xml language file, parse included xml files local xml_file_paths = {} - local file_handle = io.open("/usr/local/freeswitch/conf/lang/"..language.."/"..language..".xml", "r"); + local file_handle = io.open(phrases_dir.."/"..language.."/"..language..".xml", "r"); if (file_handle ~= nil) then for file_line in file_handle:lines() do if (string.find(file_line, 'cmd="include" data="', 0, true) ~= nil) then pos_beg = string.find(file_line, 'cmd="include" data="', 0, true) + 20; pos_end = string.find(file_line, '"/>', 0, true) - 1; xml_file_path = string.sub(file_line, pos_beg, pos_end); - table.insert(xml_file_paths, "/usr/local/freeswitch/conf/lang/"..language.."/"..xml_file_path); + table.insert(xml_file_paths, lang_path.."/"..language.."/"..xml_file_path); --freeswitch.consoleLog("notice", "file path = "..xml_file_path.."\n"); end end diff --git a/resources/install/scripts/call_flow.lua b/resources/install/scripts/call_flow.lua index a8298a067c..2b51b6d33b 100644 --- a/resources/install/scripts/call_flow.lua +++ b/resources/install/scripts/call_flow.lua @@ -35,6 +35,10 @@ require "resources.functions.database_handle"; dbh = database_handle('system'); + local log = require "resources.functions.log".call_flow + + local presence_in = require "resources.functions.presence_in" + if (session:ready()) then --get the variables domain_name = session:getVariable("domain_name"); @@ -51,11 +55,9 @@ if (session:ready()) then if (not default_voice) then default_voice = 'callie'; end --get the extension list - sql = [[SELECT * FROM v_call_flows - where call_flow_uuid = ']]..call_flow_uuid..[[']] - --and call_flow_enabled = 'true' - --freeswitch.consoleLog("notice", "SQL:" .. sql .. "\n"); - app_data = ""; + sql = "SELECT * FROM v_call_flows where call_flow_uuid = '"..call_flow_uuid.."'" + -- .. "and call_flow_enabled = 'true'" + --log.notice("SQL: %s", sql); x = 0; dbh:query(sql, function(row) @@ -68,17 +70,15 @@ if (session:ready()) then call_flow_label = row.call_flow_label; call_flow_anti_label = row.call_flow_anti_label; - if (string.len(call_flow_status) == 0) then + if #call_flow_status == 0 then + call_flow_status = "true"; + end + if (call_flow_status == "true") then app = row.call_flow_app; data = row.call_flow_data else - if (call_flow_status == "true") then - app = row.call_flow_app; - data = row.call_flow_data - else - app = row.call_flow_anti_app; - data = row.call_flow_anti_data - end + app = row.call_flow_anti_app; + data = row.call_flow_anti_data end end); @@ -99,70 +99,34 @@ if (session:ready()) then end --feature code - toggle the status - if (string.len(call_flow_status) == 0) then - toggle = "false"; - else - if (call_flow_status == "true") then - toggle = "false"; - else - toggle = "true"; - end - end - if (toggle == "true") then - --set the presence to terminated - turn the lamp off: - event = freeswitch.Event("PRESENCE_IN"); - event:addHeader("proto", "sip"); - event:addHeader("event_type", "presence"); - event:addHeader("alt_event_type", "dialog"); - event:addHeader("Presence-Call-Direction", "outbound"); - event:addHeader("state", "Active (1 waiting)"); - event:addHeader("from", call_flow_feature_code.."@"..domain_name); - event:addHeader("login", call_flow_feature_code.."@"..domain_name); - event:addHeader("unique-id", call_flow_uuid); - event:addHeader("answer-state", "terminated"); - event:fire(); - --answer and play a tone - session:answer(); - if (string.len(call_flow_label) > 0) then - api = freeswitch.API(); - reply = api:executeString("uuid_display "..session:get_uuid().." "..call_flow_label); - end - session:execute("sleep", "2000"); - session:execute("playback", "tone_stream://%(200,0,500,600,700)"); - --show in the console - freeswitch.consoleLog("notice", "Call Flow: label="..call_flow_label..",status=true,uuid="..call_flow_uuid.."\n"); - else - --set presence in - turn lamp on - event = freeswitch.Event("PRESENCE_IN"); - event:addHeader("proto", "sip"); - event:addHeader("login", call_flow_feature_code.."@"..domain_name); - event:addHeader("from", call_flow_feature_code.."@"..domain_name); - event:addHeader("status", "Active (1 waiting)"); - event:addHeader("rpid", "unknown"); - event:addHeader("event_type", "presence"); - event:addHeader("alt_event_type", "dialog"); - event:addHeader("event_count", "1"); - event:addHeader("unique-id", call_flow_uuid); - event:addHeader("Presence-Call-Direction", "outbound") - event:addHeader("answer-state", "confirmed"); - event:fire(); - --answer and play a tone - session:answer(); - if (string.len(call_flow_anti_label) > 0) then - api = freeswitch.API(); - reply = api:executeString("uuid_display "..session:get_uuid().." "..call_flow_anti_label); - end - session:execute("sleep", "2000"); - session:execute("playback", "tone_stream://%(500,0,300,200,100,50,25)"); - --show in the console - freeswitch.consoleLog("notice", "Call Flow: label="..call_flow_anti_label..",status=false,uuid="..call_flow_uuid.."\n"); + toggle = (call_flow_status == "true") and "false" or "true" + + -- turn the lamp + presence_in.turn_lamp( toggle == "false", + call_flow_feature_code.."@"..domain_name, + call_flow_uuid + ); + + local active_flow_label = (toggle == "true") and call_flow_label or call_flow_anti_label + --answer and play a tone + session:answer(); + if #active_flow_label > 0 then + api = freeswitch.API(); + reply = api:executeString("uuid_display "..session:get_uuid().." "..active_flow_label); end + session:execute("sleep", "2000"); + session:execute("playback", "tone_stream://%(200,0,500,600,700)"); + + --show in the console + log.noticef("label=%s,status=%s,uuid=%s", active_flow_label, toggle, call_flow_uuid); + + --store in database dbh:query("UPDATE v_call_flows SET call_flow_status = '"..toggle.."' WHERE call_flow_uuid = '"..call_flow_uuid.."'"); + --hangup the call session:hangup(); else - --app_data - freeswitch.consoleLog("notice", "Call Flow: " .. app .. " " .. data .. "\n"); + log.notice("execute " .. app .. " " .. data); --exucute the application session:execute(app, data); diff --git a/resources/install/scripts/call_flow_monitor.lua b/resources/install/scripts/call_flow_monitor.lua index 5be5ccf4bb..b3ddebb1dc 100644 --- a/resources/install/scripts/call_flow_monitor.lua +++ b/resources/install/scripts/call_flow_monitor.lua @@ -25,7 +25,7 @@ -- POSSIBILITY OF SUCH DAMAGE. --set the time between loops in seconds - sleep = 300; + sleep = 60; --set the debug level debug["log"] = false; @@ -38,9 +38,11 @@ require "resources.functions.file_exists"; require "resources.functions.mkdir"; ---connect to the database require "resources.functions.database_handle"; - dbh = database_handle('system'); + + local log = require "resources.functions.log".call_flow_monitor + + local presence_in = require "resources.functions.presence_in" --make sure the scripts/run dir exists mkdir(scripts_dir .. "/run"); @@ -61,69 +63,52 @@ --used to stop the lua service local file = assert(io.open(run_file, "w")); file:write("remove this file to stop the script"); + file:close() + log.notice("Start") --monitor the call flows status - x = 0 + local sql = "select d.domain_name, f.call_flow_uuid, f.call_flow_extension, f.call_flow_feature_code," .. + "f.call_flow_status, f.call_flow_label, f.call_flow_anti_label ".. + "from v_call_flows as f, v_domains as d " .. + "where f.domain_uuid = d.domain_uuid " -- and call_flow_enabled = 'true' while true do - --get the extension list - sql = [[select d.domain_name, f.call_flow_uuid, f.call_flow_extension, f.call_flow_feature_code, f.call_flow_status, f.call_flow_label, f.call_flow_anti_label - from v_call_flows as f, v_domains as d - where f.domain_uuid = d.domain_uuid]] - --and call_flow_enabled = 'true' + -- debug print if (debug["sql"]) then - freeswitch.consoleLog("notice", "SQL:" .. sql .. "\n"); + log.notice("SQL:" .. sql); end - x = 0; - dbh:query(sql, function(row) - domain_name = row.domain_name; - call_flow_uuid = row.call_flow_uuid; - --call_flow_name = row.call_flow_name; - call_flow_extension = row.call_flow_extension; - call_flow_feature_code = row.call_flow_feature_code; - --call_flow_context = row.call_flow_context; - call_flow_status = row.call_flow_status; - --pin_number = row.call_flow_pin_number; - call_flow_label = row.call_flow_label; - call_flow_anti_label = row.call_flow_anti_label; - if (call_flow_status == "true") then - --set the presence to terminated - turn the lamp off: - event = freeswitch.Event("PRESENCE_IN"); - event:addHeader("proto", "sip"); - event:addHeader("event_type", "presence"); - event:addHeader("alt_event_type", "dialog"); - event:addHeader("Presence-Call-Direction", "outbound"); - event:addHeader("state", "Active (1 waiting)"); - event:addHeader("from", call_flow_feature_code.."@"..domain_name); - event:addHeader("login", call_flow_feature_code.."@"..domain_name); - event:addHeader("unique-id", call_flow_uuid); - event:addHeader("answer-state", "terminated"); - event:fire(); - --show in the console - if (debug["log"]) then - freeswitch.consoleLog("notice", "Call Flow: label="..call_flow_label..",status=true,uuid="..call_flow_uuid.."\n"); - end - else - --set presence in - turn lamp on - event = freeswitch.Event("PRESENCE_IN"); - event:addHeader("proto", "sip"); - event:addHeader("login", call_flow_feature_code.."@"..domain_name); - event:addHeader("from", call_flow_feature_code.."@"..domain_name); - event:addHeader("status", "Active (1 waiting)"); - event:addHeader("rpid", "unknown"); - event:addHeader("event_type", "presence"); - event:addHeader("alt_event_type", "dialog"); - event:addHeader("event_count", "1"); - event:addHeader("unique-id", call_flow_uuid); - event:addHeader("Presence-Call-Direction", "outbound"); - event:addHeader("answer-state", "confirmed"); - event:fire(); - --show in the console - if (debug["log"]) then - freeswitch.consoleLog("notice", "Call Flow: label="..call_flow_anti_label..",status=false,uuid="..call_flow_uuid.."\n"); - end - end - end); + --connect to the database + local dbh = database_handle('system'); + + --get the extension list + if dbh:connected() then + dbh:query(sql, function(row) + local domain_name = row.domain_name; + local call_flow_uuid = row.call_flow_uuid; + --local call_flow_name = row.call_flow_name; + --local call_flow_extension = row.call_flow_extension; + local call_flow_feature_code = row.call_flow_feature_code; + --local call_flow_context = row.call_flow_context; + local call_flow_status = row.call_flow_status; + --local pin_number = row.call_flow_pin_number; + local call_flow_label = row.call_flow_label; + local call_flow_anti_label = row.call_flow_anti_label; + + -- turn the lamp + presence_in.turn_lamp( call_flow_status == "false", + call_flow_feature_code.."@"..domain_name, + call_flow_uuid + ); + + if (debug["log"]) then + local label = (call_flow_status == "true") and call_flow_label or call_flow_anti_label + log.noticef("label=%s,status=%s,uuid=%s", label, call_flow_status, call_flow_uuid); + end + end); + end + + -- release dbh + dbh:release() --exit the loop when the file does not exist if (not file_exists(run_file)) then @@ -132,4 +117,6 @@ --sleep a moment to prevent using unecessary resources freeswitch.msleep(sleep*1000); - end \ No newline at end of file + end + + log.notice("Stop") diff --git a/resources/install/scripts/call_forward.lua b/resources/install/scripts/call_forward.lua index 553a883c20..fc4f693f38 100644 --- a/resources/install/scripts/call_forward.lua +++ b/resources/install/scripts/call_forward.lua @@ -28,250 +28,309 @@ max_tries = "3"; digit_timeout = "3000"; ---debug - debug["sql"] = false; - --define the trim function require "resources.functions.trim" ---define the explode function - require "resources.functions.explode" - --create the api object api = freeswitch.API(); --include config.lua require "resources.functions.config"; +--include config.lua + require "resources.functions.settings"; + + require "resources.functions.channel_utils"; + + local log = require "resources.functions.log".call_forward + local cache = require "resources.functions.cache" + local Database = require "resources.functions.database" + + local function opt(t, ...) + if select('#', ...) == 0 then + return t + end + if type(t) ~= 'table' then + return nil + end + return opt(t[...], select(2, ...)) + end + + local function empty(t) + return (not t) or (#t == 0) + end + --check if the session is ready - if (session:ready()) then - --answer the call - session:answer(); + if not session:ready() then return end - --get the variables - enabled = session:getVariable("enabled"); - pin_number = session:getVariable("pin_number"); - sounds_dir = session:getVariable("sounds_dir"); - domain_uuid = session:getVariable("domain_uuid"); - domain_name = session:getVariable("domain_name"); - extension_uuid = session:getVariable("extension_uuid"); - context = session:getVariable("context"); - if (not context ) then context = 'default'; end - request_id = session:getVariable("request_id"); +--answer the call + session:answer(); - --set the sounds path for the language, dialect and voice - default_language = session:getVariable("default_language"); - default_dialect = session:getVariable("default_dialect"); - default_voice = session:getVariable("default_voice"); - if (not default_language) then default_language = 'en'; end - if (not default_dialect) then default_dialect = 'us'; end - if (not default_voice) then default_voice = 'callie'; end +--get the variables + local enabled = session:getVariable("enabled"); + local pin_number = session:getVariable("pin_number"); + local sounds_dir = session:getVariable("sounds_dir"); + local domain_uuid = session:getVariable("domain_uuid"); + local domain_name = session:getVariable("domain_name"); + local extension_uuid = session:getVariable("extension_uuid"); + local request_id = session:getVariable("request_id"); + local extension, dial_string - --a moment to sleep - session:sleep(1000); +--set the sounds path for the language, dialect and voice + local default_language = session:getVariable("default_language") or 'en'; + local default_dialect = session:getVariable("default_dialect") or 'us'; + local default_voice = session:getVariable("default_voice") or 'callie'; - --connect to the database - require "resources.functions.database_handle"; - dbh = database_handle('system'); +--a moment to sleep + session:sleep(1000); - --request id is true - if (request_id == "true") then - --unset extension uuid - extension_uuid = nil; +--connect to the database + dbh = Database.new('system'); - --get the id - if (session:ready()) then - min_digits = 2; - max_digits = 20; - id = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", "phrase:voicemail_enter_id:#", "", "\\d+"); - end +--request id is true + if (request_id == "true") then + --unset extension uuid + extension_uuid = nil; - --get the pin number - if (session:ready()) then - min_digits = 3; - max_digits = 20; - caller_pin_number = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", "phrase:voicemail_enter_pass:#", "", "\\d+"); - end + --get the extension + if not session:ready() then return end + local min_digits = 2; + local max_digits = 20; + extension = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", "phrase:voicemail_enter_id:#", "", "\\d+"); + if empty(extension) then return end - --check to see if the pin number is correct - if (session:ready()) then - sql = "SELECT * FROM v_voicemails "; - sql = sql .. "WHERE domain_uuid = '" .. domain_uuid .."' "; - sql = sql .. "AND voicemail_id = '" .. id .."' "; - if (debug["sql"]) then - freeswitch.consoleLog("notice", "[call_forward] "..sql .."\n"); - end - dbh:query(sql, function(row) - voicemail_password = row.voicemail_password; - --freeswitch.consoleLog("notice", "[call_forward] "..voicemail_password .."\n"); - end); - if (voicemail_password ~= caller_pin_number) then - --access denied - session:streamFile("phrase:voicemail_fail_auth:#"); - session:hangup("NORMAL_CLEARING"); - end - end + --get the pin number + if not session:ready() then return end + min_digits = 3; + max_digits = 20; + local caller_pin_number = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", "phrase:voicemail_enter_pass:#", "", "\\d+"); + if empty(caller_pin_number) then return end + + --check to see if the pin number is correct + if not session:ready() then return end + local sql = "SELECT * FROM v_voicemails "; + sql = sql .. "WHERE domain_uuid = '" .. domain_uuid .."' "; + sql = sql .. "AND voicemail_id = '" .. extension .."' "; + if (debug["sql"]) then + log.notice(sql); + end + local voicemail_password = dbh:first_value(sql) + if (voicemail_password ~= caller_pin_number) then + --access denied + session:streamFile("phrase:voicemail_fail_auth:#"); + return session:hangup("NORMAL_CLEARING"); + end + end + +--determine whether to update the dial string + if not session:ready() then return end + + local sql = "select * from v_extensions "; + sql = sql .. "where domain_uuid = '"..domain_uuid.."' "; + if (extension_uuid ~= nil) then + sql = sql .. "and extension_uuid = '"..extension_uuid.."' "; + else + sql = sql .. "and (extension = '"..extension.."' or number_alias = '"..extension.."') "; + end + if (debug["sql"]) then + log.notice(sql); + end + local row = dbh:first_row(sql) + if not row then return end + + extension_uuid = row.extension_uuid; + extension = row.extension; + local number_alias = row.number_alias or ''; + local accountcode = row.accountcode; + local forward_all_enabled = row.forward_all_enabled; + local forward_all_destination = row.forward_all_destination; + local follow_me_uuid = row.follow_me_uuid; + local toll_allow = row.toll_allow or ''; + local forward_caller_id_uuid = row.forward_caller_id_uuid; + +--toggle enabled + if enabled == "toggle" then + enabled = (forward_all_enabled == "true") and "false" or "true"; + end + + if not session:ready() then return end + +--get the forward destination + if enabled == "true" and empty(forward_all_destination) then + forward_all_destination = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-enter_destination_telephone_number.wav", "", "\\d+"); + if empty(forward_all_destination) then return end + end + +--set call forward + if enabled == "true" then + --set forward_all_enabled + forward_all_enabled = "true"; + channel_display(session:get_uuid(), "Activated") + --say the destination number + session:say(forward_all_destination, default_language, "number", "iterated"); + --notify the caller + session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-call_forwarding_has_been_set.wav"); + end + +--get the caller_id for outbound call + local forward_caller_id = "" + if enabled == "true" and not empty(forward_caller_id_uuid) then + local sql = "select destination_number, destination_description,".. + "destination_caller_id_number, destination_caller_id_name " .. + "from v_destinations where domain_uuid = '" .. domain_uuid .. "' and " .. + "destination_type = 'inbound' and destination_uuid = '" .. forward_caller_id_uuid .. "'"; + local row = dbh:first_row(sql) + if row then + local caller_id_number = row.destination_caller_id_number + if empty(caller_id_number) then + caller_id_number = row.destination_number end - --determine whether to update the dial string - if (session:ready()) then - sql = "select * from v_extensions "; - sql = sql .. "where domain_uuid = '"..domain_uuid.."' "; - if (extension_uuid ~= nil) then - sql = sql .. "and extension_uuid = '"..extension_uuid.."' "; - else - sql = sql .. "and (extension = '"..id.."' or number_alias = '"..id.."') "; - end - if (debug["sql"]) then - freeswitch.consoleLog("notice", "[call_forward] "..sql.."\n"); - end - status = dbh:query(sql, function(row) - extension_uuid = row.extension_uuid; - extension = row.extension; - number_alias = row.number_alias or ''; - accountcode = row.accountcode; - forward_all_enabled = row.forward_all_enabled; - forward_all_destination = row.forward_all_destination; - follow_me_uuid = row.follow_me_uuid; - toll_allow = row.toll_allow or ''; - --freeswitch.consoleLog("NOTICE", "[call forward] extension "..row.extension.."\n"); - --freeswitch.consoleLog("NOTICE", "[call forward] accountcode "..row.accountcode.."\n"); - end); + local caller_id_name = row.destination_caller_id_name + if empty(caller_id_name) then + caller_id_name = row.destination_description end - --toggle enabled - if (session:ready() and enabled == "toggle") then - if (forward_all_enabled == "true") then - enabled = "false"; - else - enabled = "true"; - end + if not empty(caller_id_number) then + forward_caller_id = forward_caller_id .. + ",outbound_caller_id_number=" .. caller_id_number .. + ",origination_caller_id_number=" .. caller_id_number end - --get the forward destination - if (session:ready() and (enabled == "true" or enabled == "toggle") ) then - if (string.len(forward_all_destination) == 0) then - forward_all_destination = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-enter_destination_telephone_number.wav", "", "\\d+"); - end + if not empty(caller_id_name) then + forward_caller_id = forward_caller_id .. + ",outbound_caller_id_name=" .. caller_id_name .. + ",origination_caller_id_name=" .. caller_id_name end + end + end - --set the dial string - if (session:ready() and enabled == "true") then - --used for number_alias to get the correct user - sql = "select * from v_extensions "; - sql = sql .. "where domain_uuid = '"..domain_uuid.."' "; - sql = sql .. "and number_alias = '"..forward_all_destination.."' "; - status = dbh:query(sql, function(row) - destination_user = row.extension; - end); +--set the dial string + if enabled == "true" then + local destination_extension, destination_number_alias - --set the dial_string - dial_string = "{presence_id="..forward_all_destination.."@"..domain_name; - dial_string = dial_string .. ",instant_ringback=true"; - dial_string = dial_string .. ",domain_uuid="..domain_uuid; - dial_string = dial_string .. ",sip_invite_domain="..domain_name; - dial_string = dial_string .. ",domain_name="..domain_name; - dial_string = dial_string .. ",domain="..domain_name; - dial_string = dial_string .. ",toll_allow='"..toll_allow.."'"; - if (accountcode ~= nil) then - dial_string = dial_string .. ",accountcode="..accountcode; - end - dial_string = dial_string .. "}"; + --used for number_alias to get the correct user + local sql = "select extension, number_alias from v_extensions "; + sql = sql .. "where domain_uuid = '"..domain_uuid.."' "; + sql = sql .. "and number_alias = '"..forward_all_destination.."' "; + dbh:query(sql, function(row) + destination_user = row.extension; + destination_extension = row.extension; + destination_number_alias = row.number_alias or ''; + end); - if (destination_user ~= nil) then - cmd = "user_exists id ".. destination_user .." "..domain_name; - else - cmd = "user_exists id ".. forward_all_destination .." "..domain_name; - end - user_exists = trim(api:executeString(cmd)); - if (user_exists == "true") then - if (destination_user ~= nil) then - dial_string = dial_string .. "user/"..destination_user.."@"..domain_name; - else - dial_string = dial_string .. "user/"..forward_all_destination.."@"..domain_name; - end - else - dial_string = dial_string .. "loopback/"..forward_all_destination; - end - end - - --set call forward - if (session:ready() and enabled == "true") then - --set forward_all_enabled - forward_all_enabled = "true"; - --say the destination number - session:say(forward_all_destination, default_language, "number", "iterated"); - --notify the caller - session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-call_forwarding_has_been_set.wav"); - end - - --unset call forward - if (session:ready() and enabled == "false") then - --set forward_all_enabled - forward_all_enabled = "false"; - --notify the caller - session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-call_forwarding_has_been_cancelled.wav"); - end - - --disable the follow me - if (session:ready() and enabled == "true" and follow_me_uuid ~= nil) then - if (string.len(follow_me_uuid) > 0) then - sql = "update v_follow_me set "; - sql = sql .. "follow_me_enabled = 'false' "; - sql = sql .. "where domain_uuid = '"..domain_uuid.."' "; - sql = sql .. "and follow_me_uuid = '"..follow_me_uuid.."' "; - if (debug["sql"]) then - freeswitch.consoleLog("notice", "[call_forward] "..sql.."\n"); - end - dbh:query(sql); - end - end - - --check the destination - if (forward_all_destination == nil) then - enabled = false; - forward_all_enabled = "false"; + local presence_id + if destination_extension then + if (#destination_number_alias > 0) and (opt(settings(domain_uuid), 'provision', 'number_as_presence_id', 'boolean') == 'true') then + presence_id = destination_number_alias else - if (string.len(forward_all_destination) == 0) then - enabled = false; - forward_all_enabled = "false"; - end + presence_id = destination_extension end - - --update the extension - if (session:ready()) then - sql = "update v_extensions set "; - if (enabled == "true") then - sql = sql .. "forward_all_destination = '"..forward_all_destination.."', "; - sql = sql .. "dial_string = '"..dial_string:gsub("'", "''").."', "; - sql = sql .. "do_not_disturb = 'false', "; - else - sql = sql .. "forward_all_destination = null, "; - sql = sql .. "dial_string = null, "; - end - sql = sql .. "forward_all_enabled = '"..forward_all_enabled.."' "; - sql = sql .. "where domain_uuid = '"..domain_uuid.."' "; - sql = sql .. "and extension_uuid = '"..extension_uuid.."' "; - if (debug["sql"]) then - freeswitch.consoleLog("notice", "[call_forward] "..sql.."\n"); - end - dbh:query(sql); - - --clear the cache - if (extension ~= nil) then - api:execute("memcache", "delete directory:"..extension.."@"..domain_name); - if #number_alias > 0 then - api:execute("memcache", "delete directory:"..number_alias.."@"..domain_name); - end - end + elseif extension then + -- setting here presence_id equal extension not dialed number allows work BLF and intercept. + -- $presence_id = extension_presence_id($this->extension, $this->number_alias); + if (#number_alias > 0) and (opt(settings(domain_uuid), 'provision', 'number_as_presence_id', 'boolean') == 'true') then + presence_id = number_alias + else + presence_id = extension end + else + presence_id = forward_all_destination + end - -- hangup - if (session:ready()) then - --wait for the file to be written before proceeding - session:sleep(100); + --set the dial_string + dial_string = "{presence_id="..presence_id.."@"..domain_name; + dial_string = dial_string .. ",instant_ringback=true"; + dial_string = dial_string .. ",domain_uuid="..domain_uuid; + dial_string = dial_string .. ",sip_invite_domain="..domain_name; + dial_string = dial_string .. ",domain_name="..domain_name; + dial_string = dial_string .. ",domain="..domain_name; + dial_string = dial_string .. ",toll_allow='"..toll_allow.."'"; + if (accountcode ~= nil) then + dial_string = dial_string .. ",accountcode="..accountcode; + end + dial_string = dial_string .. forward_caller_id + dial_string = dial_string .. "}"; - --end the call - session:hangup(); + if (destination_user ~= nil) then + cmd = "user_exists id ".. destination_user .." "..domain_name; + else + cmd = "user_exists id ".. forward_all_destination .." "..domain_name; + end + user_exists = trim(api:executeString(cmd)); + if (user_exists == "true") then + if (destination_user ~= nil) then + dial_string = dial_string .. "user/"..destination_user.."@"..domain_name; + else + dial_string = dial_string .. "user/"..forward_all_destination.."@"..domain_name; end - end \ No newline at end of file + else + dial_string = dial_string .. "loopback/"..forward_all_destination; + end + end + +--unset call forward + if session:ready() and enabled == "false" then + --set forward_all_enabled + forward_all_enabled = "false"; + channel_display(session:get_uuid(), "Cancelled") + --notify the caller + session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-call_forwarding_has_been_cancelled.wav"); + end + +--disable the follow me + if enabled == "true" and not empty(follow_me_uuid) then + local sql = "update v_follow_me set "; + sql = sql .. "follow_me_enabled = 'false' "; + sql = sql .. "where domain_uuid = '"..domain_uuid.."' "; + sql = sql .. "and follow_me_uuid = '"..follow_me_uuid.."' "; + if (debug["sql"]) then + log.notice(sql); + end + dbh:query(sql); + end + +--check the destination + if empty(forward_all_destination) then + enabled = "false"; + forward_all_enabled = "false"; + end + +--update the extension + do + local sql = "update v_extensions set "; + if (enabled == "true") then + sql = sql .. "forward_all_destination = '"..forward_all_destination.."', "; + sql = sql .. "dial_string = '"..dial_string:gsub("'", "''").."', "; + sql = sql .. "do_not_disturb = 'false', "; + else + sql = sql .. "forward_all_destination = null, "; + sql = sql .. "dial_string = null, "; + end + sql = sql .. "forward_all_enabled = '"..forward_all_enabled.."' "; + sql = sql .. "where domain_uuid = '"..domain_uuid.."' "; + sql = sql .. "and extension_uuid = '"..extension_uuid.."' "; + if (debug["sql"]) then + log.notice(sql); + end + dbh:query(sql); + end + +--disconnect from database + dbh:release() + +--clear the cache + if extension and #extension > 0 and cache.support() then + cache.del("directory:"..extension.."@"..domain_name); + if #number_alias > 0 then + cache.del("directory:"..number_alias.."@"..domain_name); + end + end + +--hangup + if (session:ready()) then + --wait for the file to be written before proceeding + session:sleep(100); + --end the call + session:hangup(); + end diff --git a/resources/install/scripts/do_not_disturb.lua b/resources/install/scripts/do_not_disturb.lua index 8e067860af..085ecedb68 100644 --- a/resources/install/scripts/do_not_disturb.lua +++ b/resources/install/scripts/do_not_disturb.lua @@ -92,7 +92,7 @@ --set the dial string if (enabled == "true") then local user = (number_alias and #number_alias > 0) and number_alias or extension; - dial_string = "loopback/*99"..user; + dial_string = "error/user_busy"; end --set do not disturb @@ -142,6 +142,37 @@ end dbh:query(sql); + --determine whether to update the dial string + sql = "select * from v_extension_users as e, v_users as u "; + sql = sql .. "where e.extension_uuid = '"..extension_uuid.."' "; + sql = sql .. "and e.user_uuid = u.user_uuid "; + sql = sql .. "and e.domain_uuid = '"..domain_uuid.."' "; + if (debug["sql"]) then + freeswitch.consoleLog("notice", "[do_not_disturb] "..sql.."\n"); + end + status = dbh:query(sql, function(row) + --update the call center status + if (enabled == "true") then + user_status = "Logged Out"; + api:execute("callcenter_config", "agent set status "..row.username.."@"..domain_name.." '"..user_status.."'"); + end + + --update the database user_status + if (enabled == "true") then + user_status = "Do Not Disturb"; + else + user_status = "Available"; + end + sql = "update v_users set "; + sql = sql .. "user_status = '"..user_status.."' "; + sql = sql .. "where domain_uuid = '"..domain_uuid.."' "; + sql = sql .. "and user_uuid = '"..row.user_uuid.."' "; + if (debug["sql"]) then + freeswitch.consoleLog("notice", "[do_not_disturb] "..sql.."\n"); + end + dbh:query(sql); + end); + --clear the cache if (extension ~= nil) then api:execute("memcache", "delete directory:"..extension.."@"..domain_name); diff --git a/resources/install/scripts/fax_retry.lua b/resources/install/scripts/fax_retry.lua index 652c4c4180..a6f2ce6fad 100644 --- a/resources/install/scripts/fax_retry.lua +++ b/resources/install/scripts/fax_retry.lua @@ -391,7 +391,7 @@ --email_cmd = "/bin/echo '"..email_message_fail.."' | /usr/bin/mail -s 'Fax to: "..number_dialed.." FAILED' -r "..from_address.." -a '"..fax_file.."' "..email_address; --to keep the originate command shorter these are things we always send. One place to adjust for all. - originate_same = "for_fax=1,absolute_codec_string='PCMU,PCMA',accountcode='"..accountcode.."',domain_uuid="..domain_uuid..",domain_name="..domain_name..",mailto_address='"..email_address.."',mailfrom_address='"..from_address.."',origination_caller_id_name='"..origination_caller_id_name.. "',origination_caller_id_number="..origination_caller_id_number..",fax_uri="..fax_uri..",fax_retry_limit="..fax_retry_limit..",fax_retry_sleep="..fax_retry_sleep..",fax_verbose=true,fax_file='"..fax_file.."'"; + originate_same = "for_fax=1,accountcode='"..accountcode.."',domain_uuid="..domain_uuid..",domain_name="..domain_name..",mailto_address='"..email_address.."',mailfrom_address='"..from_address.."',origination_caller_id_name='"..origination_caller_id_name.. "',origination_caller_id_number="..origination_caller_id_number..",fax_uri="..fax_uri..",fax_retry_limit="..fax_retry_limit..",fax_retry_sleep="..fax_retry_sleep..",fax_verbose=true,fax_file='"..fax_file.."'"; if (fax_retry_attempts < fax_retry_limit) then diff --git a/resources/install/scripts/follow_me.lua b/resources/install/scripts/follow_me.lua index 5dce059ae0..ee1a267672 100644 --- a/resources/install/scripts/follow_me.lua +++ b/resources/install/scripts/follow_me.lua @@ -22,158 +22,140 @@ -- Contributor(s): -- Mark J Crane ---set default variables - min_digits = "1"; - max_digits = "11"; - max_tries = "3"; - digit_timeout = "3000"; - ---debug - debug["sql"] = true; - ---define the trim function - require "resources.functions.trim"; - ---define the explode function - require "resources.functions.explode"; +--include config.lua + require "resources.functions.config"; --create the api object api = freeswitch.API(); ---include config.lua - require "resources.functions.config"; + require "resources.functions.channel_utils"; + local log = require "resources.functions.log".follow_me + local cache = require "resources.functions.cache" + local Database = require "resources.functions.database" --check if the session is ready - if ( session:ready() ) then - --answer the call - session:answer(); - - --get the variables - pin_number = session:getVariable("pin_number"); - sounds_dir = session:getVariable("sounds_dir"); - domain_uuid = session:getVariable("domain_uuid"); - domain_name = session:getVariable("domain_name"); - extension_uuid = session:getVariable("extension_uuid"); - context = session:getVariable("context"); - if (not context ) then context = 'default'; end - - --set the sounds path for the language, dialect and voice - default_language = session:getVariable("default_language"); - default_dialect = session:getVariable("default_dialect"); - default_voice = session:getVariable("default_voice"); - if (not default_language) then default_language = 'en'; end - if (not default_dialect) then default_dialect = 'us'; end - if (not default_voice) then default_voice = 'callie'; end - - --a moment to sleep - session:sleep(1000); - - --connect to the database - require "resources.functions.database_handle"; - dbh = database_handle('system'); - - --determine whether to update the dial string - sql = "select * from v_extensions "; - sql = sql .. "where domain_uuid = '"..domain_uuid.."' "; - sql = sql .. "and extension_uuid = '"..extension_uuid.."' "; - if (debug["sql"]) then - freeswitch.consoleLog("notice", "[follow_me] "..sql.."\n"); - end - status = dbh:query(sql, function(row) - extension = row.extension; - number_alias = row.number_alias or ''; - accountcode = row.accountcode; - follow_me_uuid = row.follow_me_uuid; - --freeswitch.consoleLog("NOTICE", "[call forward] extension "..row.extension.."\n"); - --freeswitch.consoleLog("NOTICE", "[call forward] accountcode "..row.accountcode.."\n"); - end); + if not session:ready() then return end - --determine whether to update the dial string - enabled = "false"; - sql = "select * from v_follow_me "; - sql = sql .. "where domain_uuid = '"..domain_uuid.."' "; - sql = sql .. "and follow_me_uuid = '"..follow_me_uuid.."' "; - if (debug["sql"]) then - freeswitch.consoleLog("notice", "[follow_me] "..sql.."\n"); - end - status = dbh:query(sql, function(row) - enabled = row.follow_me_enabled; - call_prompt = row.call_prompt; - cid_name_prefix = row.cid_name_prefix; - cid_number_prefix = row.cid_number_prefix; - dial_string = row.dial_string; - end); - - --set follow me - if (enabled == "false") then - --answer and play a tone - session:answer(); - api = freeswitch.API(); - reply = api:executeString("uuid_display "..session:get_uuid().." Activated "); +--answer the call + session:answer(); - session:execute("sleep", "2000"); - session:execute("playback", "tone_stream://%(200,0,500,600,700)"); - --notify the caller - --session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-call_forwarding_has_been_set.wav"); - end - - --unset follow me - if (enabled == "true") then - --answer and play a tone - session:answer(); - api = freeswitch.API(); - reply = api:executeString("uuid_display "..session:get_uuid().." Cancelled "); +--get the variables + local domain_uuid = session:getVariable("domain_uuid"); + local domain_name = session:getVariable("domain_name"); + local extension_uuid = session:getVariable("extension_uuid"); - session:execute("sleep", "2000"); - session:execute("playback", "tone_stream://%(500,0,300,200,100,50,25)"); - --notify the caller - --session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-call_forwarding_has_been_cancelled.wav"); - end +--set the sounds path for the language, dialect and voice + local sounds_dir = session:getVariable("sounds_dir"); + local default_language = session:getVariable("default_language") or 'en'; + local default_dialect = session:getVariable("default_dialect") or 'us'; + local default_voice = session:getVariable("default_voice") or 'callie'; - --enable or disable follow me - if (follow_me_uuid ~= nil) then - sql = "update v_follow_me set "; - if (enabled == "true") then - sql = sql .. "follow_me_enabled = 'false' "; - else - sql = sql .. "follow_me_enabled = 'true' "; - end - sql = sql .. "where domain_uuid = '"..domain_uuid.."' "; - sql = sql .. "and follow_me_uuid = '"..follow_me_uuid.."' "; - if (debug["sql"]) then - freeswitch.consoleLog("notice", "[follow_me] "..sql.."\n"); - end - dbh:query(sql); - end - - --update the extension - sql = "update v_extensions set "; - if (enabled == "true") then - sql = sql .. "dial_string = null, "; - else - sql = sql .. "dial_string = '"..dial_string.."', "; - end - sql = sql .. "do_not_disturb = 'false', "; - sql = sql .. "forward_all_enabled= 'false' "; - sql = sql .. "where domain_uuid = '"..domain_uuid.."' "; - sql = sql .. "and extension_uuid = '"..extension_uuid.."' "; - if (debug["sql"]) then - freeswitch.consoleLog("notice", "[follow_me] "..sql.."\n"); - end - dbh:query(sql); - - --clear the cache - if (extension ~= nil) then - api:execute("memcache", "delete directory:"..extension.."@"..domain_name); - if #number_alias > 0 then - api:execute("memcache", "delete directory:"..number_alias.."@"..domain_name); - end - end - - --wait for the file to be written before proceeding - session:sleep(1000); - - --end the call - session:hangup(); - +--a moment to sleep + session:sleep(1000); + +--check if the session is ready + if not session:ready() then return end + +--connect to the database + local dbh = Database.new('system'); + +--determine whether to update the dial string + local sql = "select extension, number_alias, accountcode, follow_me_uuid "; + sql = sql .. "from v_extensions "; + sql = sql .. "where domain_uuid = '"..domain_uuid.."' "; + sql = sql .. "and extension_uuid = '"..extension_uuid.."' "; + if (debug["sql"]) then + log.notice(sql); end + + local row = dbh:first_row(sql) + if not row then return end + + local extension = row.extension; + local number_alias = row.number_alias or ''; + local accountcode = row.accountcode; + local follow_me_uuid = row.follow_me_uuid; + +--determine whether to update the dial string + sql = "select follow_me_enabled, call_prompt, cid_name_prefix, cid_number_prefix, dial_string " + sql = sql .. "from v_follow_me "; + sql = sql .. "where domain_uuid = '"..domain_uuid.."' "; + sql = sql .. "and follow_me_uuid = '"..follow_me_uuid.."' "; + if (debug["sql"]) then + log.notice(sql); + end + + row = dbh:first_row(sql) + if not row then return end + + local enabled = row.follow_me_enabled; + local call_prompt = row.call_prompt; + local cid_name_prefix = row.cid_name_prefix; + local cid_number_prefix = row.cid_number_prefix; + local dial_string = row.dial_string; + +--set follow me + if (enabled == "false") then + --play a tone + channel_display(session:get_uuid(), "Activated") + + session:execute("sleep", "2000"); + session:execute("playback", "tone_stream://%(200,0,500,600,700)"); + --notify the caller + --session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-call_forwarding_has_been_set.wav"); + end + +--unset follow me + if (enabled == "true") then + --play a tone + channel_display(session:get_uuid(), "Cancelled") + + session:execute("sleep", "2000"); + session:execute("playback", "tone_stream://%(500,0,300,200,100,50,25)"); + --notify the caller + --session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-call_forwarding_has_been_cancelled.wav"); + end + +--enable or disable follow me + sql = "update v_follow_me set "; + if (enabled == "true") then + sql = sql .. "follow_me_enabled = 'false' "; + else + sql = sql .. "follow_me_enabled = 'true' "; + end + sql = sql .. "where domain_uuid = '"..domain_uuid.."' "; + sql = sql .. "and follow_me_uuid = '"..follow_me_uuid.."' "; + if (debug["sql"]) then + log.notice(sql); + end + dbh:query(sql); + +--update the extension + sql = "update v_extensions set "; + if (enabled == "true") then + sql = sql .. "dial_string = null, "; + else + sql = sql .. "dial_string = '"..dial_string:gsub("'", "''").."', "; + end + sql = sql .. "do_not_disturb = 'false', "; + sql = sql .. "forward_all_enabled= 'false' "; + sql = sql .. "where domain_uuid = '"..domain_uuid.."' "; + sql = sql .. "and extension_uuid = '"..extension_uuid.."' "; + if (debug["sql"]) then + log.notice(sql); + end + dbh:query(sql); + +--clear the cache + if (extension ~= nil) and cache.support() then + cache.del("directory:"..extension.."@"..domain_name); + if #number_alias > 0 then + cache.del("directory:"..number_alias.."@"..domain_name); + end + end + +--wait for the file to be written before proceeding + session:sleep(1000); + +--end the call + session:hangup(); diff --git a/resources/install/scripts/intercept.lua b/resources/install/scripts/intercept.lua index d6845a940b..a7a6695731 100644 --- a/resources/install/scripts/intercept.lua +++ b/resources/install/scripts/intercept.lua @@ -48,6 +48,7 @@ --add the function require "resources.functions.trim"; + require "resources.functions.channel_utils"; --exits the script if we didn't connect properly assert(dbh:connected()); @@ -119,7 +120,7 @@ if ( session:ready() ) then callee_num = ''; --check the database to get the uuid of a ringing call - sql = "select call_uuid as uuid, hostname, callee_num, ip_addr from channels "; + sql = "select uuid, call_uuid, hostname, callee_num, ip_addr from channels "; sql = sql .. "where callstate in ('RINGING', 'EARLY') "; --sql = sql .. "AND direction = 'outbound' "; if (extension) then @@ -132,11 +133,18 @@ if ( session:ready() ) then if (debug["sql"]) then freeswitch.consoleLog("NOTICE", "sql "..sql.."\n"); end - dbh:query(sql, function(result) + dbh:query(sql, function(result) --for key, val in pairs(result) do -- freeswitch.consoleLog("NOTICE", "result "..key.." "..val.."\n"); --end - uuid = result.uuid; + if result.uuid == result.call_uuid then + uuid = channel_variable(result.uuid, 'ent_originate_aleg_uuid') or + channel_variable(result.uuid, 'cc_member_session_uuid') or + channel_variable(result.uuid, 'fifo_bridge_uuid') or + result.uuid + else + uuid = result.call_uuid; + end call_hostname = result.hostname; callee_num = result.callee_num; end); diff --git a/resources/install/scripts/intercept_group.lua b/resources/install/scripts/intercept_group.lua index 32b1f4ef17..bfc82f5a18 100644 --- a/resources/install/scripts/intercept_group.lua +++ b/resources/install/scripts/intercept_group.lua @@ -35,11 +35,19 @@ --add the function require "resources.functions.explode"; + require "resources.functions.trim"; + require "resources.functions.channel_utils"; + +--prepare the api object + api = freeswitch.API(); --connect to the database require "resources.functions.database_handle"; dbh = database_handle('system'); +--get the hostname + hostname = trim(api:execute("switchname", "")); + --check if the session is ready if ( session:ready() ) then --answer the session @@ -163,7 +171,7 @@ --check the database to get the uuid of a ringing call call_hostname = ""; - sql = "SELECT call_uuid AS uuid, hostname, ip_addr FROM channels "; + sql = "SELECT uuid, call_uuid, hostname, ip_addr FROM channels "; sql = sql .. "WHERE callstate in ('RINGING', 'EARLY') "; --sql = sql .. "AND direction = 'outbound' "; sql = sql .. "AND ("; @@ -178,6 +186,7 @@ end sql = sql .. ") "; sql = sql .. "and call_uuid is not null "; + sql = sql .. "and direction = 'outbound' "; --if (domain_count > 1) then -- sql = sql .. "and context = '"..context.."' "; --end @@ -189,14 +198,19 @@ --for key, val in pairs(row) do -- freeswitch.consoleLog("NOTICE", "row "..key.." "..val.."\n"); --end - uuid = row.uuid; + if row.uuid == row.call_uuid then + uuid = channel_variable(row.uuid, 'ent_originate_aleg_uuid') or + channel_variable(row.uuid, 'cc_member_session_uuid') or + channel_variable(row.uuid, 'fifo_bridge_uuid') or + row.uuid + else + uuid = row.call_uuid; + end call_hostname = row.hostname; ip_addr = row.ip_addr; end); end ---get the hostname - hostname = freeswitch.getGlobalVariable("hostname"); freeswitch.consoleLog("NOTICE", "Hostname:"..hostname.." Call Hostname:"..call_hostname.."\n"); --intercept a call that is ringing diff --git a/resources/install/scripts/ivr_menu.lua b/resources/install/scripts/ivr_menu.lua index 02131a283d..554bcdc2f7 100644 --- a/resources/install/scripts/ivr_menu.lua +++ b/resources/install/scripts/ivr_menu.lua @@ -358,8 +358,7 @@ pos = string.find(ivr_menu_greet_long, ":", 0, true); if (pos ~= nil and string.sub(ivr_menu_greet_long, 0, pos-1) == 'phrase') then freeswitch.consoleLog("notice", "[ivr_menu] phrase detected\n"); - session:playAndGetDigits(min_digits, ivr_menu_digit_len, 1, ivr_menu_timeout, ivr_menu_confirm_key, ivr_menu_greet_long, "", ".*"); - dtmf_digits = session:getVariable("dtmf_digits"); + dtmf_digits = session:playAndGetDigits(min_digits, ivr_menu_digit_len, 1, ivr_menu_timeout, ivr_menu_confirm_key, ivr_menu_greet_long, "", ".*"); session:setVariable("slept", "false"); else dtmf_digits = session:playAndGetDigits(min_digits, ivr_menu_digit_len, 1, ivr_menu_timeout, ivr_menu_confirm_key, ivr_menu_greet_long, "", ".*"); diff --git a/resources/install/scripts/resources/functions/cache.lua b/resources/install/scripts/resources/functions/cache.lua new file mode 100644 index 0000000000..06548af1cd --- /dev/null +++ b/resources/install/scripts/resources/functions/cache.lua @@ -0,0 +1,97 @@ +-- @usage cache = require "resources.functions.cache" +-- value = cache.get(key) +-- if not value then +-- ... +-- cache.set(key, value, expire) +-- end +-- + +require "resources.functions.trim"; + +local api = api or freeswitch.API(); + +local function send_event(action, key) + local event = freeswitch.Event("MEMCACHE", action); + event:addHeader("API-Command", "memcache"); + event:addHeader("API-Command-Argument", action .. " " .. key); + event:fire() +end + +local Cache = {} + +local function check_error(result) + result = trim(result or '') + + if result and result:sub(1, 4) == '-ERR' then + return nil, trim(result:sub(5)) + end + + if result == 'INVALID COMMAND!' and not Cache.support() then + return nil, 'INVALID COMMAND' + end + + return result +end + +function Cache.support() + -- assume it is not unloadable + if Cache._support then + return true + end + Cache._support = (trim(api:execute('module_exists', 'mod_memcache')) == 'true') + return Cache._support +end + +--- Get element from cache +-- +-- @tparam key string +-- @return[1] string value +-- @return[2] nil +-- @return[2] error string `e.g. 'NOT FOUND' +-- @note error string does not contain `-ERR` prefix +function Cache.get(key) + local result, err = check_error(api:execute('memcache', 'get ' .. key)) + if not result then return nil, err end + return (result:gsub("'", "'")) +end + +function Cache.set(key, value, expire) + value = value:gsub("'", "'"):gsub("\\", "\\\\") + expire = expire and tostring(expire) or "" + local ok, err = check_error(api:execute("memcache", "set " .. key .. " '" .. value .. "' " .. expire)) + if not ok then return nil, err end + return ok == '+OK' +end + +function Cache.del(key) + send_event('delete', key) + local result, err = check_error(api:execute("memcache", "delete " .. key)) + if not result then + if err == 'NOT FOUND' then + return true + end + return nil, err + end + return result == '+OK' +end + +function Cache._self_test() + assert(Cache.support()) + Cache.del("a") + + local ok, err = Cache.get("a") + assert(nil == ok) + assert(err == "NOT FOUND") + + local s = "hello \\ ' world" + assert(true == Cache.set("a", s)) + assert(s == Cache.get("a")) + + assert(true == Cache.del("a")) +end + +-- if debug.self_test then +-- Cache._self_test() +-- end + +return Cache diff --git a/resources/install/scripts/resources/functions/channel_utils.lua b/resources/install/scripts/resources/functions/channel_utils.lua new file mode 100644 index 0000000000..3676f87d7d --- /dev/null +++ b/resources/install/scripts/resources/functions/channel_utils.lua @@ -0,0 +1,67 @@ +require 'resources.functions.config' +require 'resources.functions.trim' + +local Database = require 'resources.functions.database' + +local api = api or freeswitch.API() + +function channel_variable(uuid, name) + local result = api:executeString("uuid_getvar " .. uuid .. " " .. name) + + if result:sub(1, 4) == '-ERR' then return nil, result end + if result == '_undef_' then return false end + + return result +end + +function channel_evalute(uuid, cmd) + local result = api:executeString("eval uuid:" .. uuid .. " " .. cmd) + + if result:sub(1, 4) == '-ERR' then return nil, result end + if result == '_undef_' then return false end + + return result +end + +function channel_display(uuid, text) + local cmd = ("uuid_display %s '%s'"):format(uuid, text) + local result = trim(api:executeString(cmd)) + if result:sub(1, 4) == '-ERR' then return nil, result end + if result == '_undef_' then return false end + return result +end + +local _switchname +local function switchname() + if _switchname then return _switchname end + + local result = api:executeString("switchname") + + if result:sub(1, 4) == '-ERR' then return nil, result end + if result == '_undef_' then return false end + + _switchname = result + return result +end + +function channels_by_number(number, domain) + local hostname = assert(switchname()) + local dbh = Database.new('switch') + + local full_number = number .. '@' .. (domain or '%') + + local sql = ([[select * from channels where hostname='%s' and ( + (context = '%s' and (cid_name = '%s' or cid_num = '%s')) + or name like '%s' or presence_id like '%s' or presence_data like '%s' + ) + order by created_epoch + ]]):format(hostname, + domain, number, number, + full_number, full_number, full_number + ) + + local rows = assert(dbh:fetch_all(sql)) + + dbh:release() + return rows +end diff --git a/resources/install/scripts/resources/functions/database.lua b/resources/install/scripts/resources/functions/database.lua new file mode 100644 index 0000000000..3cb9580d86 --- /dev/null +++ b/resources/install/scripts/resources/functions/database.lua @@ -0,0 +1,108 @@ +require 'resources.functions.config' +require 'resources.functions.file_exists' +require 'resources.functions.database_handle' + +local unpack = unpack or table.unpack + +local Database = {} do + +Database.__index = Database + +function Database.new(name) + local dbh = assert(name) + if type(name) == 'string' then + if name == 'switch' and file_exists(database_dir.."/core.db") then + dbh = freeswitch.Dbh("sqlite://"..database_dir.."/core.db") + else + dbh = database_handle(name) + end + end + assert(dbh:connected()) + + local self = setmetatable({ + _dbh = dbh; + }, Database) + + return self +end + +function Database:query(sql, fn) + return self._dbh:query(sql, fn) +end + +function Database:first_row(sql) + local result + local ok, err = self:query(sql, function(row) + result = row + return 1 + end) + if not ok then return nil, err end + return result +end + +function Database:first_value(sql) + local result, err = self:first_row(sql) + if not result then return nil, err end + local k, v = next(result) + return v +end + +function Database:first(sql, ...) + local result, err = self:first_row(sql) + if not result then return nil, err end + local t, n = {}, select('#', ...) + for i = 1, n do + t[i] = result[(select(i, ...))] + end + return unpack(t, 1, n) +end + +function Database:fetch_all(sql) + local result = {} + local ok, err = self:query(sql, function(row) + result[#result + 1] = row + end) + if not ok then return nil, err end + return result +end + +function Database:release(sql) + if self._dbh then + self._dbh:release() + self._dbh = nil + end +end + +function Database:connected(sql) + return self._dbh and self._dbh:connected() +end + +function Database.__self_test__(name) + local db = Database.new(name or 'system') + assert(db:connected()) + + assert("1" == db:first_value("select 1 as v")) + + local t = assert(db:first_row("select 1 as v")) + assert(t.v == "1") + + t = assert(db:fetch_all("select 1 as v union all select 2 as v")) + assert(#t == 2) + assert(t[1].v == "1") + assert(t[2].v == "2") + + local a, b = assert(db:first("select 1 as b, 2 as a", 'a', 'b')) + assert(a == "2") + assert(b == "1") + + -- assert(nil == db:first_value("some non sql query")) + + db:release() + assert(not db:connected()) +end + +end + +-- Database.__self_test__() + +return Database \ No newline at end of file diff --git a/resources/install/scripts/resources/functions/log.lua b/resources/install/scripts/resources/functions/log.lua new file mode 100644 index 0000000000..b6cb59652b --- /dev/null +++ b/resources/install/scripts/resources/functions/log.lua @@ -0,0 +1,70 @@ +-- @usage local log = require"resources.functions.log"["xml_handler"] +-- log.notice("hello world") +-- log.noticef("%s %s", "hello", "world") +-- -- log if debug.SQL or debug.xml_handler.SQL then +-- log.tracef("SQL", "SQL is %s", sql) + +local function log(name, level, msg) + freeswitch.consoleLog(level, "[" .. name .. "] " .. msg .. "\n") +end + +local function logf(name, level, ...) + return log(name, level, string.format(...)) +end + +local function trace(type, name, ...) + local t = debug[name] + if t and t[type] ~= nil then + if t[type] then + return log(name, ...) + end + end + if debug[type] then + log(name, ...) + end +end + +local function tracef(type, name, level, ...) + local t = debug[name] + if t and t[type] ~= nil then + if t[type] then + return logf(name, ...) + end + end + if debug[type] then + logf(name, ...) + end +end + +local LEVELS = { + 'error', + 'warning', + 'notice', + 'info', +} + +local TRACE_LEVEL = 'notice' + +local function make_log(name) + local logger = {} + for i = 1, #LEVELS do + logger[ LEVELS[i] ] = function(...) return log(name, LEVELS[i], ...) end; + logger[ LEVELS[i] .. "f" ] = function(...) return logf(name, LEVELS[i], ...) end; + end + + logger.trace = function(type, ...) + trace(type, name, TRACE_LEVEL, ...) + end + + logger.tracef = function(type, ...) + tracef(type, name, TRACE_LEVEL, ...) + end + + return logger +end + +return setmetatable({}, {__index = function(self, name) + local logger = make_log(name) + self[name] = logger + return logger +end}) \ No newline at end of file diff --git a/resources/install/scripts/resources/functions/presence_in.lua b/resources/install/scripts/resources/functions/presence_in.lua new file mode 100644 index 0000000000..b8369f9b17 --- /dev/null +++ b/resources/install/scripts/resources/functions/presence_in.lua @@ -0,0 +1,23 @@ +local function turn_lamp(on, user, uuid) + local event = freeswitch.Event("PRESENCE_IN"); + event:addHeader("proto", "sip"); + event:addHeader("event_type", "presence"); + event:addHeader("alt_event_type", "dialog"); + event:addHeader("Presence-Call-Direction", "outbound"); + event:addHeader("from", user); + event:addHeader("login", user); + event:addHeader("unique-id", uuid); + event:addHeader("status", "Active (1 waiting)"); + if on then + event:addHeader("answer-state", "confirmed"); + event:addHeader("rpid", "unknown"); + event:addHeader("event_count", "1"); + else + event:addHeader("answer-state", "terminated"); + end + event:fire(); +end + +return { + turn_lamp = turn_lamp; +} \ No newline at end of file diff --git a/resources/install/scripts/ring_member.lua b/resources/install/scripts/ring_member.lua new file mode 100644 index 0000000000..6fc0cedc62 --- /dev/null +++ b/resources/install/scripts/ring_member.lua @@ -0,0 +1,145 @@ +-- +-- 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 +-- Copyright (C) 2010 +-- All Rights Reserved. +-- +-- Contributor(s): +-- Koldo A. Marcos + + +--include config.lua + require "resources.functions.config"; + +--connect to the database + require "resources.functions.database_handle"; + dbh = database_handle('system'); + +sounds_dir = ""; +recordings_dir = ""; +pin_number = ""; +max_tries = "3"; +digit_timeout = "3000"; + + +local random = math.random +local function uuid() + local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx' + return string.gsub(template, '[xy]', function (c) + local v = (c == 'x') and random(0, 0xf) or random(8, 0xb) + return string.format('%x', v) + end) +end + +if ( session:ready() ) then + session:answer(); + --session:execute("info", ""); + destination_number = session:getVariable("user_name"); + pin_number = session:getVariable("pin_number"); + sounds_dir = session:getVariable("sounds_dir"); + ring_group_uuid = session:getVariable("ring_group_uuid"); + + --get info for the ring group + sql = "SELECT * FROM v_ring_groups "; + sql = sql .. "where ring_group_uuid = '"..ring_group_uuid.."' "; + status = dbh:query(sql, function(row) + domain_uuid = row["domain_uuid"]; + end); + + destination_timeout = 15; + destination_delay = 0; + + + + ring_group_destination_uuid = uuid(); + + --pin number is not required + + --press 1 to login and 2 to logout + menu_selection = session:playAndGetDigits(1, 1, max_tries, digit_timeout, "#", "ivr/ivr-enter_destination_telephone_number.wav", "", "\\d+"); + freeswitch.consoleLog("NOTICE", "menu_selection: "..menu_selection.."\n"); + if (menu_selection == "1") then + --first, check to see if is already in that ring group + sql = [[ + SELECT COUNT(*) AS in_group FROM + v_ring_group_destinations + WHERE + domain_uuid = ']]..domain_uuid..[[' + AND ring_group_uuid = ']]..ring_group_uuid..[[' + AND destination_number = ']]..destination_number..[[' + ]]; + + --freeswitch.consoleLog("NOTICE", "ring_group_member: SQL "..sql.."\n"); + + assert(dbh:query(sql, function(row) + if (row.in_group == "0") then + sql = [[ + INSERT INTO + v_ring_group_destinations + ( ring_group_destination_uuid, + domain_uuid, + ring_group_uuid, + destination_number, + destination_delay, + destination_timeout) + VALUES + ( ']]..ring_group_destination_uuid..[[', + ']]..domain_uuid..[[', + ']]..ring_group_uuid..[[', + ']]..destination_number..[[', + ]]..destination_delay..[[, + ]]..destination_timeout..[[) + + ]]; + + --freeswitch.consoleLog("NOTICE", "ring_group_member: SQL "..sql.."\n"); + dbh:query(sql); + + freeswitch.consoleLog("NOTICE", "ring_group_member: LOG IN\n"); + session:streamFile("ivr/ivr-you_are_now_logged_in.wav"); + + else + freeswitch.consoleLog("NOTICE", "ring_group_member: ALREADY LOGGED IN\n"); + session:streamFile("ivr/ivr-you_are_now_logged_in.wav"); + end + end)); + + + end + if (menu_selection == "2") then + sql = [[ + DELETE FROM + v_ring_group_destinations + WHERE + domain_uuid =']]..domain_uuid..[[' + AND ring_group_uuid=']]..ring_group_uuid..[[' + AND destination_number=']]..destination_number..[[' + ]]; + freeswitch.consoleLog("NOTICE", "ring_group_member: SQL "..sql.."\n"); + dbh:query(sql); + + freeswitch.consoleLog("NOTICE", "ring_group_member: LOG OUT\n"); + session:streamFile("ivr/ivr-you_are_now_logged_out.wav"); + end + + --wait for the file to be written before proceeding + --session:sleep(1000); + + --hangup + session:hangup(); +end diff --git a/resources/switch.php b/resources/switch.php index 096b5d4921..e4eb04c532 100644 --- a/resources/switch.php +++ b/resources/switch.php @@ -158,6 +158,15 @@ function byte_convert($bytes, $decimals = 2) { return $formattedbytes; } +function remove_config_from_cache($name) { + $cache = new cache; + $cache->delete($name); + $hostname = trim(event_socket_request_cmd('api switchname')); + if($hostname){ + $cache->delete($name . ':' . $hostname); + } +} + function ListFiles($dir) { if($dh = opendir($dir)) { $files = Array(); @@ -501,7 +510,8 @@ function outbound_route_to_bridge ($domain_uuid, $destination_number) { global $db; $destination_number = trim($destination_number); - if (is_numeric($destination_number)) { + preg_match('/^[\*\+0-9]*$/', $destination_number, $matches, PREG_OFFSET_CAPTURE); + if (count($matches) > 0) { //not found, continue to process the function } else { @@ -1443,4 +1453,4 @@ if (!function_exists('save_switch_xml')) { } } -?> \ No newline at end of file +?> diff --git a/resources/templates/conf/autoload_configs/lua.conf.xml b/resources/templates/conf/autoload_configs/lua.conf.xml index 0758bb6762..534505dc3b 100644 --- a/resources/templates/conf/autoload_configs/lua.conf.xml +++ b/resources/templates/conf/autoload_configs/lua.conf.xml @@ -13,7 +13,7 @@ These entries will be pre-pended to the LUA_PATH environment variable --> - + diff --git a/resources/templates/conf/sip_profiles/internal.xml.noload b/resources/templates/conf/sip_profiles/internal.xml.noload index 012c50e59a..787fde8f95 100644 --- a/resources/templates/conf/sip_profiles/internal.xml.noload +++ b/resources/templates/conf/sip_profiles/internal.xml.noload @@ -97,7 +97,7 @@ - + - + @@ -292,7 +292,7 @@ - + + + Enterprise + http://{$domain_name}/app/provision?file=directory-enterprise&mac={$mac} + + + Speed Dial + http://{$domain_name}/app/provision/?file=directory-speed_dial&mac={$mac} + + + Select + SoftKey:Select + 1 + + + Exit + SoftKey:Exit + 4 + + \ No newline at end of file diff --git a/resources/templates/provision/polycom/4.x/{$mac}.cfg b/resources/templates/provision/polycom/4.x/{$mac}.cfg index 0326802b6e..b5d9431b66 100644 --- a/resources/templates/provision/polycom/4.x/{$mac}.cfg +++ b/resources/templates/provision/polycom/4.x/{$mac}.cfg @@ -4,8 +4,10 @@ {foreach $lines as $row}reg.{$row.line_number}.displayName="{$row.user_id}" reg.{$row.line_number}.address="{$row.user_id}" reg.{$row.line_number}.label="{$row.user_id}" + reg.{$row.line_number}.type="private" reg.{$row.line_number}.auth.userId="{$row.user_id}" reg.{$row.line_number}.auth.password="{$row.password}" + reg.{$row.line_number}.lineKeys="{$line_key_value_{$row.line_number}}" {if isset($row.outbound_proxy)}reg.{$row.line_number}.outboundProxy.address = "{$row.outbound_proxy}"{/if} {if isset($row.sip_port)}reg.{$row.line_number}.outboundProxy.port="{$row.sip_port}"{else}reg.{$row.line_number}.server.1.port="5060"{/if} diff --git a/resources/templates/provision/polycom/5.x/{$mac}.cfg b/resources/templates/provision/polycom/5.x/{$mac}.cfg index 0326802b6e..b5d9431b66 100755 --- a/resources/templates/provision/polycom/5.x/{$mac}.cfg +++ b/resources/templates/provision/polycom/5.x/{$mac}.cfg @@ -4,8 +4,10 @@ {foreach $lines as $row}reg.{$row.line_number}.displayName="{$row.user_id}" reg.{$row.line_number}.address="{$row.user_id}" reg.{$row.line_number}.label="{$row.user_id}" + reg.{$row.line_number}.type="private" reg.{$row.line_number}.auth.userId="{$row.user_id}" reg.{$row.line_number}.auth.password="{$row.password}" + reg.{$row.line_number}.lineKeys="{$line_key_value_{$row.line_number}}" {if isset($row.outbound_proxy)}reg.{$row.line_number}.outboundProxy.address = "{$row.outbound_proxy}"{/if} {if isset($row.sip_port)}reg.{$row.line_number}.outboundProxy.port="{$row.sip_port}"{else}reg.{$row.line_number}.server.1.port="5060"{/if} diff --git a/resources/templates/provision/yealink/cp860/y000000000037.cfg b/resources/templates/provision/yealink/cp860/y000000000037.cfg new file mode 100644 index 0000000000..af57fae6f5 --- /dev/null +++ b/resources/templates/provision/yealink/cp860/y000000000037.cfg @@ -0,0 +1,1533 @@ +#!version:1.0.0.1 + +##File header "#!version:1.0.0.1" can not be edited or deleted, and must be placed in the first line.## + +####################################################################################### +## Hostname ## +####################################################################################### +network.dhcp_host_name = + +####################################################################################### +## PPPOE ## +####################################################################################### +#Configure the username and password for PPPOE connection. +#Require reboot; +network.pppoe.user = +network.pppoe.password = + +####################################################################################### +## Network Advanced ## +####################################################################################### +#Configure the duplex mode and the speed of the WAN port. +#0-Auto negotiate (default), 1-Full duplex 10Mbps, 2-Full duplex 100Mbps, 3-Half duplex 10Mbps, 4-Half duplex 100Mbps; +network.internet_port.speed_duplex = +network.pc_port.speed_duplex = + +network.pc_port.dhcp_server = 1 +network.static_dns_enable = 1 + +####################################################################################### +## VLAN ## +####################################################################################### +network.vlan.internet_port_enable = 0 + +#Configure the VLAN ID, it ranges from 1 to 4094, the default value is 1. +#Require reboot; +network.vlan.internet_port_vid = + +#Configure the VLAN priority, it ranges from 0 (default) to 7. +#Require reboot; +network.vlan.internet_port_priority = + +#Enable or disable the VLAN of PC port; 0-Disabled (default), 1-Enabled; +#Require reboot; +network.vlan.pc_port_enable = + +#Configure the VLAN ID, it ranges from 1 to 4094, the default value is 1. +#Require reboot; +network.vlan.pc_port_vid = + +#Configure the VLAN priority, it ranges from 0 (default) to 7. +#Require reboot; +network.vlan.pc_port_priority = + +#Enable or disable the DHCP to obtain the information of the VLAN; 0-Disabled; 1-Enabled (default); +#Require reboot; +network.vlan.dhcp_enable = + +#Configure the DHCP option to obtain the information of the VLAN. It ranges from 0 to 255. +#Multiple options separated by a comma. It supports up to 5 options in all. +#Require reboot; +network.vlan.dhcp_option = + +####################################################################################### +## WEB Port ## +####################################################################################### +#Configure the HTTP port (80 by default) and the HTTPS port (443 by default) of the web server. Both range from 1 to 65535. +#Require reboot; +network.port.http = +network.port.https = + +####################################################################################### +## QOS ## +####################################################################################### +#Configure the voice QOS. It ranges from 0 to 63, the default value is 46. +#Require reboot; +network.qos.rtptos = + +#Configure the SIP QOS. It ranges from 0 to 63, the default value is 26. +#Require reboot; +network.qos.signaltos = + +####################################################################################### +## 802.1X ## +####################################################################################### +#Configure the 802.1x mode; 0-Disabled (default), 1-EAP-MD5, 2-EAP-TLS, 3-PEAP-MSCHAPV2, 4:EAP-TTLS/EAP-MSCHAPv2; +#Require reboot; +network.802_1x.mode = +network.802_1x.identity = +network.802_1x.md5_password = +network.802_1x.root_cert_url = +network.802_1x.client_cert_url = + +####################################################################################### +## VPN ## +####################################################################################### +#Enable or disable the VPN feature; 0-Disabled (default), 1-Enabled; +#Require reboot; +network.vpn_enable = + +####################################################################################### +## LLDP ## +####################################################################################### +#Enable or disable the LLDP feature; 0-Disabled, 1-Enabled (default); +#Require reboot; +network.lldp.enable = + +#Configure the interval(in seconds) the phone broadcasts the LLDP request. It ranges from 1 to 3600, the default value is 60. +#Require reboot; +network.lldp.packet_interval = + +####################################################################################### +## SNMP ## +####################################################################################### +#Enable or disable the SNMP feature; 0-Disabled (default), 1-Enabled; +#Require reboot; +network.snmp.enable = +network.snmp.port = + +#Configure the IP address(es) of the trusted SNMP server,multiple IP addresses must be separated by a space. +#Require reboot; +network.snmp.trust_ip = + +####################################################################################### +## Span to PC ## +####################################################################################### +#Enable or disable the span from WAN port to PC port feature; 0-Disabled (default), 1-Enabled; +#Require reboot; +network.span_to_pc_port = + +####################################################################################### +## RTP Port ## +####################################################################################### +#Configure the maximum local RTP port. It ranges from 0 to 65535, the default value is 11800. +#Require reboot; +network.port.max_rtpport = + +#Configure the minimum local RTP port. It ranges from 0 to 65535, the default value is 11780. +#Require reboot; +network.port.min_rtpport = + +####################################################################################### +## SYSLOG ## +####################################################################################### +#Configure the IP address of the syslog server. +#Require reboot; +syslog.server = + +#Configure the syslog level. It ranges from 0 to 6, the default value is 3. +#Require reboot; +syslog.log_level = + +####################################################################################### +## Redirect ## +####################################################################################### +#Enable or disable the redirect feature; 0-Disabled (default), 1-Enabled; +redirect.enable = + +####################################################################################### +## TR069 ## +####################################################################################### +#The TR069 feature is only applicable to some designated firmware version. +#All settings of TR069 require reboot. +#Enable or disable the TR069 feature; 0-Disabled (default), 1-Enabled; +managementserver.enable = +managementserver.username = +managementserver.password = +managementserver.url = +managementserver.connection_request_username = +managementserver.connection_request_password = +managementserver.periodic_inform_enable = 0 +managementserver.periodic_inform_interval = 60 + +####################################################################################### +## Autop Mode ## +####################################################################################### +#Configure the auto provision mode; +#0-Disabled , 1-Power on (default); +auto_provision.mode = + +####################################################################################### +## Autop PNP ## +####################################################################################### +#Enable or disable the Plug and Play feature; 0-Disabled, 1-Enabled (default); +auto_provision.pnp_enable = + +####################################################################################### +## Autop DHCP ## +####################################################################################### +#Enable or disable DHCP option mode; 0-Disabled, 1-Enabled (default); +auto_provision.dhcp_option.enable = + +#Configure the custom DHCP option number. It ranges from 128 to 254. +auto_provision.dhcp_option.list_user_options = + +####################################################################################### +## Autop Repeat ## +####################################################################################### +auto_provision.repeat.enable = 0 + +#Configure the interval (in minutes) for the phone to check new configuration files. It ranges from 1 to 43200, the default value is 1440. +#It is only applicable to "Repeatedly". +auto_provision.repeat.minutes = + +####################################################################################### +## Autop Weekly ## +####################################################################################### +auto_provision.weekly.enable = 0 + +#Configure the day of week for the phone to check new configuration files. The default vaule is 0123456. +#0-Sunday,1-Monday,2-Tuesday,3-Wednesday,4-Thursday,5-Friday,6-Saturday; +#It is only applicable to "Weekly" and "Power on + Weekly" modes. +#If the desired week is Monday, Tuesday and Wednesday, the value format is 012. +auto_provision.weekly.mask = + +#Configure the start time of the day for the phone to check new configuration files. The default value is 00:00. +#It is only applicable to "Weekly" and "Power on + Weekly" modes. +#If the desired start time of the day is seven forty-five a.m., the value format is 07:45. +auto_provision.weekly.begin_time = + +#Configure the end time of the day for the phone to check new configuration files. The default time is 00:00. +#It is only applicable to "Weekly" and "Power on + Weekly" modes. +#If the desired end time of the day is seven forty-five p.m., the value format is 19:45. +auto_provision.weekly.end_time = + +####################################################################################### +## Autop URL ## +####################################################################################### +auto_provision.server.url = {$yealink_provision_url} +auto_provision.server.username = +auto_provision.server.password = + +####################################################################################### +## Autop Aes Key ## +####################################################################################### +#Configure AES key (16 characters) for decrypting the common CFG file. +auto_provision.aes_key_16.com = + +#Configure AES key (16 characters) for decrypting the MAC-Oriented CFG file. +auto_provision.aes_key_16.mac = + +custom_mac_cfg.url = + +#Configure the value (manufacturer of the device) of DHCP option 60. The default is yealink +auto_provision.dhcp_option.option60_value = + +####################################################################################### +## Autop Code ## +####################################################################################### +#This feature allows user to trigger the auto provisioning by pressing a predefined string on the phone. +#Require reboot; +#"X" ranges from 1 to 50 + +#Configure the auto provisioning name. +#The valid value is a string, the maximum length is 100. +autoprovision.X.name = + + +#Configure the auto provisioning code; +#The valid value is a string, the maximum length is 100. +autoprovision.X.code = + +#Configure the URL of the auto provisioning server. +#The valid value is a string, the maximum length is 511. +autoprovision.X.url = + +#Configure the username and password for downloading. +#The valid value is a string, the maximum length is 100. +autoprovision.X.user = +autoprovision.X.password = + +#Configure AES key (16 characters) for decrypting the common CFG file and MAC-Oriented CFG file. +autoprovision.X.com_aes = +autoprovision.X.mac_aes = + +####################################################################################### +## Watch Dog ## +####################################################################################### +#Enable or disable the WatchDog feature; 0-Disabled, 1-Enabled (default); +watch_dog.enable = + +####################################################################################### +## SIP Advanced ## +####################################################################################### +#Enable or disable the phone to escape the pound key as percent sign followed by 23 when dialing out; 0-Disabled, 1-Enabled (default); +sip.use_23_as_pound = + +#Enable or disable the RFC2543 Hold feature; 0-Disabled (default), 1-Enabled; +sip.rfc2543_hold = + +#Enable or disable the phone to keep sending the SIP messages to the outbound server; 0-Disabled, 1-Enabled (default); +sip.use_out_bound_in_dialog = + +#Configure the registration random time (in seconds). It ranges from 0 (default) to 60. +sip.reg_surge_prevention = + +####################################################################################### +## Echo Cancellation ## +####################################################################################### +#Enable or disable the voice activity detection feature; 0-Disbaled (default), 1-Enabled; +voice.vad = + +#Enable or disable the comfortable noise generator; 0-Disabled, 1-Enabled (default); +voice.cng = + +#Enable or disable the echo canceller; 0-Disabled, 1-Enabled (default); +voice.echo_cancellation = + +#Configure the volume of the side tone. It ranges from -48 to 0, the default value is -3. +voice.side_tone= + +#configure the preview call mode; 1-Ignore:the mixed of tone and RTP (default), 2-Force: discard the RTP and play the tone, 3-Skip: skip the tone to play the RTP; +voice.call_preview_mode= + +####################################################################################### +## Jitter Buffer ## +####################################################################################### +#Configure the type of jitter buffer; 0-Fixed, 1-Adaptive (default); +voice.jib.adaptive = + +#Configure the minimum delay, maximum delay and normal delay. The default values are 0, 300, 120. +voice.jib.min = +voice.jib.max = +voice.jib.normal = + +####################################################################################### +## Tones ## +####################################################################################### +#Define the voice tone, the valid values can be Custom (default) or voice tone of different countries. For example, United States, France, Germany and so on. +#voice.tone.country = Custom +voice.tone.country = +voice.tone.dial = +voice.tone.ring = +voice.tone.busy = +voice.tone.congestion = +voice.tone.callwaiting = +voice.tone.dialrecall = +voice.tone.record= +voice.tone.info = +voice.tone.stutter = +voice.tone.message = +voice.tone.autoanswer = + +####################################################################################### +## Volume ## +####################################################################################### +#Configure the receiving volume of Speaker, Handset and Headset. It ranges from 0 to 15, the default value is 8. +voice.handfree.spk_vol = +voice.handfree.tone_vol = +voice.handset.spk_vol = +voice.handset.tone_vol = +voice.headset.spk_vol = +voice.headset.tone_vol = +voice.ring_vol= + +####################################################################################### +## WEB HTTP(S) ## +####################################################################################### +wui.https_enable = +wui.http_enable = + +####################################################################################### +## Transfer ## +####################################################################################### +#Enable or disable the transferee to display the missed call prompt when receiving a semi_attended transfer call; +#0-Disabled, 1-Enabled (default); +transfer.semi_attend_tran_enable = + +#Enable or disable the phone to complete the blind or attended transfer through on-hook; +#0-Disabled,1-Enabled(default); +transfer.blind_tran_on_hook_enable = + +#Enable or disable the conference initiator to transfer the call when hanging up. +#0-Disabled(default),1-Enabled; +transfer.tran_others_after_conf_enable = + +#Enable or disable the phone to complete the blind or attended transfer through on-hook; +#0-Disabled,1-Enabled(default); +transfer.on_hook_trans_enable = + +#Define the way of DSS key when configuring as a transfer key; 0-Display Number, 1-Attended Transfer, 2-Blind Transfer (default); +transfer.dsskey_deal_type = + +####################################################################################### +## Web Language ## +####################################################################################### +#Specify the web language, the valid values are: English, Chinese_S, Turkish, Portuguese, Spanish, Italian, French, Russian, Deutsch and Czech. +lang.wui = + +#Specify the LCD language, the valid values are: English (default), Chinese_S, Chinese_T, German, French, Turkish, Italian, Polish, Spanish and Portuguese. +lang.gui = English + +####################################################################################### +## Time ## +####################################################################################### +#Configure the domain name or the IP address of the NTP server. The default value is cn.pool.ntp.org. +local_time.ntp_server1 = cn.pool.ntp.org +local_time.ntp_server2 = cn.pool.ntp.org + +#Configure the update interval (in seconds) when using the NTP server. The default value is 1000. +local_time.interval = + +#Configure the daylight saving time feature; 0-Disabled, 1-Enabled, 2-Automatic (default); +local_time.summer_time = + +#Configure the DST type when the DST feature is enabled; 0-By Date (default), 1-By Week; +local_time.dst_time_type = + +#Configure the start time of DST. The default value is 1/1/0. +#If the DST type is configured as By Date, the value format is Month/Day/Hour. For example, the value 5/20/10 means the start time is at 10:00 on May 20. +#If the DST type is configured as By Week, the value format is Month/Day of Week/Day of Week Last in Month/Hour of Day. +#For example, the value 1/4/2/5 means the start time is at 5 o'clock on Tuesday of the 4th week in January. +local_time.start_time = + +#Configure the end time of DST. The default value is 12/31/23. The value format is the same to the start time. +local_time.end_time = + +#Configure the offset time (in seconds). It ranges from -300 to 300, the default value is 60. +local_time.offset_time = + +#Configure the time format; 0-12 Hour, 1-24 Hour (default); +local_time.time_format = + +#Configure the date format; 0-WWW MMM DD (default), 1-DD-MMM-YY, 2-YYYY-MM-DD, 3-DD/MM/YYYY, 4-MM/DD/YY, 5-DD MMM YYYY, 6-WWW DD MMM; +local_time.date_format = + +#Enable or disable the DHCP Time; 0-Disabled (default), 1-Enabled; +local_time.dhcp_time = + +local_time.manual_time_enable = 0 + +####################################################################################### +## Auto Redial ## +####################################################################################### +#Enable or disable the auto redial feature; 0-Disabled (default), 1-Enabled; +auto_redial.enable = + +#Configure the interval (in seconds) to wait before redial. It ranges from 1 to 300. The default value is 10. +auto_redial.interval = + +#Configure the auto redial times. It ranges from 1 to 300. The default value is 10. +auto_redial.times = + +####################################################################################### +## Zero Touch ## +####################################################################################### +#Enable or disable the Zero Touch feature; 0-Disabled (default), 1-Enabled; +zero_touch.enable = + +#Configure the waiting time (in seconds) before canceling the Zero Touch. It ranges from 0 to 100, the default value is 5. +zero_touch.wait_time = + +####################################################################################### +## Push XML ## +####################################################################################### +push_xml.server = + +#Enable or disable the phone to display the push XML interface when receiving an incoming call; 0-Disabled (default), 1-Enabled; +push_xml.block_in_calling= + +#Enable or disable the phone to use the push XML via SIP Notify message; 0-Disabled (default), 1-Enabled; +push_xml.sip_notify= + +####################################################################################### +## Dial Plan ## +####################################################################################### +dialplan.area_code.code = +dialplan.area_code.min_len = 1 +dialplan.area_code.max_len = 15 + +#When applying the rule to multiple lines, each line ID separated by a comma. +#e.g. dialplan.area_code.line_id = 1,2,3 +dialplan.area_code.line_id = + +#Configure the block out number. X ranges from 1 to 10. +#dialplan.block_out.number.x = +dialplan.block_out.number.1 = + +#When applying the rule to multiple lines, mutiple lines must be separated by a comma. E.g. 1,2,3. +#dialplan.block_out.line_id.X = 1,2,3 +dialplan.block_out.line_id.1 = + +# X ranges from 1 to 100. +dialplan.dialnow.rule.X = +dialplan.dialnow.line_id.X = + +# X ranges from 1 to 100. +dialplan.replace.prefix.X = +dialplan.replace.replace.X = +dialplan.replace.line_id.X = + +#Configure the dialnow rule. X ranges from 1 to 20. +#dialnow.item.X = Dial-now rule,Line ID +#Dial-now rule: Specify the numbers that need replacing; +#Line ID:Specify the line ID to apply the replace rule,multiple lines must be separated by a comma; +dialnow.item.1 = + +#Configure the replace rule. X ranges from 1 to 20. +#dialplan.item.X = Enabled,Prefix,Replaced,LineID +#Enabled: Enable or disable the replace rule. 0-Disabled, 1-Enabled; Prefix: Specify the numbers that need replacing; +#Replaced: Specify the alternate numbers; +#LineID: Specify the line ID to apply the replace rule,multiple lines ID must be separated by a comma; +dialplan.item.1 = + +####################################################################################### +## Remote Phonebook ## +####################################################################################### +#Configure the access URL and dispaly name of the remote phonebook. X ranges from 1 to 5. +#remote_phonebook.data.X.url = +#remote_phonebook.data.X.name = + +remote_phonebook.data.1.url = +remote_phonebook.data.1.name = + +####################################################################################### +## Network Directory ## +####################################################################################### +directory.update_time_interval = +directory.incoming_call_match_enable = 1 +bw.directory_enable = 0 + +####################################################################################### +## LDAP ## +####################################################################################### +#Configure the search criteria for name and number lookups. +ldap.enable = {$ldap_enable} +ldap.name_filter = {$ldap_namefilter} +ldap.number_filter = {$ldap_numberfilter} +ldap.host = {$ldap_host} +ldap.port = {$ldap_port} +ldap.base = {$ldap_base} +ldap.user = {$ldap_user} +ldap.password = {$ldap_password} + +#Specify the maximum of the displayed search results. It ranges from 1 to 32000, the default value is 50. +ldap.max_hits = {$ldap_max_hits} +ldap.name_attr = {$ldap_name_attr} +ldap.numb_attr = {$ldap_numb_attr} +ldap.display_name = {$ldap_display_name} + +#Configure the LDAP version. The valid value is 2 or 3 (default). +ldap.version = {$ldap_version} + +#Enable or disable the phone to query the contact name from the LDAP server when receiving an incoming call; 0-Disabled (default), 1-Enabled; +ldap.call_in_lookup = {$ldap_call_in_lookup} + +#Enable or disable the phone to sort the search results in alphabetical order; 0-Disabled (default), 1-Enabled; +ldap.ldap_sort = {$ldap_sort} + +####################################################################################### +## Features ## +####################################################################################### +#Configure the return code when activating DND; 404-No Found, 480-Temporarily not available (default), 486-Busy here; +#features.dnd_refuse_code = 480 +features.dnd_refuse_code = + +#Configure the return code when refusing a call. The valid values are 404, 480, 486 (default). +features.normal_refuse_code = + +#Configure the delay time (in seconds)of auto answer. The time ranges from 1 to 4, the default value is 1. +features.auto_answer_delay = + +#Enable or disable the transfer DSS key to perform the blind transfer; 0-Disabled, 1-Enabled (default); +features.dsskey_blind_tran = + +#Enable or disable the phone to mute the call during an active call; 0-Disabled, 1-Enabled (default); +features.allow_mute = + +features.group_listen_in_talking_enable = + +#Enable or disable the call completion feature; 0-Disabled (default), 1-Enabled; +features.call_completion_enable = + +#Enable or disable the phone to dial the IP address directly; 0-Disabled, 1-Enabled (default); +features.direct_ip_call_enable = 0 + +#Configure the power Indicator LED to turn on or turn off; 0-On (default), 1-Off; +features.power_led_on = 1 + +#Configure the overtime (in minutes) of logging web user interface. It ranges from 1 to 1000, the default value is 5. +features.relog_offtime = + +#Specify the ring device when the phone is in the Headset mode; 0-use Speaker (default), 1-use Headset, 2- Use Headset& Speaker; +features.ringer_device.is_use_headset = + +#Enable or disable to enter the password when long pressing the OK key to reset to factory; 0-Disabled (default), 1-Enabled; +#features.factory_pwd_enable = 1 + +features.idle_talk_power_led_flash_enable = + +#Enbale or disable the server to release the BLA line automatically; 0-Disabled (default), 1-Enabled; +features.auto_release_bla_line = + + +####################################################################################### +## Features FWD ## +####################################################################################### +#Configure the call forward key mode; 0-Phone mode (default), 1-Custom mode. +features.fwd_mode = + +#0-Disabled , 1-Enabled (default) +features.fwd_diversion_enable = + +####################################################################################### +## Features DND ## +####################################################################################### +#Configure the DND key mode; 0-Phone mode (default), 1-Custom mode. +features.dnd_mode = +features.dnd.on_code = +features.dnd.off_code = +features.dnd.emergency_enable = 1 +features.dnd.emergency_authorized_number = + +####################################################################################### +## Features BLF ## +####################################################################################### +#Configure the LED flashing mode of the BLF key (line key). The value is 0(default) or 1. +features.blf_led_mode = + +features.blf_list_version = 0 +features.blf_and_callpark_idle_led_enable = 0 + +####################################################################################### +## Features Intercom ## +####################################################################################### +#Enable or disable the intercom feature; 0-Disabled, 1-Enabled (default); +features.intercom.allow = + +#Enable or disable the phone to mute the Speaker when answering an intercom call; 0-Disabled (default), 1-Enabled; +features.intercom.mute = + +#Enable or disable the phone to play the intercom warning tone; 0-Disabled, 1-Enabled (default); +features.intercom.tone = + +#Enable or disable the phone to barge in an intercom call; 0-Disabled (default), 1-Enabled; +features.intercom.barge = + +####################################################################################### +## Features Hotline ## +####################################################################################### +#Configure the hotline number and delay time (in seconds). It ranges from 0 to 180, the default value is 4. +features.hotline_number = +features.hotline_delay = + +####################################################################################### +## Features DTMF ## +####################################################################################### +#Enable or disable the phone to suppress the display of DTMF digits; 0-Disabled (default), 1-Enabled; +features.dtmf.hide = + +#Enables or disables the IP phone to display the DTMF digits for a short period before displaying as asterisks; 0-Disabled (default), 1-Enabled; +features.dtmf.hide_delay = + +#Configure the repetition times of DTMF end packet. The valid values are 1, 2, 3 (default). +features.dtmf.repetition = + +#Configure DTMF sequences. It can be consisted of digits, alphabets, * and #. +features.dtmf.transfer = + +#Enable or disable the phone to send DTMF sequences during a call when pressing the transfer soft key or the TRAN key; 0-Disabled (default), 1-Enabled; +features.dtmf.replace_tran = + +####################################################################################### +## Features Audio Settings ## +####################################################################################### +#Enable or disable the headset prior feature; 0-Disabled (default), 1-Enabled; +features.headset_prior = + +#Enable or disable the dual headset feature; 0-Disabled (default), 1-Enabled; +features.headset_training = + +features.alert_info_tone = + +#Enable or disable the phone to play the warning tone when receiving a vocie mail. 0-Disabled; 1-Enabled(default). +features.voice_mail_tone_enable = + +#Configure the delay time (in seconds) of playing busy tone when rejecting a call. The valid values are 0 (default), 3 and 5. +features.busy_tone_delay = + +#Configure the phone whether to send a pound key when pressing double pound keys; 0-Send one pound key (default), 1-Do not send any pound key; +features.send_pound_key = + +#Define the "#" or "*" key as the send key; 0-Disabled, 1-# key(default), 2-* key; +features.pound_key.mode = + +#Enable or disable the phone to play tone when pressing the digit key; 0-Disabled, 1-Enabled (default); +features.send_key_tone = +features.key_tone = + +#Enable or disable the phone to play a warning tone when there is a held call; 0-Disabled, 1-Enabled (default); +features.play_hold_tone.enable = + +#Configure the interval of playing a warning tone. The default value is 30s. +features.play_hold_tone.delay = + +features.redial_tone = + +#Enable or disable the phone with active accounts to play tones in the dialing interface differently from the phone with no active accounts; 0-Disabled (default), 1-Enbaled; +features.partition_tone = + +#Configure the delay time (in milliseconds) before transfering a call. The default value is 0. +features.hold_trans_delay = + +#Enbale or disable the phone to play a local DTMF tone; 0-Disabled, 1-Enabled (default); +features.play_local_dtmf_tone_enable= + +####################################################################################### +## Features Remote Phonebook ## +####################################################################################### +#Enables or disables the IP phone to query the contact names from the remote phonebook when receiving incoming calls; 0-Disabled (default), 1-Enabled; +features.remote_phonebook.enable = + +#Set the interval (in seconds) for the phone to update the information of the remote phonebook. The default value is 3600. +features.remote_phonebook.flash_time = + +####################################################################################### +## Features Action ## +####################################################################################### +#Specific the address(es) or enters 'any' from which Action URI will be accepted. +#For discontinuous IP addresses, each IP address is separated by comma, for example: 192.168.1.20,10.2.1.30 +#For continuous IP addresses, the format likes *.*.*.* and the '*' stands for the values 0~255. For example: 10.10.*.* stands for the IP addresses that range from 10.10.0.0~10.10.255.255. +#If left blank, the IP phone cannot receive or handle any HTTP GET request. +#If set to 'any', the IP phone accepts and handles HTTP GET requests from any IP address. +features.action_uri_limit_ip = + +features.action_uri_reboot_now = 0 + +####################################################################################### +## Features Prefix ## +####################################################################################### +#Enable or disable the phone to encrypt the digits of the dialed number. The encrypted digits are displayed as asterisks on the LCD screen; 0-Disabled (default), 1-Enabled; +features.password_dial.enable = + +#Configure the prefix numbers displayed before the encrypted digits. +features.password_dial.prefix = + +#Configure the length of encrypted digits. +features.password_dial.length = + +####################################################################################### +## Features History ## +####################################################################################### +#Enable or disable the phone to save the call history; 0-Disabled, 1-Enabled (default); +features.save_call_history = + +####################################################################################### +## Features Pickup ## +####################################################################################### +#Enable or disable the phone to pick up the call using the group pickup soft key; 0-Disabled (default), 1-Enabled; +features.pickup.group_pickup_enable = + +features.pickup.group_pickup_code = + +#Enable or disable the phone to pick up the call using the directed pickup soft key; 0-Disabled (default), 1-Enabled; +features.pickup.direct_pickup_enable = + +features.pickup.direct_pickup_code = + +#Specify the way to notify the phone of the incoming call of the monitored user by visual or audio indicator; +#0-Disabled (default), 1-Enabled; +features.pickup.blf_visual_enable = +features.pickup.blf_audio_enable = + +####################################################################################### +## Phone Setting ## +####################################################################################### +#Configure the time (in seconds) the phone automatically dials out the dialed digits. It ranges from 1 to 14, the default value is 4. +phone_setting.inter_digit_time = + +#Configure the ring tone when the transfer fails. The valid values are: Ring1.wav.... Ring8.wav. +#If you set the custom ring tone (Busy.wav) for the phone, the value is: phone_setting.ring_type = Config:Busy.wav +#If you set the system ring tone (Ring2.wav) for the phone, the value is: phone_setting.ring_type = Resource:Ring2.wav +#phone_setting.ring_type = Resource:Ring1.wav +phone_setting.ring_type = +phone_setting.ring_for_tranfailed = + +#Enable or disable the phone to deal the 180 SIP message after the 183 SIP message; 0-Disabled, 1-Enabled (default); +phone_setting.is_deal180 = +phone_setting.show_code403 = + +#Configure the delay time (in seconds) for the dialnow rule. It ranges from 1 to 14, the default value is 1. +phone_setting.dialnow_delay = + +#Configure the emergency number, each separated by a comma. The default value is 112,911,110. +phone_setting.emergency.number = + +#Configure the using mode of the headset key. The value is 0 or 1(default). +phone_setting.page_tip = + +#Enable or disable the phone to show the logon wizard during startup; 0-Disabled (default), 1-Enabled; +phone_setting.logon_wizard = + +#Enable or disable the phone to automatically dial out the dialed digits in the pre-dial interface; 0-Disabled (default), 1-Enabled; +phone_setting.predial_autodial = 1 + +#Enable or disable customizing the softkey layout; 0-Disabled (default), 1-Enabled; +phone_setting.custom_softkey_enable = + +#Configure the using mode of the headset key. The value is 0 or 1(default). +phone_setting.headsetkey_mode = + +#Enable or disabled mail power led flash. 0-Disabled, 1-Enabled. +phone_setting.mail_power_led_flash_enable = 1 + +####################################################################################### +## Phone Setting UI ## +####################################################################################### +#Configure the active backlight level. It ranges from 1 to 3, the default value is 2. +#The same level for different phones may result in different backlight intensities. +phone_setting.active_backlight_level = +phone_setting.inactive_backlight_level = 1 + +####################################################################################### +## Phone Setting BLF ## +####################################################################################### +phone_setting.blf_list_enable = 1 +phone_setting.auto_blf_list_enable = 1 + +#Specify the prior of the line keys and EXP keys when automatically configure the blf list 0-Configure the line keys first, 1-Configure the EXP keys first; +phone_setting.blf_list_sequence_type = + +####################################################################################### +## Key Lock ## +####################################################################################### +#Configure the keypad lock type; 0-Disabled (default), 1-Enable +phone_setting.lock = + +#Configure the unlock password for the phone. The default value is 123. +phone_setting.phone_lock.unlock_pin = + + +#Configures the interval (in seconds) to automatically lock the IP phone. It ranges from 0 to 3600, the default value is 0. +phone_setting.phone_lock.lock_time_out = + +#Configure the keypad lock type;0-All Keys(default), 1-Function Key, 2-Menu Key +phone_setting.phone_lock.lock_key_type = + +#Configure the backlight time (in seconds). The valid values are: 0-Always on, 1-Always off, 15-15s, 30-30s (default), 60-60s, 120-120s. +phone_setting.backlight_time = 0 + +####################################################################################### +## Wallpaper ## +####################################################################################### +wallpaper_upload.url = {$yealink_cp860_wallpaper} + +####################################################################################### +## Multicast ## +####################################################################################### +#Configure the codec of multicast paging. +multicast.codec = + +#Enbale or diable the phone to handle the incoming multicast paging calls when there is a multicast paging call on the phone; 0-Disabled, 1-Enabled (default); +#If enabled, the phone will answer the incoming multicast paging call with a higher priority and ignore that with a lower priority. +multicast.receive_priority.enable = + +#Configure the priority of multicast paging calls. It ranges from 0 to 10. +multicast.receive_priority.priority = + +#Configure the lable displayed on the LCD screen when receiving the multicast paging. X ranges from 1 to 10. +multicast.listen_address.X.label = + +#Configure the listening multicast IP address and port number for the phone. X ranges from 1 to 10. +multicast.listen_address.X.ip_address = + +####################################################################################### +## Super Search ## +####################################################################################### +super_search.recent_call = 1 + +####################################################################################### +## Broadsoft Phonebook ## +####################################################################################### +bw_phonebook.group_enable = 1 +bw_phonebook.personal_enable = 1 +bw_phonebook.group_common_enable = 0 +bw_phonebook.group_common_displayname = +bw_phonebook.enterprise_enable = 0 +bw_phonebook.enterprise_common_enable = 0 +bw_phonebook.enterprise_common_displayname = +bw_phonebook.call_log_enable = 1 +bw_phonebook.server_search_enable = 1 +bw_phonebook.group_displayname = +bw_phonebook.enterprise_displayname = +bw_phonebook.common_displayname = +bw_phonebook.personal_displayname = + +####################################################################################### +## Broadsoft ## +####################################################################################### +#Enable or disable the phone to access the BSFT call log/phonebook directly when pressing the History/Directory soft keys; +#0-Disabled (default), 1-Enabled; +#Require reboot; +bw.calllog_and_dir = + +#Enable or disable the feature key synchronization; 0-Disabled (default), 1-Enabled; +bw.feature_key_sync = 0 + +####################################################################################### +## Security ## +####################################################################################### +#Enable or disable the phone to only accept the certificates in the Trusted Certificates list; +#0-Disabled, 1-Enabled (default); +security.trust_certificates = + +#Define the login username and password of the user, var and administrator. +#If you change the username of the administrator from "admin" to "admin1", your new administrator's username should be configured as: security.user_name.admin = admin1. +#If you change the password of the administrator from "admin" to "admin1pwd", your new administrator's password should be configured as: security.user_password = admin1:admin1pwd. + +#The following examples change the user's username to "user23" and the user's password to "user23pwd". +#security.user_name.user = user23 +#security.user_password = user23:user23pwd +#The following examples change the var's username to "var55" and the var's password to "var55pwd". +{if isset($user_name) } +security.user_name.user = {$user_name} +security.user_password = {$user_name}:{$user_password} +{/if} +{if isset($admin_name) } +security.user_name.admin = {$admin_name} +security.user_password = {$admin_name}:{$admin_password} +{/if} +{if isset($var_name) } +security.user_name.var = {$var_name} +security.user_password = {$var_name}:{$var_password} +{/if} + +#Enable or disable the 3-level permissions (open var); 0-Disabled (default), 1-Enabled; +#Require reboot; +security.var_enable = +security.ca_cert = +security.dev_cert = +security.cn_validation = + + +####################################################################################### +## Linekey ## +####################################################################################### +#The x of the parameter "linekey.x.line" ranges from 1 to 27. +#The default value equals to the value of x. For example, the default value of the parameter "linekey.1.line" is 1. +#linekey.x.lable--Define the label for each line key. + +#Configure Line Key1 +linekey.1.line = +linekey.1.value = +linekey.1.extension = +linekey.1.type = +linekey.1.label = +linekey.1.xml_phonebook = + +#Configure Line Key2 +linekey.2.line = +linekey.2.value = +linekey.2.extension = +linekey.2.type = +linekey.2.label = +linekey.2.xml_phonebook = + +linekey.3.line = +linekey.3.value = +linekey.3.extension = +linekey.3.type = +linekey.3.label = +linekey.3.xml_phonebook = + +linekey.4.line = +linekey.4.value = +linekey.4.extension = +linekey.4.type = +linekey.4.label = +linekey.4.xml_phonebook = + +linekey.5.line = +linekey.5.value = +linekey.5.extension = +linekey.5.type = +linekey.5.label = +linekey.5.xml_phonebook = + +linekey.6.line = +linekey.6.value = +linekey.6.extension = +linekey.6.type = +linekey.6.label = +linekey.6.xml_phonebook = + +linekey.7.line = +linekey.7.value = +linekey.7.extension = +linekey.7.type = +linekey.7.label = +linekey.7.xml_phonebook = + +linekey.8.line = +linekey.8.value = +linekey.8.extension = +linekey.8.type = +linekey.8.label = +linekey.8.xml_phonebook = + +linekey.9.line = +linekey.9.value = +linekey.9.extension = +linekey.9.type = +linekey.9.label = +linekey.9.xml_phonebook = + +linekey.10.line = +linekey.10.value = +linekey.10.extension = +linekey.10.type = +linekey.10.label = +linekey.10.xml_phonebook = + +linekey.11.line = +linekey.11.value = +linekey.11.extension = +linekey.11.type = +linekey.11.label = +linekey.11.xml_phonebook = + +linekey.12.line = +linekey.12.value = +linekey.12.extension = +linekey.12.type = +linekey.12.label = +linekey.12.xml_phonebook = + +linekey.13.line = +linekey.13.value = +linekey.13.extension = +linekey.13.type = +linekey.13.label = +linekey.13.xml_phonebook = + +linekey.14.line = +linekey.14.value = +linekey.14.extension = +linekey.14.type = +linekey.14.label = +linekey.14.xml_phonebook = + +linekey.15.line = +linekey.15.value = +linekey.15.extension = +linekey.15.type = +linekey.15.xml_phonebook = +linekey.15.label = + +linekey.16.line = +linekey.16.value = +linekey.16.extension = +linekey.16.type = +linekey.16.xml_phonebook = +linekey.16.label = + +linekey.17.line = +linekey.17.value = +linekey.17.extension = +linekey.17.type = +linekey.17.xml_phonebook = +linekey.17.label = + +linekey.18.line = +linekey.18.value = +linekey.18.extension = +linekey.18.type = +linekey.18.xml_phonebook = +linekey.18.label = + +linekey.19.line = +linekey.19.value = +linekey.19.extension = +linekey.19.type = +linekey.19.xml_phonebook = +linekey.19.label = + +linekey.20.line = +linekey.20.value = +linekey.20.extension = +linekey.20.type = +linekey.20.xml_phonebook = +linekey.20.label = + + +linekey.21.line = +linekey.21.value = +linekey.21.extension = +linekey.21.type = +linekey.21.xml_phonebook = +linekey.21.label = + + +linekey.22.line = +linekey.22.value = +linekey.22.extension = +linekey.22.type = +linekey.22.xml_phonebook = +linekey.22.label = + +linekey.23.line = +linekey.23.value = +linekey.23.extension = +linekey.23.type = +linekey.23.xml_phonebook = +linekey.23.label = + +linekey.24.line = +linekey.24.value = +linekey.24.extension = +linekey.24.type = +linekey.24.xml_phonebook = +linekey.24.label = + +linekey.25.line = +linekey.25.value = +linekey.25.extension = +linekey.25.type = +linekey.25.xml_phonebook = +linekey.25.label = + +linekey.26.line = +linekey.26.value = +linekey.26.extension = +linekey.26.type = +linekey.26.xml_phonebook = +linekey.26.label = + +linekey.27.line = +linekey.27.value = +linekey.27.extension = +linekey.27.type = +linekey.27.xml_phonebook = +linekey.27.label = +####################################################################################### +## Programablekey ## +####################################################################################### +#X ranges from 1 to 13. +#programablekey.x.type--Customize the programmable key type. +#The valid types are: +#0-N/A 2-Forward 5-DND 6-Redial 7-Call Return 8-SMS 9-Direct Pickup 13-Spead Dial +#22-XML Group 23-Group Pickup 27-XML Browser 28-History 29-Directory 30-Menu 31-Switch Account 32-New SMS +#33-Status 40-PTT 43-Local Phonebook 44-Broadsoft Phonebook 45-Local Group 46-Broadsoft Group 47-XML Phonebook 50-Keypad Lock +#PTT-add a specified prefix number before the dialed number. +#programablekey.x.line--Configure the desired line to apply the key feature. It ranges from 0 to 6. +#The value 0 of the "proramablekey.x.line" stands for Auto, it means the first available line. +#But, when the programmable key is configured as Pick Up, the value 0 stands for line 1. + +#programablekey.x.value = +#programablekey.x.xml_phonebook--Specify the desired remote phonebook/local group/BSFT phonebook for the programmable key. This parameter is only appilicable to the feature XML Group/Local Group/Broadsoft Group. +#programablekey.x.history_type = + +#programablekey.x.label--This parameter is only available to the key 1 to key 4. +programablekey.1.type = +programablekey.1.line = +programablekey.1.value = +programablekey.1.xml_phonebook = +programablekey.1.history_type = +programablekey.1.label = +programablekey.1.pickup_value = + +########################################################################################## +## Expansion Key ## +########################################################################################## +#X ranges from 1 to 16, Y ranges from 1 to 40. +#expansion_module.x.key.y.type = 37 (Switch by default) +#expansion_module.x.key.y.line = 0 +#expansion_module.x.key.y.value = +#expansion_module.x.key.y.pickup_value = +#expansion_module.x.key.y.label = +#expansion_module.X.key.Y.xml_phonebook = + +#Each expansion module1 key1 +expansion_module.1.key.1.type = +expansion_module.1.key.1.line = +expansion_module.1.key.1.value = +expansion_module.1.key.1.pickup_value = +expansion_module.1.key.1.label = +expansion_module.1.key.1.xml_phonebook = + +#Each expansion module1 key2 +expansion_module.1.key.2.type = +expansion_module.1.key.2.line = +expansion_module.1.key.2.value = +expansion_module.1.key.2.pickup_value = +expansion_module.1.key.2.label = +expansion_module.1.key.2.xml_phonebook = + +#Each expansion module2 key1 +expansion_module.2.key.1.type = +expansion_module.2.key.1.line = +expansion_module.2.key.1.value = +expansion_module.2.key.1.pickup_value = +expansion_module.2.key.1.label = +expansion_module.2.key.1.xml_phonebook = + +####################################################################################### +## Forward Always ## +####################################################################################### +#Enable or disable the always forward feature; 0-Disabled (default), 1-Enabled; +forward.always.enable = +forward.always.target = +forward.always.on_code = +forward.always.off_code = + +####################################################################################### +## Forward Busy ## +####################################################################################### +#Enable or disable the busy forward feature; 0-Disabled (default), 1-Enabled; +forward.busy.enable = +forward.busy.target = +forward.busy.on_code = +forward.busy.off_code = + +####################################################################################### +## Forward No Answer ## +####################################################################################### +#Enable or disable the no answer forward feature; 0-Disabled (default), 1-Enabled; +#Configure the waiting ring times before forwarding. It ranges from 0 to 20, the default value is 2. +forward.no_answer.enable = +forward.no_answer.target = +forward.no_answer.timeout = +forward.no_answer.on_code = +forward.no_answer.off_code = + +####################################################################################### +## Forward International ## +####################################################################################### +#Enable or disable the phone to forward the call to the international number (the prefix is 00); 0-Disabled (default), 1-Enabled; +forward.international.enable = + +####################################################################################### +## ACD ## +####################################################################################### +#Enable or disable the phone to automatically change the phone status to available; 0-Disabled (default), 1-Enabled; +acd.auto_available = + +#Configure the interval (in seconds) to automatically turn the state of the ACD agent to available. It ranges from 0 to 120, the default value is 60. +acd.auto_available_timer = +acd.bw = + +####################################################################################### +## Hotdesking Startup ## +####################################################################################### +#Enable or disable the phone to show the following items on the login wizard during startup; 0-Disabled, 1-Enabled; +#hotdesking.startup_register_name_enable = 1 (default) +#hotdesking.startup_username_enable = 1 (default) +#hotdesking.startup_password_enable = 0 (default) +#hotdesking.startup_sip_server_enable = 0 (default) +#hotdesking.startup_outbound_enable = 0 (default) + +hotdesking.startup_register_name_enable = +hotdesking.startup_username_enable = +hotdesking.startup_password_enable = +hotdesking.startup_sip_server_enable = +hotdesking.startup_outbound_enable = + +####################################################################################### +## Hotdesking Dsskey ## +####################################################################################### +#Enable or disable the phone to show the following items on the login wizard when pressing the Hot Desking DSS key; +#0-Disabled, 1-Enabled; +#hotdesking.dsskey_register_name_enable = 1 (default) +#hotdesking.dsskey_username_enable = 1 (default) +#hotdesking.dsskey_password_enable = 0 (default) +#hotdesking.dsskey_sip_server_enable = 0 (default) +#hotdesking.dsskey_outbound_enable = 0 (default) + +hotdesking.dsskey_register_name_enable = +hotdesking.dsskey_username_enable = +hotdesking.dsskey_password_enable = +hotdesking.dsskey_sip_server_enable = +hotdesking.dsskey_outbound_enable = + +####################################################################################### +## Alert Info ## +####################################################################################### +#"X" ranges from 1 to 10; +#Configure the text to map the keywords contained in the "Alert-info" header. +#distinctive_ring_tones.alert_info.X.text = family +distinctive_ring_tones.alert_info.1.text = + +#Specify the ring tone for each text. It ranges from 1 to 8. The default value 1 stands for Ring1.wav. +#1-Ring1.wav, 2-Ring2.wav, 3-Ring3.wav, 4-Ring4.wav, 5-Ring5.wav, 6-Ring6.wav, 7-Ring7.wav, 8-Ring8.wav. +#distinctive_ring_tones.alert_info.X.ringer = 1 +distinctive_ring_tones.alert_info.1.ringer = + +####################################################################################### +## Call Waiting ## +####################################################################################### +#Enable or disable the call waiting feature; 0-Disabled, 1-Enabled (default); +call_waiting.enable = +#Enable or disable the playing of call waiting tone; 0-Disabled, 1-Enabled (default); +call_waiting.tone = + +call_waiting.on_code = +call_waiting.off_code = + +####################################################################################### +## Call Park ## +####################################################################################### +call_park.enable = 0 +call_park.group_enable = 0 +call_park.park_ring = +call_park.park_visual_notify_enable = + +####################################################################################### +## Action URL ## +####################################################################################### +#action_url.setup_completed--Inform the server that the phone has completed the startup. +#action_url.dnd_on-- Inform the server that the DND is activated on the phone. +#The value format is: http://IP address of server/help.xml?variable name=variable value. +#The valid variable values are: $mac--MAC address of phone, $ip--The current IP address of phone, $model--Phone model, $firmware--Phone firmware version. +#$active_url--The SIP URI of the current account when the phone is in the incoming state, outgoing state or during conversation. +#$active_user--The username of the current account when the phone is in the incoming state, outgoing state or during conversation. +#$active_host--The host name of the current account when the phone is in the incoming state, the outgoing state or during conversation. +#$local--The SIP URI of the caller when outgoing calls or the SIP URI of the callee when receiving calls. +#$remote--The SIP URI of the callee when outgoing calls or the SIP URI of the caller when receiving calls. +#$display_local--The display name of the caller when outgoing calls or the display name of the callee when receiving calls. +#$display_remote--The display name of the callee when outgoing calls or the display name of the caller when receiving calls. +#$call_id--The caller ID when in the incoming state, the outgoing state or during conversation. +#For example, action_url.log_on = http://192.168.1.20/help.xml?mac=$mac + +action_url.setup_completed = +action_url.log_on = +action_url.log_off = +action_url.register_failed = +action_url.off_hook = +action_url.on_hook = +action_url.incoming_call = +action_url.outgoing_call = +action_url.call_established = +action_url.dnd_on = +action_url.dnd_off = +action_url.always_fwd_on = +action_url.always_fwd_off = +action_url.busy_fwd_on = +action_url.busy_fwd_off = +action_url.no_answer_fwd_on = +action_url.no_answer_fwd_off = +action_url.transfer_call = +action_url.blind_transfer_call = +action_url.attended_transfer_call = +action_url.hold = +action_url.unhold = +action_url.mute = +action_url.unmute = +action_url.missed_call = +action_url.call_terminated = +action_url.busy_to_idle = +action_url.idle_to_busy = +action_url.ip_change = +action_url.forward_incoming_call = +action_url.reject_incoming_call = +action_url.answer_new_incoming_call = +action_url.transfer_finished = +action_url.transfer_failed = + +####################################################################################### +## Ringtone ## +####################################################################################### +#Before using this parameter, you should store the desired ring tone (x.wav) to the provisioning server. +#For more information, refer to Yealink Auto Provisioning User Guide. +ringtone.url = + +#ringtone.delete = http://localhost/all,delete all the customized ring tones. +ringtone.delete = + +####################################################################################### +## UI Language ## +####################################################################################### +#Before using this parameter, you should store the desired language pack to the provisioning server. +#For more information, refer to Yealink Auto Provisioning User Guide. +gui_lang.url = + +#gui_lang.delete = http://localhost/all, delete all the customized languages. +gui_lang.delete = + +####################################################################################### +## Time Settings ## +####################################################################################### + +#Configure the time zone and time zone name. The time zone ranges from -11 to +12, the default value is +8. +#The default time zone name is China(Beijing). +#local_time.time_zone = +8 +#local_time.time_zone_name = China(Beijing) +local_time.time_zone = {$yealink_time_zone} +local_time.time_zone_name = {$yealink_time_zone_name} + +#Configure the domain name or the IP address of the NTP server. The default value is cn.pool.ntp.org. +local_time.ntp_server1 = {$ntp_server_1} +local_time.ntp_server2 = {$ntp_server_2} + +#Configure the update interval (in seconds) when using the NTP server. The default value is 1000. +local_time.interval = + +#Configure the daylight saving time feature; 0-Disabled, 1-Enabled, 2-Automatic (default); +local_time.summer_time = + +#Configure the DST type when the DST feature is enabled; 0-By Date (default), 1-By Week; +local_time.dst_time_type = + +#Configure the start time of DST. The default value is 1/1/0. +#If the DST type is configured as By Date, the value format is Month/Day/Hour. For example, the value 5/20/10 means the start time is at 10:00 on May 20. +#If the DST type is configured as By Week, the value format is Month/Day of Week/Day of Week Last in Month/Hour of Day. +#For example, the value 1/4/2/5 means the start time is at 5 o'clock on Tuesday of the 4th week in January. +local_time.start_time = {$yealink_time_zone_start_time} + +#Configure the end time of DST. The default value is 12/31/23. The value format is the same to the start time. +local_time.end_time = {$yealink_time_zone_end_time} + +#Configure the offset time (in seconds). It ranges from -300 to 300, the default value is blank. +local_time.offset_time = {$yealink_offset_time} + +#Configure the time format; 0-12 Hour, 1-24 Hour (default); +local_time.time_format = {$yealink_time_format} + +#Configure the date format; 0-WWW MMM DD (default), 1-DD-MMM-YY, 2-YYYY-MM-DD, 3-DD/MM/YYYY, 4-MM/DD/YY, 5-DD MMM YYYY, 6-WWW DD MMM; +local_time.date_format = {$yealink_date_format} + +#Enable or disable the DHCP Time; 0-Disabled (default), 1-Enabled; +local_time.dhcp_time = + +#Enable or disable the manual time; 0-NTP time, 1-manual time. The default value is 0. +local_time.manual_time_enable = + +####################################################################################### +## Trusted Certificates ## +####################################################################################### +#Before using this parameter, you should store the desired certificate to the provisioning server. +trusted_certificates.url = + +#trusted_certificates.delete = http://localhost/all,delete all the trusted certificates. +trusted_certificates.delete = + +####################################################################################### +## Server Certificates ## +####################################################################################### +#Before using this parameter, you should store the desired certificate to the provisioning server. +server_certificates.url = + +#server_certificates.delete = http://localhost/all, delete the server certificate. +server_certificates.delete = + +####################################################################################### +## Contact ## +####################################################################################### +#Before using these parameters, you should store the desired resource files to the provisioning server. +#For more information, refer to Yealink SIP-T46G IP Phone Family Administrator Guide. +local_contact.data.url = + +####################################################################################### +## Auto DST ## +####################################################################################### +auto_dst.url = + +####################################################################################### +## Dialplan Now ## +####################################################################################### +dialplan_dialnow.url = + +####################################################################################### +## Dialplan Replace ## +####################################################################################### +dialplan_replace_rule.url = + +####################################################################################### +## Custom Factory Configuration ## +####################################################################################### +#Configure the access URL for downloading the customized factory configurations. +#Before using this parameter, you should store the desired factory configuration file to the provisioning server. +custom_factory_configuration.url = + +####################################################################################### +## Custom Configuration ## +####################################################################################### +#Configure the access URL for downloading the configurations. +#Before using this parameter, you should store the desired configuration file to the provisioning server. +configuration.url = + +####################################################################################### +## Custom Softkey ## +####################################################################################### +#Customize the softkeys presented on the phone LCD screen when Callfailed, Callin, Connecting, Dialing, Ringback and Talking. +#Before using these parameters, you should store the desired XML files to the provisioning server. +custom_softkey_call_failed.url = +custom_softkey_call_in.url = +custom_softkey_connecting.url = +custom_softkey_dialing.url = +custom_softkey_ring_back.url = +custom_softkey_talking.url = + +####################################################################################### +## Local Contact Photo ## +####################################################################################### +local_contact.data_photo_tar.url = + +####################################################################################### +## Call List ## +####################################################################################### +#Configure the access URL for downloading the call list. +#Before using this parameter, you should store the desired call list file to the provisioning server. +#Require reboot +call_list.url = + +####################################################################################### +## Open VPN ## +####################################################################################### +#Configure the access URL for downloading the open VPN tar. +#Before using this parameter, you should store the desired VPN file to the provisioning server +openvpn.url = + +####################################################################################### +## Level ## +####################################################################################### +#Configure the access URL for downloading the files for var. +#Before using this parameter, you should store the desired files to the provisioning server. +#Require reboot +web_item_level.url = + +####################################################################################### +## Super Search URL ## +####################################################################################### +super_search.url = + +####################################################################################### +## Directory Setting ## +####################################################################################### +#Configure the access URL of the directory setting file. +directory_setting.url = {$yealink_directory_settingurl} + +####################################################################################### +## Configure the access URL of firmware ## +####################################################################################### +#Before using this parameter, you should store the desired firmware (x.71.x.x.rom) to the provisioning server. +firmware.url = {$yealink_cp860_firmware_url} diff --git a/resources/templates/provision/yealink/cp860/{$mac}.cfg b/resources/templates/provision/yealink/cp860/{$mac}.cfg index 412339f6a2..fc799d7c1a 100644 --- a/resources/templates/provision/yealink/cp860/{$mac}.cfg +++ b/resources/templates/provision/yealink/cp860/{$mac}.cfg @@ -44,7 +44,11 @@ account.1.naptr_build = 0 account.1.fallback.redundancy_type = 0 account.1.fallback.timeout = 120 account.1.sip_server.1.address = -account.1.sip_server.1.port = 5060 +{if $sip_transport_1 == 'dns srv'} +account.1.sip_server.1.port = 0 +{else} +account.1.sip_server.1.port = {$sip_port_1} +{/if} #Configure the register expiry time (in seconds), the default value is 3600. account.1.sip_server.1.expires = {$register_expires_1} account.1.sip_server.1.retry_counts = 3 @@ -122,7 +126,7 @@ account.1.nat.stun_server = account.1.nat.stun_port = 3478 #Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify; -account.1.nat.udp_update_enable = 1 +account.1.nat.udp_update_enable = 3 #Specify the keep-alive interval (in seconds), the default value is 30. account.1.nat.udp_update_time = 30 @@ -920,8 +924,8 @@ account.2.xsi.port = #Configure the time zone and time zone name. The time zone ranges from -11 to +12, the default value is +8. #local_time.time_zone = +8 #local_time.time_zone_name = China(Beijing) -local_time.time_zone = -local_time.time_zone_name = +local_time.time_zone = {$time_zone} +local_time.time_zone_name = {$time_zone_name} ####################################################################################### diff --git a/resources/templates/provision/yealink/t20p/y000000000007.cfg b/resources/templates/provision/yealink/t20p/y000000000007.cfg index 5d01537e02..a5eb6a659a 100644 --- a/resources/templates/provision/yealink/t20p/y000000000007.cfg +++ b/resources/templates/provision/yealink/t20p/y000000000007.cfg @@ -1033,7 +1033,7 @@ features.relog_offtime = #Enable or disable the phone to dial the IP address directly; 0-Disabled, 1-Enabled (default); #Require reboot; -features.direct_ip_call_enable = +features.direct_ip_call_enable = 0 #Specify the ring device when the phone is in the Headset mode; 0-use Speaker (default), 1-use Headset; features.ringer_device.is_use_headset = diff --git a/resources/templates/provision/yealink/t20p/{$mac}.cfg b/resources/templates/provision/yealink/t20p/{$mac}.cfg index 548e98fcd5..0cc5bc9498 100644 --- a/resources/templates/provision/yealink/t20p/{$mac}.cfg +++ b/resources/templates/provision/yealink/t20p/{$mac}.cfg @@ -223,8 +223,8 @@ account.1.nat.stun_server = #Configure the STUN server port, the default value is 3478. account.1.nat.stun_port = -#Enable or disable the NAT keep-alive; 0-Disabled, 1-Enabled (default); -account.1.nat.udp_update_enable = +#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify; +account.1.nat.udp_update_enable = 3 #Specify the keep-alive interval (in seconds), the default value is 30. account.1.nat.udp_update_time = diff --git a/resources/templates/provision/yealink/t21p/y000000000052.cfg b/resources/templates/provision/yealink/t21p/y000000000052.cfg index 7293266e9c..7e540ed1fe 100644 --- a/resources/templates/provision/yealink/t21p/y000000000052.cfg +++ b/resources/templates/provision/yealink/t21p/y000000000052.cfg @@ -571,7 +571,7 @@ features.group_listen_in_talking_enable = features.call_completion_enable = #Enable or disable the phone to dial the IP address directly; 0-Disabled, 1-Enabled (default); -features.direct_ip_call_enable = +features.direct_ip_call_enable = 0 #Configure the power Indicator LED to turn on or turn off; 0-On (default), 1-Off; features.power_led_on = 1 diff --git a/resources/templates/provision/yealink/t21p/{$mac}.cfg b/resources/templates/provision/yealink/t21p/{$mac}.cfg index d5a65ef413..8641aa3259 100644 --- a/resources/templates/provision/yealink/t21p/{$mac}.cfg +++ b/resources/templates/provision/yealink/t21p/{$mac}.cfg @@ -44,7 +44,11 @@ account.1.naptr_build = 0 account.1.fallback.redundancy_type = 0 account.1.fallback.timeout = 120 account.1.sip_server.1.address = -account.1.sip_server.1.port = 5060 +{if $sip_transport_1 == 'dns srv'} +account.1.sip_server.1.port = 0 +{else} +account.1.sip_server.1.port = {$sip_port_1} +{/if} #Configure the register expiry time (in seconds), the default value is 3600. account.1.sip_server.1.expires = {$register_expires_1} account.1.sip_server.1.retry_counts = 3 @@ -122,7 +126,7 @@ account.1.nat.stun_server = account.1.nat.stun_port = 3478 #Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify; -account.1.nat.udp_update_enable = 1 +account.1.nat.udp_update_enable = 3 #Specify the keep-alive interval (in seconds), the default value is 30. account.1.nat.udp_update_time = 30 @@ -920,8 +924,8 @@ account.2.xsi.port = #Configure the time zone and time zone name. The time zone ranges from -11 to +12, the default value is +8. #local_time.time_zone = +8 #local_time.time_zone_name = China(Beijing) -local_time.time_zone = -local_time.time_zone_name = +local_time.time_zone = {$time_zone} +local_time.time_zone_name = {$time_zone_name} ####################################################################################### diff --git a/resources/templates/provision/yealink/t22p/y000000000005.cfg b/resources/templates/provision/yealink/t22p/y000000000005.cfg index 48c645f664..b47609c381 100644 --- a/resources/templates/provision/yealink/t22p/y000000000005.cfg +++ b/resources/templates/provision/yealink/t22p/y000000000005.cfg @@ -1033,7 +1033,7 @@ features.relog_offtime = #Enable or disable the phone to dial the IP address directly; 0-Disabled, 1-Enabled (default); #Require reboot; -features.direct_ip_call_enable = +features.direct_ip_call_enable = 0 #Specify the ring device when the phone is in the Headset mode; 0-use Speaker (default), 1-use Headset; features.ringer_device.is_use_headset = diff --git a/resources/templates/provision/yealink/t22p/{$mac}.cfg b/resources/templates/provision/yealink/t22p/{$mac}.cfg index 7fef6e9bfc..ce904e36e6 100644 --- a/resources/templates/provision/yealink/t22p/{$mac}.cfg +++ b/resources/templates/provision/yealink/t22p/{$mac}.cfg @@ -223,8 +223,8 @@ account.1.nat.stun_server = #Configure the STUN server port, the default value is 3478. account.1.nat.stun_port = -#Enable or disable the NAT keep-alive; 0-Disabled, 1-Enabled (default); -account.1.nat.udp_update_enable = +#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify; +account.1.nat.udp_update_enable = 3 #Specify the keep-alive interval (in seconds), the default value is 30. account.1.nat.udp_update_time = diff --git a/resources/templates/provision/yealink/t23g/y000000000044.cfg b/resources/templates/provision/yealink/t23g/y000000000044.cfg index 7293266e9c..7e540ed1fe 100644 --- a/resources/templates/provision/yealink/t23g/y000000000044.cfg +++ b/resources/templates/provision/yealink/t23g/y000000000044.cfg @@ -571,7 +571,7 @@ features.group_listen_in_talking_enable = features.call_completion_enable = #Enable or disable the phone to dial the IP address directly; 0-Disabled, 1-Enabled (default); -features.direct_ip_call_enable = +features.direct_ip_call_enable = 0 #Configure the power Indicator LED to turn on or turn off; 0-On (default), 1-Off; features.power_led_on = 1 diff --git a/resources/templates/provision/yealink/t23g/{$mac}.cfg b/resources/templates/provision/yealink/t23g/{$mac}.cfg index d5a65ef413..8641aa3259 100644 --- a/resources/templates/provision/yealink/t23g/{$mac}.cfg +++ b/resources/templates/provision/yealink/t23g/{$mac}.cfg @@ -44,7 +44,11 @@ account.1.naptr_build = 0 account.1.fallback.redundancy_type = 0 account.1.fallback.timeout = 120 account.1.sip_server.1.address = -account.1.sip_server.1.port = 5060 +{if $sip_transport_1 == 'dns srv'} +account.1.sip_server.1.port = 0 +{else} +account.1.sip_server.1.port = {$sip_port_1} +{/if} #Configure the register expiry time (in seconds), the default value is 3600. account.1.sip_server.1.expires = {$register_expires_1} account.1.sip_server.1.retry_counts = 3 @@ -122,7 +126,7 @@ account.1.nat.stun_server = account.1.nat.stun_port = 3478 #Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify; -account.1.nat.udp_update_enable = 1 +account.1.nat.udp_update_enable = 3 #Specify the keep-alive interval (in seconds), the default value is 30. account.1.nat.udp_update_time = 30 @@ -920,8 +924,8 @@ account.2.xsi.port = #Configure the time zone and time zone name. The time zone ranges from -11 to +12, the default value is +8. #local_time.time_zone = +8 #local_time.time_zone_name = China(Beijing) -local_time.time_zone = -local_time.time_zone_name = +local_time.time_zone = {$time_zone} +local_time.time_zone_name = {$time_zone_name} ####################################################################################### diff --git a/resources/templates/provision/yealink/t23p/y000000000044.cfg b/resources/templates/provision/yealink/t23p/y000000000044.cfg index 7293266e9c..7e540ed1fe 100644 --- a/resources/templates/provision/yealink/t23p/y000000000044.cfg +++ b/resources/templates/provision/yealink/t23p/y000000000044.cfg @@ -571,7 +571,7 @@ features.group_listen_in_talking_enable = features.call_completion_enable = #Enable or disable the phone to dial the IP address directly; 0-Disabled, 1-Enabled (default); -features.direct_ip_call_enable = +features.direct_ip_call_enable = 0 #Configure the power Indicator LED to turn on or turn off; 0-On (default), 1-Off; features.power_led_on = 1 diff --git a/resources/templates/provision/yealink/t23p/{$mac}.cfg b/resources/templates/provision/yealink/t23p/{$mac}.cfg index d5a65ef413..8641aa3259 100644 --- a/resources/templates/provision/yealink/t23p/{$mac}.cfg +++ b/resources/templates/provision/yealink/t23p/{$mac}.cfg @@ -44,7 +44,11 @@ account.1.naptr_build = 0 account.1.fallback.redundancy_type = 0 account.1.fallback.timeout = 120 account.1.sip_server.1.address = -account.1.sip_server.1.port = 5060 +{if $sip_transport_1 == 'dns srv'} +account.1.sip_server.1.port = 0 +{else} +account.1.sip_server.1.port = {$sip_port_1} +{/if} #Configure the register expiry time (in seconds), the default value is 3600. account.1.sip_server.1.expires = {$register_expires_1} account.1.sip_server.1.retry_counts = 3 @@ -122,7 +126,7 @@ account.1.nat.stun_server = account.1.nat.stun_port = 3478 #Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify; -account.1.nat.udp_update_enable = 1 +account.1.nat.udp_update_enable = 3 #Specify the keep-alive interval (in seconds), the default value is 30. account.1.nat.udp_update_time = 30 @@ -920,8 +924,8 @@ account.2.xsi.port = #Configure the time zone and time zone name. The time zone ranges from -11 to +12, the default value is +8. #local_time.time_zone = +8 #local_time.time_zone_name = China(Beijing) -local_time.time_zone = -local_time.time_zone_name = +local_time.time_zone = {$time_zone} +local_time.time_zone_name = {$time_zone_name} ####################################################################################### diff --git a/resources/templates/provision/yealink/t26p/y000000000004.cfg b/resources/templates/provision/yealink/t26p/y000000000004.cfg index 32f1aff6b4..43ffcb2562 100644 --- a/resources/templates/provision/yealink/t26p/y000000000004.cfg +++ b/resources/templates/provision/yealink/t26p/y000000000004.cfg @@ -1033,7 +1033,7 @@ features.relog_offtime = #Enable or disable the phone to dial the IP address directly; 0-Disabled, 1-Enabled (default); #Require reboot; -features.direct_ip_call_enable = +features.direct_ip_call_enable = 0 #Specify the ring device when the phone is in the Headset mode; 0-use Speaker (default), 1-use Headset; features.ringer_device.is_use_headset = diff --git a/resources/templates/provision/yealink/t26p/{$mac}.cfg b/resources/templates/provision/yealink/t26p/{$mac}.cfg index ecc4c4997b..2761774eaa 100644 --- a/resources/templates/provision/yealink/t26p/{$mac}.cfg +++ b/resources/templates/provision/yealink/t26p/{$mac}.cfg @@ -223,8 +223,8 @@ account.1.nat.stun_server = #Configure the STUN server port, the default value is 3478. account.1.nat.stun_port = -#Enable or disable the NAT keep-alive; 0-Disabled, 1-Enabled (default); -account.1.nat.udp_update_enable = +#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify; +account.1.nat.udp_update_enable = 3 #Specify the keep-alive interval (in seconds), the default value is 30. account.1.nat.udp_update_time = diff --git a/resources/templates/provision/yealink/t27p/{$mac}.cfg b/resources/templates/provision/yealink/t27p/{$mac}.cfg index d5a65ef413..8641aa3259 100644 --- a/resources/templates/provision/yealink/t27p/{$mac}.cfg +++ b/resources/templates/provision/yealink/t27p/{$mac}.cfg @@ -44,7 +44,11 @@ account.1.naptr_build = 0 account.1.fallback.redundancy_type = 0 account.1.fallback.timeout = 120 account.1.sip_server.1.address = -account.1.sip_server.1.port = 5060 +{if $sip_transport_1 == 'dns srv'} +account.1.sip_server.1.port = 0 +{else} +account.1.sip_server.1.port = {$sip_port_1} +{/if} #Configure the register expiry time (in seconds), the default value is 3600. account.1.sip_server.1.expires = {$register_expires_1} account.1.sip_server.1.retry_counts = 3 @@ -122,7 +126,7 @@ account.1.nat.stun_server = account.1.nat.stun_port = 3478 #Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify; -account.1.nat.udp_update_enable = 1 +account.1.nat.udp_update_enable = 3 #Specify the keep-alive interval (in seconds), the default value is 30. account.1.nat.udp_update_time = 30 @@ -920,8 +924,8 @@ account.2.xsi.port = #Configure the time zone and time zone name. The time zone ranges from -11 to +12, the default value is +8. #local_time.time_zone = +8 #local_time.time_zone_name = China(Beijing) -local_time.time_zone = -local_time.time_zone_name = +local_time.time_zone = {$time_zone} +local_time.time_zone_name = {$time_zone_name} ####################################################################################### diff --git a/resources/templates/provision/yealink/t28p/y000000000000.cfg b/resources/templates/provision/yealink/t28p/y000000000000.cfg index f3a252bebc..509319b136 100644 --- a/resources/templates/provision/yealink/t28p/y000000000000.cfg +++ b/resources/templates/provision/yealink/t28p/y000000000000.cfg @@ -1033,7 +1033,7 @@ features.relog_offtime = #Enable or disable the phone to dial the IP address directly; 0-Disabled, 1-Enabled (default); #Require reboot; -features.direct_ip_call_enable = +features.direct_ip_call_enable = 0 #Specify the ring device when the phone is in the Headset mode; 0-use Speaker (default), 1-use Headset; features.ringer_device.is_use_headset = diff --git a/resources/templates/provision/yealink/t28p/{$mac}.cfg b/resources/templates/provision/yealink/t28p/{$mac}.cfg index ecc4c4997b..2761774eaa 100644 --- a/resources/templates/provision/yealink/t28p/{$mac}.cfg +++ b/resources/templates/provision/yealink/t28p/{$mac}.cfg @@ -223,8 +223,8 @@ account.1.nat.stun_server = #Configure the STUN server port, the default value is 3478. account.1.nat.stun_port = -#Enable or disable the NAT keep-alive; 0-Disabled, 1-Enabled (default); -account.1.nat.udp_update_enable = +#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify; +account.1.nat.udp_update_enable = 3 #Specify the keep-alive interval (in seconds), the default value is 30. account.1.nat.udp_update_time = diff --git a/resources/templates/provision/yealink/t29g/y000000000046.cfg b/resources/templates/provision/yealink/t29g/y000000000046.cfg index 7293266e9c..7e540ed1fe 100644 --- a/resources/templates/provision/yealink/t29g/y000000000046.cfg +++ b/resources/templates/provision/yealink/t29g/y000000000046.cfg @@ -571,7 +571,7 @@ features.group_listen_in_talking_enable = features.call_completion_enable = #Enable or disable the phone to dial the IP address directly; 0-Disabled, 1-Enabled (default); -features.direct_ip_call_enable = +features.direct_ip_call_enable = 0 #Configure the power Indicator LED to turn on or turn off; 0-On (default), 1-Off; features.power_led_on = 1 diff --git a/resources/templates/provision/yealink/t29g/{$mac}.cfg b/resources/templates/provision/yealink/t29g/{$mac}.cfg index d5a65ef413..8641aa3259 100644 --- a/resources/templates/provision/yealink/t29g/{$mac}.cfg +++ b/resources/templates/provision/yealink/t29g/{$mac}.cfg @@ -44,7 +44,11 @@ account.1.naptr_build = 0 account.1.fallback.redundancy_type = 0 account.1.fallback.timeout = 120 account.1.sip_server.1.address = -account.1.sip_server.1.port = 5060 +{if $sip_transport_1 == 'dns srv'} +account.1.sip_server.1.port = 0 +{else} +account.1.sip_server.1.port = {$sip_port_1} +{/if} #Configure the register expiry time (in seconds), the default value is 3600. account.1.sip_server.1.expires = {$register_expires_1} account.1.sip_server.1.retry_counts = 3 @@ -122,7 +126,7 @@ account.1.nat.stun_server = account.1.nat.stun_port = 3478 #Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify; -account.1.nat.udp_update_enable = 1 +account.1.nat.udp_update_enable = 3 #Specify the keep-alive interval (in seconds), the default value is 30. account.1.nat.udp_update_time = 30 @@ -920,8 +924,8 @@ account.2.xsi.port = #Configure the time zone and time zone name. The time zone ranges from -11 to +12, the default value is +8. #local_time.time_zone = +8 #local_time.time_zone_name = China(Beijing) -local_time.time_zone = -local_time.time_zone_name = +local_time.time_zone = {$time_zone} +local_time.time_zone_name = {$time_zone_name} ####################################################################################### diff --git a/resources/templates/provision/yealink/t32g/y000000000032.cfg b/resources/templates/provision/yealink/t32g/y000000000032.cfg index 5b7cdf478a..311f3a0890 100644 --- a/resources/templates/provision/yealink/t32g/y000000000032.cfg +++ b/resources/templates/provision/yealink/t32g/y000000000032.cfg @@ -1033,7 +1033,7 @@ features.relog_offtime = #Enable or disable the phone to dial the IP address directly; 0-Disabled, 1-Enabled (default); #Require reboot; -features.direct_ip_call_enable = +features.direct_ip_call_enable = 0 #Specify the ring device when the phone is in the Headset mode; 0-use Speaker (default), 1-use Headset; features.ringer_device.is_use_headset = diff --git a/resources/templates/provision/yealink/t32g/{$mac}.cfg b/resources/templates/provision/yealink/t32g/{$mac}.cfg index b7de551e22..a7f7534e5e 100644 --- a/resources/templates/provision/yealink/t32g/{$mac}.cfg +++ b/resources/templates/provision/yealink/t32g/{$mac}.cfg @@ -223,8 +223,8 @@ account.1.nat.stun_server = #Configure the STUN server port, the default value is 3478. account.1.nat.stun_port = -#Enable or disable the NAT keep-alive; 0-Disabled, 1-Enabled (default); -account.1.nat.udp_update_enable = +#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify; +account.1.nat.udp_update_enable = 3 #Specify the keep-alive interval (in seconds), the default value is 30. account.1.nat.udp_update_time = diff --git a/resources/templates/provision/yealink/t38g/y000000000038.cfg b/resources/templates/provision/yealink/t38g/y000000000038.cfg index 0b1c2b01ec..6e87fb7548 100644 --- a/resources/templates/provision/yealink/t38g/y000000000038.cfg +++ b/resources/templates/provision/yealink/t38g/y000000000038.cfg @@ -1033,7 +1033,7 @@ features.relog_offtime = #Enable or disable the phone to dial the IP address directly; 0-Disabled, 1-Enabled (default); #Require reboot; -features.direct_ip_call_enable = +features.direct_ip_call_enable = 0 #Specify the ring device when the phone is in the Headset mode; 0-use Speaker (default), 1-use Headset; features.ringer_device.is_use_headset = diff --git a/resources/templates/provision/yealink/t38g/{$mac}.cfg b/resources/templates/provision/yealink/t38g/{$mac}.cfg index e2f464c29b..cffa4df9dc 100644 --- a/resources/templates/provision/yealink/t38g/{$mac}.cfg +++ b/resources/templates/provision/yealink/t38g/{$mac}.cfg @@ -223,8 +223,8 @@ account.1.nat.stun_server = #Configure the STUN server port, the default value is 3478. account.1.nat.stun_port = -#Enable or disable the NAT keep-alive; 0-Disabled, 1-Enabled (default); -account.1.nat.udp_update_enable = +#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify; +account.1.nat.udp_update_enable = 3 #Specify the keep-alive interval (in seconds), the default value is 30. account.1.nat.udp_update_time = diff --git a/resources/templates/provision/yealink/t41p/y000000000036.cfg b/resources/templates/provision/yealink/t41p/y000000000036.cfg index 7293266e9c..7e540ed1fe 100644 --- a/resources/templates/provision/yealink/t41p/y000000000036.cfg +++ b/resources/templates/provision/yealink/t41p/y000000000036.cfg @@ -571,7 +571,7 @@ features.group_listen_in_talking_enable = features.call_completion_enable = #Enable or disable the phone to dial the IP address directly; 0-Disabled, 1-Enabled (default); -features.direct_ip_call_enable = +features.direct_ip_call_enable = 0 #Configure the power Indicator LED to turn on or turn off; 0-On (default), 1-Off; features.power_led_on = 1 diff --git a/resources/templates/provision/yealink/t41p/{$mac}.cfg b/resources/templates/provision/yealink/t41p/{$mac}.cfg index d5a65ef413..8641aa3259 100644 --- a/resources/templates/provision/yealink/t41p/{$mac}.cfg +++ b/resources/templates/provision/yealink/t41p/{$mac}.cfg @@ -44,7 +44,11 @@ account.1.naptr_build = 0 account.1.fallback.redundancy_type = 0 account.1.fallback.timeout = 120 account.1.sip_server.1.address = -account.1.sip_server.1.port = 5060 +{if $sip_transport_1 == 'dns srv'} +account.1.sip_server.1.port = 0 +{else} +account.1.sip_server.1.port = {$sip_port_1} +{/if} #Configure the register expiry time (in seconds), the default value is 3600. account.1.sip_server.1.expires = {$register_expires_1} account.1.sip_server.1.retry_counts = 3 @@ -122,7 +126,7 @@ account.1.nat.stun_server = account.1.nat.stun_port = 3478 #Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify; -account.1.nat.udp_update_enable = 1 +account.1.nat.udp_update_enable = 3 #Specify the keep-alive interval (in seconds), the default value is 30. account.1.nat.udp_update_time = 30 @@ -920,8 +924,8 @@ account.2.xsi.port = #Configure the time zone and time zone name. The time zone ranges from -11 to +12, the default value is +8. #local_time.time_zone = +8 #local_time.time_zone_name = China(Beijing) -local_time.time_zone = -local_time.time_zone_name = +local_time.time_zone = {$time_zone} +local_time.time_zone_name = {$time_zone_name} ####################################################################################### diff --git a/resources/templates/provision/yealink/t42g/y000000000029.cfg b/resources/templates/provision/yealink/t42g/y000000000029.cfg index 4af24681ad..8eb5fb45bf 100644 --- a/resources/templates/provision/yealink/t42g/y000000000029.cfg +++ b/resources/templates/provision/yealink/t42g/y000000000029.cfg @@ -571,7 +571,7 @@ features.group_listen_in_talking_enable = features.call_completion_enable = #Enable or disable the phone to dial the IP address directly; 0-Disabled, 1-Enabled (default); -features.direct_ip_call_enable = +features.direct_ip_call_enable = 0 #Configure the power Indicator LED to turn on or turn off; 0-On (default), 1-Off; features.power_led_on = 1 diff --git a/resources/templates/provision/yealink/t42g/{$mac}.cfg b/resources/templates/provision/yealink/t42g/{$mac}.cfg index f61d7bfe92..70c98e9022 100644 --- a/resources/templates/provision/yealink/t42g/{$mac}.cfg +++ b/resources/templates/provision/yealink/t42g/{$mac}.cfg @@ -44,7 +44,11 @@ account.1.naptr_build = 0 account.1.fallback.redundancy_type = 0 account.1.fallback.timeout = 120 account.1.sip_server.1.address = -account.1.sip_server.1.port = 5060 +{if $sip_transport_1 == 'dns srv'} +account.1.sip_server.1.port = 0 +{else} +account.1.sip_server.1.port = {$sip_port_1} +{/if} #Configure the register expiry time (in seconds), the default value is 3600. account.1.sip_server.1.expires = {$register_expires_1} account.1.sip_server.1.retry_counts = 3 @@ -122,7 +126,7 @@ account.1.nat.stun_server = account.1.nat.stun_port = 3478 #Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify; -account.1.nat.udp_update_enable = 1 +account.1.nat.udp_update_enable = 3 #Specify the keep-alive interval (in seconds), the default value is 30. account.1.nat.udp_update_time = 30 @@ -920,8 +924,8 @@ account.2.xsi.port = #Configure the time zone and time zone name. The time zone ranges from -11 to +12, the default value is +8. #local_time.time_zone = +8 #local_time.time_zone_name = China(Beijing) -local_time.time_zone = -local_time.time_zone_name = +local_time.time_zone = {$time_zone} +local_time.time_zone_name = {$time_zone_name} ####################################################################################### diff --git a/resources/templates/provision/yealink/t46g/y000000000028.cfg b/resources/templates/provision/yealink/t46g/y000000000028.cfg index 7293266e9c..7e540ed1fe 100644 --- a/resources/templates/provision/yealink/t46g/y000000000028.cfg +++ b/resources/templates/provision/yealink/t46g/y000000000028.cfg @@ -571,7 +571,7 @@ features.group_listen_in_talking_enable = features.call_completion_enable = #Enable or disable the phone to dial the IP address directly; 0-Disabled, 1-Enabled (default); -features.direct_ip_call_enable = +features.direct_ip_call_enable = 0 #Configure the power Indicator LED to turn on or turn off; 0-On (default), 1-Off; features.power_led_on = 1 diff --git a/resources/templates/provision/yealink/t46g/{$mac}.cfg b/resources/templates/provision/yealink/t46g/{$mac}.cfg index d5a65ef413..d822ba5bad 100644 --- a/resources/templates/provision/yealink/t46g/{$mac}.cfg +++ b/resources/templates/provision/yealink/t46g/{$mac}.cfg @@ -44,7 +44,11 @@ account.1.naptr_build = 0 account.1.fallback.redundancy_type = 0 account.1.fallback.timeout = 120 account.1.sip_server.1.address = -account.1.sip_server.1.port = 5060 +{if $sip_transport_1 == 'dns srv'} +account.1.sip_server.1.port = 0 +{else} +account.1.sip_server.1.port = {$sip_port_1} +{/if} #Configure the register expiry time (in seconds), the default value is 3600. account.1.sip_server.1.expires = {$register_expires_1} account.1.sip_server.1.retry_counts = 3 @@ -122,7 +126,7 @@ account.1.nat.stun_server = account.1.nat.stun_port = 3478 #Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify; -account.1.nat.udp_update_enable = 1 +account.1.nat.udp_update_enable = 3 #Specify the keep-alive interval (in seconds), the default value is 30. account.1.nat.udp_update_time = 30 @@ -920,8 +924,8 @@ account.2.xsi.port = #Configure the time zone and time zone name. The time zone ranges from -11 to +12, the default value is +8. #local_time.time_zone = +8 #local_time.time_zone_name = China(Beijing) -local_time.time_zone = -local_time.time_zone_name = +local_time.time_zone = {$time_zone} +local_time.time_zone_name = {$time_zone_name} ####################################################################################### @@ -2395,8 +2399,8 @@ account.5.xsi.port = #Configure the time zone and time zone name. The time zone ranges from -11 to +12, the default value is +8. #local_time.time_zone = +8 #local_time.time_zone_name = China(Beijing) -local_time.time_zone = -local_time.time_zone_name = +local_time.time_zone = {$time_zone} +local_time.time_zone_name = {$time_zone_name} ####################################################################################### @@ -3013,16 +3017,26 @@ programablekey.1.label = #expansion_module.x.key.y.label = #expansion_module.X.key.Y.xml_phonebook = +{$rownum = 1} + {foreach $keys as $row} {if $row.device_key_category == "expansion"} -#Expansion module 1 key {$row.device_key_id} +{if $rownum <= 40} expansion_module.1.key.{$row.device_key_id}.type = {$row.device_key_type} expansion_module.1.key.{$row.device_key_id}.line = {$row.device_key_line} expansion_module.1.key.{$row.device_key_id}.value = {$row.device_key_value} expansion_module.1.key.{$row.device_key_id}.extension = {$row.device_key_extension} expansion_module.1.key.{$row.device_key_id}.label = {$row.device_key_label} -expansion_module.1.key.{$row.device_key_id}.xml_phonebook = - +expansion_module.1.key.{$row.device_key_id}.xml_phonebook = +{else} +expansion_module.2.key.{$row.device_key_id - 40}.type = {$row.device_key_type} +expansion_module.2.key.{$row.device_key_id - 40}.line = {$row.device_key_line} +expansion_module.2.key.{$row.device_key_id - 40}.value = {$row.device_key_value} +expansion_module.2.key.{$row.device_key_id - 40}.extension = {$row.device_key_extension} +expansion_module.2.key.{$row.device_key_id - 40}.label = {$row.device_key_label} +expansion_module.2.key.{$row.device_key_id - 40}.xml_phonebook = +{/if} +{$rownum = $rownum + 1} {/if} {/foreach} @@ -3038,4 +3052,4 @@ expansion_module.1.key.{$row.device_key_id}.xml_phonebook = #expansion_module.2.key.1.label = #expansion_module.2.key.1.xml_phonebook = #expansion_module.2.key.1.type = -#expansion_module.2.key.1.label = \ No newline at end of file +#expansion_module.2.key.1.label = diff --git a/resources/templates/provision/yealink/t48g/y000000000035.cfg b/resources/templates/provision/yealink/t48g/y000000000035.cfg index 86c8dd6563..5854bfce1d 100644 --- a/resources/templates/provision/yealink/t48g/y000000000035.cfg +++ b/resources/templates/provision/yealink/t48g/y000000000035.cfg @@ -571,7 +571,7 @@ features.group_listen_in_talking_enable = features.call_completion_enable = #Enable or disable the phone to dial the IP address directly; 0-Disabled, 1-Enabled (default); -features.direct_ip_call_enable = +features.direct_ip_call_enable = 0 #Configure the power Indicator LED to turn on or turn off; 0-On (default), 1-Off; features.power_led_on = 1 diff --git a/resources/templates/provision/yealink/t48g/{$mac}.cfg b/resources/templates/provision/yealink/t48g/{$mac}.cfg index 79a0eeeb3d..c9387f2da9 100644 --- a/resources/templates/provision/yealink/t48g/{$mac}.cfg +++ b/resources/templates/provision/yealink/t48g/{$mac}.cfg @@ -5,7 +5,7 @@ ####################################################################################### ## Account 1 Basic Settings ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.enable = {if isset($user_password_1) } account.1.enable = 1 @@ -33,7 +33,7 @@ account.1.sip_listen_port = 5060 ####################################################################################### ## Failback ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.reregister_enable = 0 account.1.reregister_enable = 0 @@ -44,7 +44,11 @@ account.1.naptr_build = 0 account.1.fallback.redundancy_type = 0 account.1.fallback.timeout = 120 account.1.sip_server.1.address = -account.1.sip_server.1.port = 5060 +{if $sip_transport_1 == 'dns srv'} +account.1.sip_server.1.port = 0 +{else} +account.1.sip_server.1.port = {$sip_port_1} +{/if} #Configure the register expiry time (in seconds), the default value is 3600. account.1.sip_server.1.expires = {$register_expires_1} account.1.sip_server.1.retry_counts = 3 @@ -83,7 +87,7 @@ account.1.static_cache_pri = 0 ####################################################################################### ## Register Advanced ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.sip_server_type = #Configure the SIP server type; 0-Default (default), 2-BroadSoft, 4-Cosmocom; @@ -112,7 +116,7 @@ account.1.reg_fail_retry_interval = ######################################################################### ## NAT Settings ## ######################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.nat.nat_traversal = 0 #Enable or disable the NAT traversal; 0-Disabled (default), 1-STUN; @@ -121,8 +125,8 @@ account.1.nat.nat_traversal = 0 account.1.nat.stun_server = account.1.nat.stun_port = 3478 -#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default)2-Option3-Notify; -account.1.nat.udp_update_enable = 1 +#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify; +account.1.nat.udp_update_enable = 3 #Specify the keep-alive interval (in seconds), the default value is 30. account.1.nat.udp_update_time = 30 @@ -134,7 +138,7 @@ account.1.nat.rport = {$yealink_rport_1} ####################################################################################### ## AccountX Advance Settings ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.advanced.timer_t1 = 0.5 ##voice_mail.number.X = @@ -149,7 +153,7 @@ voice_mail.number.1 = {$voicemail_number} ####################################################################################### ## Subscribe ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.subscribe_mwi = account.1.subscribe_mwi = 1 @@ -164,7 +168,7 @@ account.1.subscribe_acd_expires= 3600 ####################################################################################### ## BLF List ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.blf.blf_list_uri = #Configure the BLF list URI (a SIP URI, or use part of the SIP URI). For example, "2300_blflist@domain.com" or "2300_blflist". @@ -181,7 +185,7 @@ account.1.out_dialog_blf_enable = 0 ####################################################################################### ## BLA/SCA ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.shared_line = #Assign account1 as shared line; 0-Disabled (default), 1-Broadsoft SCA, 2-BLA; @@ -461,7 +465,7 @@ account.1.xsi.port = ####################################################################################### ## Account 2 Basic Settings ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.enable = {if isset($user_password_2) } account.2.enable = 1 @@ -489,7 +493,7 @@ account.2.sip_listen_port = 5060 ####################################################################################### ## Failback ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.reregister_enable = 0 account.2.reregister_enable = 0 @@ -539,7 +543,7 @@ account.2.static_cache_pri = 0 ####################################################################################### ## Register Advanced ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.sip_server_type = #Configure the SIP server type; 0-Default (default), 2-BroadSoft, 4-Cosmocom; @@ -568,7 +572,7 @@ account.2.reg_fail_retry_interval = ######################################################################### ## NAT Settings ## ######################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.nat.nat_traversal = 0 #Enable or disable the NAT traversal; 0-Disabled (default), 1-STUN; @@ -590,7 +594,7 @@ account.2.nat.rport = {$yealink_rport_2} ####################################################################################### ## Account2 Advance Settings ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.advanced.timer_t1 = 0.5 ##voice_mail.number.X = @@ -605,7 +609,7 @@ voice_mail.number.2 = *97 ####################################################################################### ## Subscribe ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.subscribe_mwi = account.2.subscribe_mwi = 1 @@ -620,7 +624,7 @@ account.2.subscribe_acd_expires= 3600 ####################################################################################### ## BLF List ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.blf.blf_list_uri = #Configure the BLF list URI (a SIP URI, or use part of the SIP URI). For example, "2300_blflist@domain.com" or "2300_blflist". @@ -637,7 +641,7 @@ account.2.out_dialog_blf_enable = 0 ####################################################################################### ## BLA/SCA ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.shared_line = #Assign account1 as shared line; 0-Disabled (default), 1-Broadsoft SCA, 2-BLA; @@ -920,8 +924,8 @@ account.2.xsi.port = #Configure the time zone and time zone name. The time zone ranges from -11 to +12, the default value is +8. #local_time.time_zone = +8 #local_time.time_zone_name = China(Beijing) -local_time.time_zone = -local_time.time_zone_name = +local_time.time_zone = ${time_zone} +local_time.time_zone_name = ${time_zone_name} ####################################################################################### @@ -954,7 +958,7 @@ network.static_dns_enable = 0 ####################################################################################### ## Account 3 Basic Settings ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.enable = {if isset($user_password_3) } account.3.enable = 1 @@ -981,7 +985,7 @@ account.3.sip_listen_port = 5060 ####################################################################################### ## Failback ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.reregister_enable = 0 account.3.reregister_enable = 0 @@ -1031,7 +1035,7 @@ account.3.static_cache_pri = 0 ####################################################################################### ## Register Advanced ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.sip_server_type = #Configure the SIP server type; 0-Default (default), 2-BroadSoft, 4-Cosmocom; @@ -1060,7 +1064,7 @@ account.3.reg_fail_retry_interval = ######################################################################### ## NAT Settings ## ######################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.nat.nat_traversal = 0 #Enable or disable the NAT traversal; 0-Disabled (default), 1-STUN; @@ -1082,7 +1086,7 @@ account.3.nat.rport = {$yealink_rport_3} ####################################################################################### ## Account3 Advance Settings ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.advanced.timer_t1 = 0.5 ##voice_mail.number.X = @@ -1097,7 +1101,7 @@ voice_mail.number.3 = *97 ####################################################################################### ## Subscribe ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.subscribe_mwi = account.3.subscribe_mwi = 1 @@ -1112,7 +1116,7 @@ account.3.subscribe_acd_expires= 3600 ####################################################################################### ## BLF List ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.blf.blf_list_uri = #Configure the BLF list URI (a SIP URI, or use part of the SIP URI). For example, "2300_blflist@domain.com" or "2300_blflist". @@ -1129,7 +1133,7 @@ account.3.out_dialog_blf_enable = 0 ####################################################################################### ## BLA/SCA ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.shared_line = #Assign account1 as shared line; 0-Disabled (default), 1-Broadsoft SCA, 2-BLA; @@ -1446,7 +1450,7 @@ network.secondary_dns = ####################################################################################### ## Account 4 Basic Settings ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.enable = {if isset($user_password_4) } account.4.enable = 1 @@ -1473,7 +1477,7 @@ account.4.sip_listen_port = 5060 ####################################################################################### ## Failback ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.reregister_enable = 0 account.4.reregister_enable = 0 @@ -1523,7 +1527,7 @@ account.4.static_cache_pri = 0 ####################################################################################### ## Register Advanced ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.sip_server_type = #Configure the SIP server type; 0-Default (default), 2-BroadSoft, 4-Cosmocom; @@ -1552,7 +1556,7 @@ account.4.reg_fail_retry_interval = ######################################################################### ## NAT Settings ## ######################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.nat.nat_traversal = 0 #Enable or disable the NAT traversal; 0-Disabled (default), 1-STUN; @@ -1574,7 +1578,7 @@ account.4.nat.rport = {$yealink_rport_4} ####################################################################################### ## Account4 Advance Settings ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.advanced.timer_t1 = 0.5 ##voice_mail.number.X = @@ -1589,7 +1593,7 @@ voice_mail.number.4 = *97 ####################################################################################### ## Subscribe ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.subscribe_mwi = account.4.subscribe_mwi = 1 @@ -1604,7 +1608,7 @@ account.4.subscribe_acd_expires= 3600 ####################################################################################### ## BLF List ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.blf.blf_list_uri = #Configure the BLF list URI (a SIP URI, or use part of the SIP URI). For example, "2300_blflist@domain.com" or "2300_blflist". @@ -1621,7 +1625,7 @@ account.4.out_dialog_blf_enable = 0 ####################################################################################### ## BLA/SCA ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.shared_line = #Assign account1 as shared line; 0-Disabled (default), 1-Broadsoft SCA, 2-BLA; @@ -1937,7 +1941,7 @@ network.secondary_dns = ####################################################################################### ## Account 5 Basic Settings ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.enable = {if isset($user_password_5) } account.5.enable = 1 @@ -1964,7 +1968,7 @@ account.5.sip_listen_port = 5060 ####################################################################################### ## Failback ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.reregister_enable = 0 account.5.reregister_enable = 0 @@ -2014,7 +2018,7 @@ account.5.static_cache_pri = 0 ####################################################################################### ## Register Advanced ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.sip_server_type = #Configure the SIP server type; 0-Default (default), 2-BroadSoft, 4-Cosmocom; @@ -2043,7 +2047,7 @@ account.5.reg_fail_retry_interval = ######################################################################### ## NAT Settings ## ######################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.nat.nat_traversal = 0 #Enable or disable the NAT traversal; 0-Disabled (default), 1-STUN; @@ -2065,7 +2069,7 @@ account.5.nat.rport = {$yealink_rport_5} ####################################################################################### ## Account5 Advance Settings ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.advanced.timer_t1 = 0.5 ##voice_mail.number.X = @@ -2080,7 +2084,7 @@ voice_mail.number.5 = *97 ####################################################################################### ## Subscribe ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.subscribe_mwi = account.5.subscribe_mwi = 1 @@ -2095,7 +2099,7 @@ account.5.subscribe_acd_expires= 3600 ####################################################################################### ## BLF List ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.blf.blf_list_uri = #Configure the BLF list URI (a SIP URI, or use part of the SIP URI). For example, "2300_blflist@domain.com" or "2300_blflist". @@ -2112,7 +2116,7 @@ account.5.out_dialog_blf_enable = 0 ####################################################################################### ## BLA/SCA ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.shared_line = #Assign account1 as shared line; 0-Disabled (default), 1-Broadsoft SCA, 2-BLA; @@ -2428,7 +2432,7 @@ network.secondary_dns = ####################################################################################### ## Account 6 Basic Settings ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.enable = {if isset($user_password_6) } account.6.enable = 1 @@ -2455,7 +2459,7 @@ account.6.sip_listen_port = 5060 ####################################################################################### ## Failback ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.reregister_enable = 0 account.6.reregister_enable = 0 @@ -2505,7 +2509,7 @@ account.6.static_cache_pri = 0 ####################################################################################### ## Register Advanced ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.sip_server_type = #Configure the SIP server type; 0-Default (default), 2-BroadSoft, 4-Cosmocom; @@ -2534,7 +2538,7 @@ account.6.reg_fail_retry_interval = ######################################################################### ## NAT Settings ## ######################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.nat.nat_traversal = 0 #Enable or disable the NAT traversal; 0-Disabled (default), 1-STUN; @@ -2556,7 +2560,7 @@ account.6.nat.rport = {$yealink_rport_6} ####################################################################################### ## Account6 Advance Settings ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.advanced.timer_t1 = 0.5 ##voice_mail.number.X = @@ -2571,7 +2575,7 @@ voice_mail.number.6 = *97 ####################################################################################### ## Subscribe ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.subscribe_mwi = account.6.subscribe_mwi = 0 @@ -2586,7 +2590,7 @@ account.6.subscribe_acd_expires= 3600 ####################################################################################### ## BLF List ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.blf.blf_list_uri = #Configure the BLF list URI (a SIP URI, or use part of the SIP URI). For example, "2300_blflist@domain.com" or "2300_blflist". @@ -2603,7 +2607,7 @@ account.6.out_dialog_blf_enable = 0 ####################################################################################### ## BLA/SCA ## ####################################################################################### -## X ranges from 1 to 6; +## ranges from 1 to 6; ##account.X.shared_line = #Assign account1 as shared line; 0-Disabled (default), 1-Broadsoft SCA, 2-BLA; diff --git a/resources/templates/provision/yealink/vp530/y000000000023.cfg b/resources/templates/provision/yealink/vp530/y000000000023.cfg index c5031d8ee3..3c1222819f 100644 --- a/resources/templates/provision/yealink/vp530/y000000000023.cfg +++ b/resources/templates/provision/yealink/vp530/y000000000023.cfg @@ -911,7 +911,7 @@ features.relog_offtime = 5 #Enable or disable the phone to dial the IP address directly; 0-Disabled, 1-Enabled (default); #Require reboot; -features.direct_ip_call_enable = 1 +features.direct_ip_call_enable = 0 #Specify the ring device when the phone is in the Headset mode; 0-use Speaker (default), 1-use Headset; features.ringer_device.is_use_headset = 0 diff --git a/resources/templates/provision/yealink/vp530/{$mac}.cfg b/resources/templates/provision/yealink/vp530/{$mac}.cfg index aac6950840..b35405d03e 100644 --- a/resources/templates/provision/yealink/vp530/{$mac}.cfg +++ b/resources/templates/provision/yealink/vp530/{$mac}.cfg @@ -29,7 +29,11 @@ account.1.sip_trust_ctrl = 1 account.1.sip_server_host = {$server_address_1} #Specify the port for the SIP server. The default value is 5060. +{if $sip_transport_1 == 'dns srv'} +account.1.sip_server_port = 0 +{else} account.1.sip_server_port = {$sip_port_1} +{/if} #Enable or disable the use of the outbound proxy server; 0-Disabled (default), 1-Enabled; account.1.outbound_proxy_enable = @@ -249,8 +253,8 @@ account.1.nat.stun_server = #Configure the STUN server port, the default value is 3478. account.1.nat.stun_port = -#Enable or disable the NAT keep-alive; 0-Disabled, 1-Enabled (default); -account.1.nat.udp_update_enable = +#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify; +account.1.nat.udp_update_enable = 3 #Specify the keep-alive interval (in seconds), the default value is 30. account.1.nat.udp_update_time = diff --git a/resources/templates/provision/yealink/w52p/y000000000025.cfg b/resources/templates/provision/yealink/w52p/y000000000025.cfg index 49e8b04219..2b24684a20 100644 --- a/resources/templates/provision/yealink/w52p/y000000000025.cfg +++ b/resources/templates/provision/yealink/w52p/y000000000025.cfg @@ -299,6 +299,9 @@ call_waiting.enable = 1 #Enable or disable the playing of call waiting tone; 0-Disabled, 1-Enabled (default); call_waiting.tone = +#Enable or disable the phone to dial the IP address directly; 0-Disabled, 1-Enabled (default); +features.direct_ip_call_enable = 0 + #Enable or disable the phone to save the call history; 0-Disabled, 1-Enabled (default); features.save_call_history = diff --git a/resources/templates/provision/yealink/w52p/{$mac}.cfg b/resources/templates/provision/yealink/w52p/{$mac}.cfg index a6bc0d586a..2509a41fbf 100644 --- a/resources/templates/provision/yealink/w52p/{$mac}.cfg +++ b/resources/templates/provision/yealink/w52p/{$mac}.cfg @@ -147,8 +147,8 @@ account.1.nat.stun_server = #Configure the STUN server port, the default value is 3478. account.1.nat.stun_port = -#Enable or disable the NAT keep-alive; 0-Disabled, 1-Enabled (default); -account.1.nat.udp_update_enable = +#Enable or disable the NAT keep-alive; 0-Disabled, 1-Default (default), 2-Option, 3-Notify; +account.1.nat.udp_update_enable = 3 #Specify the keep-alive interval (in seconds), the default value is 30. account.1.nat.udp_update_time = diff --git a/secure/fax_to_email.php b/secure/fax_to_email.php index a9d4269836..6972b225b9 100644 --- a/secure/fax_to_email.php +++ b/secure/fax_to_email.php @@ -40,6 +40,7 @@ if (defined('STDIN')) { //includes if (!defined('STDIN')) { include "root.php"; } require_once "resources/require.php"; + include "resources/classes/EventSocket.php"; include "resources/phpmailer/class.phpmailer.php"; include "resources/phpmailer/class.smtp.php"; // optional, gets called from within class.phpmailer.php if not already loaded @@ -131,7 +132,14 @@ if (defined('STDIN')) { $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC); foreach ($result as &$row) { - $_SESSION["domain_uuid"] = $row["domain_uuid"]; + //set the domain variables + $domain_uuid = $row["domain_uuid"]; + $_SESSION["domain_uuid"] = $row["domain_uuid"]; + $_SESSION["domain_name"] = $domain_name; + //set the setting arrays + $domain = new domains(); + $domain->db = $db; + $domain->set(); } unset ($prep_statement); diff --git a/secure/v_mailto.php b/secure/v_mailto.php index dbc74d26f7..e81de0c6b1 100644 --- a/secure/v_mailto.php +++ b/secure/v_mailto.php @@ -18,7 +18,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2012 + Portions created by the Initial Developer are Copyright (C) 2008-2015 the Initial Developer. All Rights Reserved. Contributor(s): @@ -275,7 +275,7 @@ //add the body to the email $body_plain = rip_tags($body); - echo "body_plain = $body_plain\n"; + //echo "body_plain = $body_plain\n"; if ((substr($body, 0, 5) == "ContentType = "text/html"; $mail->Body = $body; @@ -361,4 +361,4 @@ fwrite($fp, $content); fclose($fp); */ -?> +?> \ No newline at end of file