This commit is contained in:
reliberate
2016-02-29 21:49:36 -07:00
5 changed files with 187 additions and 15 deletions

View File

@@ -0,0 +1,7 @@
<context name="{v_context}">
<extension name="call-limit" number="" continue="true" app_uuid="4670c44c-45dd-4bae-97ba-b0dfe0aca639" enabled="false">
<condition field="${call_direction}" expression="^(inbound|outbound)$">
<action application="limit" data="hash inbound ${domain_uuid} ${max_calls} !USER_BUSY"/>
</condition>
</extension>
</context>

View File

@@ -1,15 +1,15 @@
<?php
$text['title-install_first_time']['en-us'] = "First Time Install";
$text['title-install_first_time']['es-cl'] = "Instale Primera Vez";
$text['title-install_first_time']['pt-pt'] = "Première installation";
$text['title-install_first_time']['fr-fr'] = "Première installation";
$text['title-install_first_time']['pt-br'] = "Première installation";
$text['title-install_first_time']['pl'] = "Zainstalować";
$text['title-install_first_time']['sv-se'] = "Första gången Installera";
$text['title-install_first_time']['uk'] = "Перший раз Встановіть";
$text['title-install_first_time']['de-at'] = "Erstinstallation";
$text['title-install_first_time']['ar-eg'] = "للمرة الأولى قم بتثبيت";
$text['title-install']['en-us'] = "Install";
$text['title-install']['es-cl'] = "Instale";
$text['title-install']['pt-pt'] = "Installation";
$text['title-install']['fr-fr'] = "Installation";
$text['title-install']['pt-br'] = "Installation";
$text['title-install']['pl'] = "Zainstalować";
$text['title-install']['sv-se'] = "Installera";
$text['title-install']['uk'] = "Перший раз Встановіть";
$text['title-install']['de-at'] = "Erstinstallation";
$text['title-install']['ar-eg'] = "للمرة الأولى قم بتثبيت";
$text['title-detected_configuration']['en-us'] = "Detected Configuration";
$text['title-detected_configuration']['es-cl'] = "Configuración detectado";

View File

@@ -135,14 +135,14 @@ require_once "resources/classes/EventSocket.php";
$this->$field = normalize_path($matches[2]);
}
}
$this->_voicemail_vdir = normalize_path($this->_storage_dir . DIRECTORY_SEPARATOR . "voicemail");
$this->_phrases_vdir = normalize_path($this->_conf_dir . DIRECTORY_SEPARATOR . "lang");
$this->_extensions_vdir = normalize_path($this->_conf_dir . DIRECTORY_SEPARATOR . "directory");
$this->_voicemail_vdir = normalize_path($this->_storage_dir . DIRECTORY_SEPARATOR . "voicemail");
$this->_phrases_vdir = normalize_path($this->_conf_dir . DIRECTORY_SEPARATOR . "lang");
$this->_extensions_vdir = normalize_path($this->_conf_dir . DIRECTORY_SEPARATOR . "directory");
$this->_sip_profiles_vdir = normalize_path($this->_conf_dir . DIRECTORY_SEPARATOR . "sip_profiles");
$this->_dialplan_vdir = normalize_path($this->_conf_dir . DIRECTORY_SEPARATOR . "dialplan");
$this->_backup_vdir = normalize_path(sys_get_temp_dir());
}
}
protected function connect_event_socket(){
$esl = new EventSocket;
if ($esl->connect($this->event_host, $this->event_port, $this->event_password)) {

View File

@@ -0,0 +1,165 @@
--
-- FusionPBX
-- Version: MPL 1.1
--
-- The contents of this file are subject to the Mozilla Public License Version
-- 1.1 (the "License"); you may not use this file except in compliance with
-- the License. You may obtain a copy of the License at
-- http://www.mozilla.org/MPL/
--
-- Software distributed under the License is distributed on an "AS IS" basis,
-- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-- for the specific language governing rights and limitations under the
-- License.
--
-- The Original Code is FusionPBX
--
-- The Initial Developer of the Original Code is
-- Mark J Crane <markjcrane@fusionpbx.com>
-- Copyright (C) 2010-2016
-- All Rights Reserved.
--
-- Contributor(s):
-- Koldo A. Marcos <koldo.aingeru@sarenet.es>
--include config.lua
require "resources.functions.config";
--connect to the database
require "resources.functions.database_handle";
dbh = database_handle('system');
--set default variables
sounds_dir = "";
recordings_dir = "";
pin_number = "";
max_tries = "3";
digit_timeout = "3000";
--define uuid function
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
--get session variables
if (session:ready()) then
session:answer();
--session:execute("info", "");
destination_number = session:getVariable("destination_number");
pin_number = session:getVariable("pin_number");
sounds_dir = session:getVariable("sounds_dir");
ring_group_uuid = session:getVariable("ring_group_uuid");
domain_uuid = session:getVariable("domain_uuid");
end
--get the domain uuid and set other required variables
if (session:ready()) then
--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;
--create the primary key uuid
ring_group_destination_uuid = uuid();
end
--if the pin number is provided then require it
if (pin_number) then
min_digits = string.len(pin_number);
max_digits = string.len(pin_number)+1;
digits = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-please_enter_pin_followed_by_pound.wav", "", "\\d+");
if (digits == pin_number) then
--pin is correct
else
session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-pin_or_extension_is-invalid.wav");
session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-im_sorry.wav");
session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/voicemail/vm-goodbye.wav");
session:hangup("NORMAL_CLEARING");
return;
end
end
--press 1 to login and 2 to logout
if (session:ready()) then
menu_selection = session:playAndGetDigits(1, 1, max_tries, digit_timeout, "#", "ivr/ivr-enter_destination_telephone_number.wav", "", "\\d+");
freeswitch.consoleLog("NOTICE", "[ring_group] menu_selection: "..menu_selection.."\n");
if (menu_selection == "1") then
--first, check to see if the destination is already in this 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] 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..[[',
]]..destination_delay..[[,
]]..destination_timeout..[[
)]];
freeswitch.consoleLog("NOTICE", "[ring_group][destination] SQL "..sql.."\n");
dbh:query(sql);
freeswitch.consoleLog("NOTICE", "[ring_group][destination] LOG IN\n");
session:streamFile("ivr/ivr-you_are_now_logged_in.wav");
else
freeswitch.consoleLog("NOTICE", "[ring_group][destination] 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..[['
]];
freeswitch.consoleLog("NOTICE", "[ring_group][destination] SQL "..sql.."\n");
dbh:query(sql);
freeswitch.consoleLog("NOTICE", "[ring_group][destination] LOG OUT\n");
session:streamFile("ivr/ivr-you_are_now_logged_out.wav");
end
end
--wait for the file to be written before proceeding
if (session:ready()) then
--session:sleep(1000);
end
--hangup
if (session:ready()) then
session:hangup();
end