Merge branch 'master' into number_alias_as_vm_id

Conflicts:
	app/hot_desking/extension_edit.php
This commit is contained in:
Alexey Melnichuk
2015-07-21 11:19:13 +04:00
79 changed files with 1168 additions and 1163 deletions

View File

@@ -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);

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 .. [["/>]]);