Merge branch 'master' into number_alias_as_vm_id
Conflicts: app/hot_desking/extension_edit.php
This commit is contained in:
@@ -300,6 +300,14 @@
|
||||
delimiter = ":_:";
|
||||
end
|
||||
|
||||
--leg delay settings
|
||||
if (ring_group_strategy == "enterprise") then
|
||||
delay_name = "originate_delay_start";
|
||||
destination_delay = destination_delay * 1000;
|
||||
else
|
||||
delay_name = "leg_delay_start";
|
||||
end
|
||||
|
||||
--create a new uuid and add it to the uuid list
|
||||
new_uuid = api:executeString("create_uuid");
|
||||
if (string.len(uuids) == 0) then
|
||||
@@ -370,24 +378,24 @@
|
||||
reply = trim(api:executeString(cmd));
|
||||
--freeswitch.consoleLog("notice", "[ring group] reply "..cmd.." " .. reply .. "\n");
|
||||
if (reply == "0 total.") then
|
||||
dial_string = "[sip_invite_domain="..domain_name..","..group_confirm.."leg_timeout="..destination_timeout..",leg_delay_start="..destination_delay..",dialed_extension=" .. row.destination_number .. ",extension_uuid="..extension_uuid.."]user/" .. row.destination_number .. "@" .. domain_name;
|
||||
dial_string = "[sip_invite_domain="..domain_name..","..group_confirm.."leg_timeout="..destination_timeout..","..delay_name.."="..destination_delay..",dialed_extension=" .. row.destination_number .. ",extension_uuid="..extension_uuid.."]user/" .. row.destination_number .. "@" .. domain_name;
|
||||
else
|
||||
if (string.find(reply, domain_name)) then
|
||||
--active call
|
||||
else
|
||||
dial_string = "[sip_invite_domain="..domain_name..","..group_confirm.."leg_timeout="..destination_timeout..",leg_delay_start="..destination_delay..",dialed_extension=" .. row.destination_number .. ",extension_uuid="..extension_uuid.."]user/" .. row.destination_number .. "@" .. domain_name;
|
||||
dial_string = "[sip_invite_domain="..domain_name..","..group_confirm.."leg_timeout="..destination_timeout..","..delay_name.."="..destination_delay..",dialed_extension=" .. row.destination_number .. ",extension_uuid="..extension_uuid.."]user/" .. row.destination_number .. "@" .. domain_name;
|
||||
end
|
||||
end
|
||||
else
|
||||
--look inside the reply to check for the correct domain_name
|
||||
dial_string = "[sip_invite_domain="..domain_name..","..group_confirm.."leg_timeout="..destination_timeout..",leg_delay_start="..destination_delay..",dialed_extension=" .. row.destination_number .. ",extension_uuid="..extension_uuid.."]user/" .. row.destination_number .. "@" .. domain_name;
|
||||
dial_string = "[sip_invite_domain="..domain_name..","..group_confirm.."leg_timeout="..destination_timeout..","..delay_name.."="..destination_delay..",dialed_extension=" .. row.destination_number .. ",extension_uuid="..extension_uuid.."]user/" .. row.destination_number .. "@" .. domain_name;
|
||||
end
|
||||
else
|
||||
dial_string = "[sip_invite_domain="..domain_name..","..group_confirm.."leg_timeout="..destination_timeout..",leg_delay_start="..destination_delay..",dialed_extension=" .. row.destination_number .. ",extension_uuid="..extension_uuid.."]user/" .. row.destination_number .. "@" .. domain_name;
|
||||
dial_string = "[sip_invite_domain="..domain_name..","..group_confirm.."leg_timeout="..destination_timeout..","..delay_name.."="..destination_delay..",dialed_extension=" .. row.destination_number .. ",extension_uuid="..extension_uuid.."]user/" .. row.destination_number .. "@" .. domain_name;
|
||||
end
|
||||
elseif (tonumber(destination_number) == nil) then
|
||||
--sip uri
|
||||
dial_string = "[sip_invite_domain="..domain_name..","..group_confirm.."leg_timeout="..destination_timeout..",leg_delay_start="..destination_delay.."]" .. row.destination_number;
|
||||
dial_string = "[sip_invite_domain="..domain_name..","..group_confirm.."leg_timeout="..destination_timeout..","..delay_name.."="..destination_delay.."]" .. row.destination_number;
|
||||
else
|
||||
--external number
|
||||
y = 0;
|
||||
@@ -417,7 +425,7 @@
|
||||
dialplan_detail_data = r.dialplan_detail_data:gsub("$1", destination_result);
|
||||
--if the session is set then process the actions
|
||||
if (y == 0) then
|
||||
square = "[domain_name="..domain_name..",domain_uuid="..domain_uuid..",sip_invite_domain="..domain_name..","..group_confirm.."leg_timeout="..destination_timeout..",leg_delay_start="..destination_delay..",ignore_early_media=true,";
|
||||
square = "[domain_name="..domain_name..",domain_uuid="..domain_uuid..",sip_invite_domain="..domain_name..","..group_confirm.."leg_timeout="..destination_timeout..","..delay_name.."="..destination_delay..",ignore_early_media=true,";
|
||||
end
|
||||
if (r.dialplan_detail_type == "set") then
|
||||
--session:execute("eval", dialplan_detail_data);
|
||||
|
||||
@@ -447,7 +447,11 @@
|
||||
|
||||
--copy the voicemail to each destination
|
||||
if (file_exists(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext)) then
|
||||
os.execute("cp "..voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext.." "..voicemail_dir.."/"..voicemail_id_copy.."/msg_"..voicemail_message_uuid.."."..vm_message_ext);
|
||||
local src = voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext
|
||||
local dst = voicemail_dir.."/"..voicemail_id_copy.."/msg_"..voicemail_message_uuid.."."..vm_message_ext
|
||||
if src ~= dst then
|
||||
copy(src, dst)
|
||||
end
|
||||
end
|
||||
|
||||
--send the message waiting event
|
||||
|
||||
@@ -31,13 +31,11 @@
|
||||
|
||||
--Please enter your id followed by
|
||||
if (name == "voicemail_id") then
|
||||
table.insert(actions, {app="streamFile",data="voicemail/vm-enter_id.wav"});
|
||||
table.insert(actions, {app="streamFile",data="digits/pound.wav"});
|
||||
table.insert(actions, {app="streamFile",data="phrase:voicemail_enter_id:#"});
|
||||
end
|
||||
--Please enter your id followed by
|
||||
if (name == "voicemail_password") then
|
||||
table.insert(actions, {app="streamFile",data="voicemail/vm-enter_pass.wav"});
|
||||
table.insert(actions, {app="streamFile",data="digits/pound.wav"});
|
||||
table.insert(actions, {app="streamFile",data="phrase:voicemail_enter_pass:#"});
|
||||
end
|
||||
--the person at extension 101 is not available record your message at the tone press any key or stop talking to end the recording
|
||||
if (name == "person_not_available_record_message") then
|
||||
@@ -74,25 +72,11 @@
|
||||
end
|
||||
--You have zero new messages
|
||||
if (name == "new_messages") then
|
||||
table.insert(actions, {app="streamFile",data="voicemail/vm-you_have.wav"});
|
||||
table.insert(actions, {app="say.number.pronounced",data=param});
|
||||
table.insert(actions, {app="streamFile",data="voicemail/vm-new.wav"});
|
||||
if (param == "1") then
|
||||
table.insert(actions, {app="streamFile",data="voicemail/vm-message.wav"});
|
||||
else
|
||||
table.insert(actions, {app="streamFile",data="voicemail/vm-messages.wav"});
|
||||
end
|
||||
table.insert(actions, {app="streamFile",data="phrase:voicemail_message_count:" .. param .. ":new"})
|
||||
end
|
||||
--You have zero saved messages
|
||||
if (name == "saved_messages") then
|
||||
table.insert(actions, {app="streamFile",data="voicemail/vm-you_have.wav"});
|
||||
table.insert(actions, {app="say.number.pronounced",data=param});
|
||||
table.insert(actions, {app="streamFile",data="voicemail/vm-saved.wav"});
|
||||
if (param == "1") then
|
||||
table.insert(actions, {app="streamFile",data="voicemail/vm-message.wav"});
|
||||
else
|
||||
table.insert(actions, {app="streamFile",data="voicemail/vm-messages.wav"});
|
||||
end
|
||||
table.insert(actions, {app="streamFile",data="phrase:voicemail_message_count:" .. param .. ":saved"})
|
||||
end
|
||||
--To listen to new messages press 1
|
||||
if (name == "listen_to_new_messages") then
|
||||
@@ -276,11 +260,15 @@
|
||||
timeout = 100;
|
||||
--loop through the action and data
|
||||
for key, row in pairs(actions) do
|
||||
--freeswitch.consoleLog("notice", "[voicemail] app: " .. row.app .. " data: " .. row.data .. "\n");
|
||||
-- freeswitch.consoleLog("notice", "[voicemail] app: " .. row.app .. " data: " .. row.data .. "\n");
|
||||
if (session:ready()) then
|
||||
if (string.len(dtmf_digits) == 0) then
|
||||
if (row.app == "streamFile") then
|
||||
session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/"..row.data);
|
||||
if string.find(row.data, ':', nil, true) then
|
||||
session:streamFile(row.data);
|
||||
else
|
||||
session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/"..row.data);
|
||||
end
|
||||
elseif (row.app == "playback") then
|
||||
session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/"..row.data);
|
||||
elseif (row.app == "tone_stream") then
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
elseif (message_status == "saved") then
|
||||
sql = sql .. [[AND message_status = 'saved' ]];
|
||||
end
|
||||
sql = sql .. [[ORDER BY created_epoch desc;]];
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "\n");
|
||||
end
|
||||
|
||||
@@ -143,26 +143,24 @@
|
||||
body = body:gsub(" ", " ");
|
||||
body = body:gsub("\n", "");
|
||||
body = body:gsub("\n", "");
|
||||
body = body:gsub("'", "'");
|
||||
body = body:gsub([["]], """);
|
||||
body = trim(body);
|
||||
|
||||
--send the email
|
||||
file = voicemail_dir.."/"..id.."/msg_"..uuid.."."..vm_message_ext;
|
||||
if (voicemail_file == "attach") then
|
||||
if (voicemail_local_after_email == "false") then
|
||||
delete = "true";
|
||||
else
|
||||
delete = "false";
|
||||
end
|
||||
cmd = "luarun email.lua "..voicemail_mail_to.." "..voicemail_mail_to.." "..headers.." '"..subject.."' '"..body.."' '"..file.."' "..delete;
|
||||
freeswitch.email("",
|
||||
"",
|
||||
"To: "..voicemail_mail_to.."\nFrom: "..voicemail_mail_to.."\nX-Headers: "..headers.."\nSubject: "..subject,
|
||||
body,
|
||||
file
|
||||
);
|
||||
else
|
||||
cmd = "luarun email.lua "..voicemail_mail_to.." "..voicemail_mail_to.." "..headers.." '"..subject.."' '"..body.."'";
|
||||
freeswitch.email("",
|
||||
"",
|
||||
"To: "..voicemail_mail_to.."\nFrom: "..voicemail_mail_to.."\nX-Headers: "..headers.."\nSubject: "..subject,
|
||||
body
|
||||
);
|
||||
end
|
||||
if (debug["info"]) then
|
||||
freeswitch.consoleLog("notice", "[voicemail] cmd: " .. cmd .. "\n");
|
||||
end
|
||||
result = api:executeString(cmd);
|
||||
end
|
||||
|
||||
--whether to keep the voicemail message and details local after email
|
||||
|
||||
@@ -304,7 +304,7 @@
|
||||
|
||||
--send the xml to the console
|
||||
if (debug["xml_string"]) then
|
||||
local file = assert(io.open("/tmp/dialplan-" .. call_context .. ".xml", "w"));
|
||||
local file = assert(io.open(temp_dir .. "/dialplan-" .. call_context .. ".xml", "w"));
|
||||
file:write(XML_STRING);
|
||||
file:close();
|
||||
end
|
||||
|
||||
@@ -254,7 +254,7 @@
|
||||
else
|
||||
--set a default dial string
|
||||
if (dial_string == null) then
|
||||
dial_string = "{sip_invite_domain=" .. domain_name .. ",presence_id=" .. user .. "@" .. domain_name .. "}${sofia_contact(" .. user .. "@" .. domain_name .. ")}";
|
||||
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
|
||||
@@ -360,10 +360,10 @@
|
||||
table.insert(xml, [[ <param name="auth-acl" value="]] .. auth_acl .. [["/>]]);
|
||||
end
|
||||
table.insert(xml, [[ <param name="dial-string" value="]] .. dial_string .. [["/>]]);
|
||||
table.insert(xml, [[ <param name="verto-context" value="]] .. user_context .. [["/>]]);
|
||||
table.insert(xml, [[ <param name="verto-dialplan" value="XML"/>]]);
|
||||
table.insert(xml, [[ <param name="jsonrpc-allowed-methods" value="verto"/>]]);
|
||||
table.insert(xml, [[ <param name="jsonrpc-allowed-event-channels" value="demo,conference,presence"/>]]);
|
||||
table.insert(xml, [[ <param name="verto-context" value="]] .. user_context .. [["/>]]);
|
||||
table.insert(xml, [[ <param name="verto-dialplan" value="XML"/>]]);
|
||||
table.insert(xml, [[ <param name="jsonrpc-allowed-methods" value="verto"/>]]);
|
||||
table.insert(xml, [[ <param name="jsonrpc-allowed-event-channels" value="demo,conference,presence"/>]]);
|
||||
table.insert(xml, [[ </params>]]);
|
||||
table.insert(xml, [[ <variables>]]);
|
||||
table.insert(xml, [[ <variable name="domain_uuid" value="]] .. domain_uuid .. [["/>]]);
|
||||
|
||||
@@ -209,6 +209,8 @@
|
||||
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
|
||||
|
||||
@@ -65,9 +65,11 @@
|
||||
if (not default_voice) then default_voice = 'callie'; end
|
||||
|
||||
--if the screen file is found then set confirm to true
|
||||
call_screen_file = "/tmp/" .. domain_name .. "-" .. caller_id_number .. "." .. record_ext;
|
||||
if (file_exists(call_screen_file)) then
|
||||
confirm = "true";
|
||||
if (domain_name ~= nil) then
|
||||
call_screen_file = "/tmp/" .. domain_name .. "-" .. caller_id_number .. "." .. record_ext;
|
||||
if (file_exists(call_screen_file)) then
|
||||
confirm = "true";
|
||||
end
|
||||
end
|
||||
|
||||
--confirm the calls
|
||||
@@ -104,4 +106,4 @@
|
||||
--send to the log
|
||||
--freeswitch.consoleLog("NOTICE", "[confirm] automatically accepted\n");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -67,6 +67,8 @@ if ( session:ready() ) then
|
||||
if (not default_dialect) then default_dialect = 'us'; end
|
||||
if (not default_voice) then default_voice = 'callie'; end
|
||||
|
||||
local conf_name = "page-"..destination_number.."%"..domain_name.."@page"
|
||||
|
||||
if (caller_id_name) then
|
||||
--caller id name provided do nothing
|
||||
else
|
||||
@@ -82,14 +84,10 @@ if ( session:ready() ) then
|
||||
end
|
||||
|
||||
--set conference flags
|
||||
if (mute) then
|
||||
if (mute == "false") then
|
||||
flags = "flags{}";
|
||||
else
|
||||
flags = "flags{mute}";
|
||||
end
|
||||
else
|
||||
if (mute == "true") then
|
||||
flags = "flags{mute}";
|
||||
else
|
||||
flags = "flags{}";
|
||||
end
|
||||
|
||||
--if the pin number is provided then require it
|
||||
@@ -129,7 +127,7 @@ if ( session:ready() ) then
|
||||
sub_table = explode("-",value);
|
||||
for destination=sub_table[1],sub_table[2] do
|
||||
--get the destination required for number-alias
|
||||
destination = api:execute("user_data", destination .. "@" .. domain_name .. " attr id");
|
||||
destination = api:execute("user_data", destination .. "@" .. domain_name .. " attr id");
|
||||
|
||||
--prevent calling the user that initiated the page
|
||||
if (sip_from_user ~= destination) then
|
||||
@@ -139,12 +137,12 @@ if ( session:ready() ) then
|
||||
destination_status = "show channels like "..destination.."@";
|
||||
reply = trim(api:executeString(destination_status));
|
||||
if (reply == "0 total.") then
|
||||
--freeswitch.consoleLog("NOTICE", "destination "..destination.." available\n");
|
||||
freeswitch.consoleLog("NOTICE", "[page] destination "..destination.." available\n");
|
||||
if (destination == tonumber(sip_from_user)) then
|
||||
--this destination is the caller that initated the page
|
||||
else
|
||||
--originate the call
|
||||
cmd_string = "bgapi originate {sip_auto_answer=true,sip_h_Alert-Info='Ring Answer',hangup_after_bridge=false,origination_caller_id_name='"..caller_id_name.."',origination_caller_id_number="..caller_id_number.."}user/"..destination.."@"..domain_name.." conference:page-"..destination_number.."@page+"..flags.." inline";
|
||||
cmd_string = "bgapi originate {sip_auto_answer=true,sip_h_Alert-Info='Ring Answer',hangup_after_bridge=false,origination_caller_id_name='"..caller_id_name.."',origination_caller_id_number="..caller_id_number.."}user/"..destination.."@"..domain_name.." conference:"..conf_name.."+"..flags.." inline";
|
||||
api:executeString(cmd_string);
|
||||
destination_count = destination_count + 1;
|
||||
end
|
||||
@@ -159,7 +157,7 @@ if ( session:ready() ) then
|
||||
--this destination is the caller that initated the page
|
||||
else
|
||||
--originate the call
|
||||
cmd_string = "bgapi originate {sip_auto_answer=true,hangup_after_bridge=false,origination_caller_id_name='"..caller_id_name.."',origination_caller_id_number="..caller_id_number.."}user/"..destination.."@"..domain_name.." conference:page-"..destination_number.."@page+"..flags.." inline";
|
||||
cmd_string = "bgapi originate {sip_auto_answer=true,hangup_after_bridge=false,origination_caller_id_name='"..caller_id_name.."',origination_caller_id_number="..caller_id_number.."}user/"..destination.."@"..domain_name.." conference:"..conf_name.."+"..flags.." inline";
|
||||
api:executeString(cmd_string);
|
||||
destination_count = destination_count + 1;
|
||||
end
|
||||
@@ -172,12 +170,12 @@ if ( session:ready() ) then
|
||||
|
||||
--send main call to the conference room
|
||||
if (destination_count > 0) then
|
||||
if (session:getVariable("moderator") ~= nil and session:getVariable("moderator") == "true") then
|
||||
if (session:getVariable("moderator") == "true") then
|
||||
moderator_flag = ",moderator";
|
||||
else
|
||||
moderator_flag = "";
|
||||
end
|
||||
session:execute("conference", "page-"..destination_number.."@page+flags{endconf"..moderator_flag.."}");
|
||||
session:execute("conference", conf_name.."+flags{endconf"..moderator_flag.."}");
|
||||
else
|
||||
session:execute("playback", "tone_stream://%(500,500,480,620);loops=3");
|
||||
end
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
--get the default settings
|
||||
sql = "SELECT * FROM v_default_settings ";
|
||||
sql = sql .. "WHERE default_setting_enabled = 'true' ";
|
||||
sql = sql .. "AND default_setting_value is not null ";
|
||||
sql = sql .. "ORDER BY default_setting_category, default_setting_subcategory ASC";
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "SQL: " .. sql .. "\n");
|
||||
@@ -65,7 +66,7 @@
|
||||
subcategory = row.default_setting_subcategory;
|
||||
name = row.default_setting_name;
|
||||
value = row.default_setting_value;
|
||||
|
||||
|
||||
--add the category array
|
||||
if (previous_category ~= category) then
|
||||
array[category] = {}
|
||||
@@ -100,6 +101,7 @@
|
||||
sql = "SELECT * FROM v_domain_settings ";
|
||||
sql = sql .. "WHERE domain_uuid = '" .. domain_uuid .. "' ";
|
||||
sql = sql .. "AND domain_setting_enabled = 'true' ";
|
||||
sql = sql .. "AND domain_setting_value is not null ";
|
||||
sql = sql .. "ORDER BY domain_setting_category, domain_setting_subcategory ASC ";
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[directory] SQL: " .. sql .. "\n");
|
||||
|
||||
Reference in New Issue
Block a user