Fix. Start recording only after call start and only for certain extension.
Fix. Always use record dir with domain name like it does `user_record` extension.
This commit is contained in:
@@ -75,11 +75,10 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
--set the recording path
|
--set the recording path
|
||||||
recording_archive = recordings_dir
|
recording_archive = recordings_dir .. "/" .. domain_name .. "/archive/" .. os.date("%Y/%b/%d");
|
||||||
if (domain_count > 1) then
|
|
||||||
recording_archive = recording_archive.."/"..domain_name;
|
--set the recording file
|
||||||
end
|
record_file = recording_archive:gsub("\\", "/") .. "/" .. uuid .. "." .. record_ext
|
||||||
recording_archive = recording_archive.."/archive/"..(os.date("%Y")).."/"..(os.date("%b")).."/"..(os.date("%d"));
|
|
||||||
|
|
||||||
--prepare the api object
|
--prepare the api object
|
||||||
api = freeswitch.API();
|
api = freeswitch.API();
|
||||||
@@ -346,6 +345,7 @@
|
|||||||
cmd = "user_data ".. destination_number .."@"..domain_name.." var user_record";
|
cmd = "user_data ".. destination_number .."@"..domain_name.." var user_record";
|
||||||
user_record = trim(api:executeString(cmd));
|
user_record = trim(api:executeString(cmd));
|
||||||
--set the record_session variable
|
--set the record_session variable
|
||||||
|
record_session = false;
|
||||||
if (user_record == "all") then
|
if (user_record == "all") then
|
||||||
record_session = true;
|
record_session = true;
|
||||||
end
|
end
|
||||||
@@ -361,9 +361,11 @@
|
|||||||
|
|
||||||
--record the session
|
--record the session
|
||||||
if (record_session) then
|
if (record_session) then
|
||||||
cmd = "uuid_record "..uuid.." start "..recording_archive.."/"..uuid.."."..record_ext;
|
record_session = ",api_on_answer='uuid_record "..uuid.." start ".. record_file .. "'";
|
||||||
response = api:executeString(cmd);
|
else
|
||||||
|
record_session = ""
|
||||||
end
|
end
|
||||||
|
row.record_session = record_session
|
||||||
|
|
||||||
--process according to user_exists, sip_uri, external number
|
--process according to user_exists, sip_uri, external number
|
||||||
if (user_exists == "true") then
|
if (user_exists == "true") then
|
||||||
@@ -371,26 +373,27 @@
|
|||||||
cmd = "user_data ".. destination_number .."@"..domain_name.." var extension_uuid";
|
cmd = "user_data ".. destination_number .."@"..domain_name.." var extension_uuid";
|
||||||
extension_uuid = trim(api:executeString(cmd));
|
extension_uuid = trim(api:executeString(cmd));
|
||||||
--send to user
|
--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 ~= nil) then
|
||||||
if (ring_group_skip_active == "true") then
|
if (ring_group_skip_active == "true") then
|
||||||
cmd = "show channels like "..destination_number;
|
cmd = "show channels like "..destination_number;
|
||||||
reply = trim(api:executeString(cmd));
|
reply = trim(api:executeString(cmd));
|
||||||
--freeswitch.consoleLog("notice", "[ring group] reply "..cmd.." " .. reply .. "\n");
|
--freeswitch.consoleLog("notice", "[ring group] reply "..cmd.." " .. reply .. "\n");
|
||||||
if (reply == "0 total.") then
|
if (reply == "0 total.") then
|
||||||
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;
|
dial_string = dial_string_to_user
|
||||||
else
|
else
|
||||||
if (string.find(reply, domain_name)) then
|
if (string.find(reply, domain_name)) then
|
||||||
--active call
|
--active call
|
||||||
else
|
else
|
||||||
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;
|
dial_string = dial_string_to_user;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
--look inside the reply to check for the correct domain_name
|
--look inside the reply to check for the correct 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;
|
dial_string = dial_string_to_user;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
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;
|
dial_string = dial_string_to_user;
|
||||||
end
|
end
|
||||||
elseif (tonumber(destination_number) == nil) then
|
elseif (tonumber(destination_number) == nil) then
|
||||||
--sip uri
|
--sip uri
|
||||||
@@ -496,7 +499,6 @@
|
|||||||
-- end
|
-- end
|
||||||
|
|
||||||
--set bind digit action
|
--set bind digit action
|
||||||
local record_file = recordings_dir.."/archive/"..os.date("%Y").."/"..os.date("%m").."/"..os.date("%d").."}/"..uuid.."."..record_ext
|
|
||||||
local bindings = {
|
local bindings = {
|
||||||
"local,*1,exec:execute_extension,dx XML " .. context,
|
"local,*1,exec:execute_extension,dx XML " .. context,
|
||||||
"local,*2,exec:record_session," .. record_file,
|
"local,*2,exec:record_session," .. record_file,
|
||||||
@@ -537,7 +539,7 @@
|
|||||||
|
|
||||||
--send the call to the destination
|
--send the call to the destination
|
||||||
if (user_exists == "true") then
|
if (user_exists == "true") then
|
||||||
dial_string = "["..group_confirm.."sip_invite_domain="..domain_name..",dialed_extension=" .. destination_number .. ",extension_uuid="..extension_uuid..",domain_name="..domain_name..",domain_uuid="..domain_uuid.."]user/" .. destination_number .. "@" .. domain_name;
|
dial_string = "["..group_confirm.."sip_invite_domain="..domain_name..",dialed_extension=" .. destination_number .. ",extension_uuid="..extension_uuid..",domain_name="..domain_name..",domain_uuid="..domain_uuid..row.record_session.."]user/" .. destination_number .. "@" .. domain_name;
|
||||||
session:execute("bridge", dial_string);
|
session:execute("bridge", dial_string);
|
||||||
elseif (tonumber(destination_number) == nil) then
|
elseif (tonumber(destination_number) == nil) then
|
||||||
--sip uri
|
--sip uri
|
||||||
|
|||||||
Reference in New Issue
Block a user