Paging - Prevent calling the user that initiated the page
This commit is contained in:
parent
3c43f604c5
commit
d79e72141d
|
|
@ -131,39 +131,42 @@ if ( session:ready() ) then
|
||||||
--get the destination required for number-alias
|
--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");
|
||||||
|
|
||||||
--cmd = "username_exists id "..destination.."@"..domain_name;
|
--prevent calling the user that initiated the page
|
||||||
--reply = trim(api:executeString(cmd));
|
if (sip_from_user ~= destination) then
|
||||||
--if (reply == "true") then
|
--cmd = "username_exists id "..destination.."@"..domain_name;
|
||||||
destination_status = "show channels like "..destination.."@";
|
--reply = trim(api:executeString(cmd));
|
||||||
reply = trim(api:executeString(destination_status));
|
--if (reply == "true") then
|
||||||
if (reply == "0 total.") then
|
destination_status = "show channels like "..destination.."@";
|
||||||
--freeswitch.consoleLog("NOTICE", "destination "..destination.." available\n");
|
reply = trim(api:executeString(destination_status));
|
||||||
if (destination == tonumber(sip_from_user)) then
|
if (reply == "0 total.") then
|
||||||
--this destination is the caller that initated the page
|
--freeswitch.consoleLog("NOTICE", "destination "..destination.." available\n");
|
||||||
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";
|
|
||||||
api:executeString(cmd_string);
|
|
||||||
destination_count = destination_count + 1;
|
|
||||||
end
|
|
||||||
--freeswitch.consoleLog("NOTICE", "cmd_string "..cmd_string.."\n");
|
|
||||||
else
|
|
||||||
--look inside the reply to check for the correct domain_name
|
|
||||||
if string.find(reply, domain_name) then
|
|
||||||
--found: user is busy
|
|
||||||
else
|
|
||||||
--not found
|
|
||||||
if (destination == tonumber(sip_from_user)) then
|
if (destination == tonumber(sip_from_user)) then
|
||||||
--this destination is the caller that initated the page
|
--this destination is the caller that initated the page
|
||||||
else
|
else
|
||||||
--originate the call
|
--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,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";
|
||||||
api:executeString(cmd_string);
|
api:executeString(cmd_string);
|
||||||
destination_count = destination_count + 1;
|
destination_count = destination_count + 1;
|
||||||
end
|
end
|
||||||
|
--freeswitch.consoleLog("NOTICE", "cmd_string "..cmd_string.."\n");
|
||||||
|
else
|
||||||
|
--look inside the reply to check for the correct domain_name
|
||||||
|
if string.find(reply, domain_name) then
|
||||||
|
--found: user is busy
|
||||||
|
else
|
||||||
|
--not found
|
||||||
|
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,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";
|
||||||
|
api:executeString(cmd_string);
|
||||||
|
destination_count = destination_count + 1;
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
--end
|
||||||
--end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue