commit
0302b112ac
|
|
@ -67,6 +67,8 @@ if ( session:ready() ) then
|
||||||
if (not default_dialect) then default_dialect = 'us'; end
|
if (not default_dialect) then default_dialect = 'us'; end
|
||||||
if (not default_voice) then default_voice = 'callie'; end
|
if (not default_voice) then default_voice = 'callie'; end
|
||||||
|
|
||||||
|
local conf_name = "page-"..destination_number.."%"..domain_name.."@page"
|
||||||
|
|
||||||
if (caller_id_name) then
|
if (caller_id_name) then
|
||||||
--caller id name provided do nothing
|
--caller id name provided do nothing
|
||||||
else
|
else
|
||||||
|
|
@ -82,14 +84,10 @@ if ( session:ready() ) then
|
||||||
end
|
end
|
||||||
|
|
||||||
--set conference flags
|
--set conference flags
|
||||||
if (mute) then
|
if (mute == "true") then
|
||||||
if (mute == "false") then
|
|
||||||
flags = "flags{}";
|
|
||||||
else
|
|
||||||
flags = "flags{mute}";
|
|
||||||
end
|
|
||||||
else
|
|
||||||
flags = "flags{mute}";
|
flags = "flags{mute}";
|
||||||
|
else
|
||||||
|
flags = "flags{}";
|
||||||
end
|
end
|
||||||
|
|
||||||
--if the pin number is provided then require it
|
--if the pin number is provided then require it
|
||||||
|
|
@ -129,7 +127,7 @@ if ( session:ready() ) then
|
||||||
sub_table = explode("-",value);
|
sub_table = explode("-",value);
|
||||||
for destination=sub_table[1],sub_table[2] do
|
for destination=sub_table[1],sub_table[2] do
|
||||||
--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");
|
||||||
|
|
||||||
--prevent calling the user that initiated the page
|
--prevent calling the user that initiated the page
|
||||||
if (sip_from_user ~= destination) then
|
if (sip_from_user ~= destination) then
|
||||||
|
|
@ -139,12 +137,12 @@ if ( session:ready() ) then
|
||||||
destination_status = "show channels like "..destination.."@";
|
destination_status = "show channels like "..destination.."@";
|
||||||
reply = trim(api:executeString(destination_status));
|
reply = trim(api:executeString(destination_status));
|
||||||
if (reply == "0 total.") then
|
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
|
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,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);
|
api:executeString(cmd_string);
|
||||||
destination_count = destination_count + 1;
|
destination_count = destination_count + 1;
|
||||||
end
|
end
|
||||||
|
|
@ -159,7 +157,7 @@ if ( session:ready() ) 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,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);
|
api:executeString(cmd_string);
|
||||||
destination_count = destination_count + 1;
|
destination_count = destination_count + 1;
|
||||||
end
|
end
|
||||||
|
|
@ -172,12 +170,12 @@ if ( session:ready() ) then
|
||||||
|
|
||||||
--send main call to the conference room
|
--send main call to the conference room
|
||||||
if (destination_count > 0) then
|
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";
|
moderator_flag = ",moderator";
|
||||||
else
|
else
|
||||||
moderator_flag = "";
|
moderator_flag = "";
|
||||||
end
|
end
|
||||||
session:execute("conference", "page-"..destination_number.."@page+flags{endconf"..moderator_flag.."}");
|
session:execute("conference", conf_name.."+flags{endconf"..moderator_flag.."}");
|
||||||
else
|
else
|
||||||
session:execute("playback", "tone_stream://%(500,500,480,620);loops=3");
|
session:execute("playback", "tone_stream://%(500,500,480,620);loops=3");
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue