From 928a8437944c88acbeb567e8234deb0088a220cd Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Thu, 16 Jul 2015 11:50:07 +0400 Subject: [PATCH 1/2] Fix. Make page extension domain specific. --- resources/install/scripts/page.lua | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/resources/install/scripts/page.lua b/resources/install/scripts/page.lua index 4e88d2850b..5798474d04 100644 --- a/resources/install/scripts/page.lua +++ b/resources/install/scripts/page.lua @@ -82,14 +82,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 +125,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,7 +135,7 @@ 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 @@ -172,12 +168,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", "page-"..destination_number.."%"..domain_name.."@page+flags{endconf"..moderator_flag.."}"); else session:execute("playback", "tone_stream://%(500,500,480,620);loops=3"); end From f029aeff2450836e87fc26ba649789e60818c532 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Thu, 16 Jul 2015 12:11:57 +0400 Subject: [PATCH 2/2] Fix. Use correct conf name on originate --- resources/install/scripts/page.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/resources/install/scripts/page.lua b/resources/install/scripts/page.lua index 5798474d04..ca150279a9 100644 --- a/resources/install/scripts/page.lua +++ b/resources/install/scripts/page.lua @@ -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 @@ -140,7 +142,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,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 @@ -155,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 @@ -173,7 +175,7 @@ if ( session:ready() ) then else moderator_flag = ""; end - session:execute("conference", "page-"..destination_number.."%"..domain_name.."@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