From 6e3656cdfd7e28cd6f5805fb3a9c9d7a71ccc5c7 Mon Sep 17 00:00:00 2001 From: Errol Samuels Date: Sat, 23 Aug 2014 14:03:23 +0000 Subject: [PATCH] Fixed intercept **[ext] to work better when using multiple Freeswitch servers --- resources/install/scripts/intercept.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/resources/install/scripts/intercept.lua b/resources/install/scripts/intercept.lua index e659f868b0..05a96a079d 100644 --- a/resources/install/scripts/intercept.lua +++ b/resources/install/scripts/intercept.lua @@ -21,6 +21,7 @@ -- -- Contributor(s): -- Mark J Crane +-- Errol W Samuels --user defined variables max_tries = "3"; @@ -54,6 +55,7 @@ if ( session:ready() ) then --get session variables pin_number = session:getVariable("pin_number"); sounds_dir = session:getVariable("sounds_dir"); + domain_uuid = session:getVariable("domain_uuid"); domain_name = session:getVariable("domain_name"); context = session:getVariable("context"); sofia_profile_name = session:getVariable("sofia_profile_name"); @@ -108,7 +110,7 @@ if ( session:ready() ) then end --check the database to get the uuid of a ringing call - sql = "select call_uuid as uuid, hostname, ip_addr from channels "; + sql = "select call_uuid as uuid, hostname, callee_num, ip_addr from channels "; sql = sql .. "where callstate = 'RINGING' "; if (extension) then sql = sql .. "and presence_id = '"..extension.."@"..domain_name.."' "; @@ -126,9 +128,9 @@ if ( session:ready() ) then --end uuid = result.uuid; call_hostname = result.hostname; + callee_num = result.callee_num; ip_addr = result.ip_addr; end); - end --get the hostname @@ -143,8 +145,9 @@ end session:execute("export", "sip_h_X-intercept_uuid="..uuid); session:execute("export", "sip_h_X-domain_uuid="..domain_uuid); session:execute("export", "sip_h_X-domain_name="..domain_name); + session:execute("export", "sip_h_X-callee_num="..callee_num); port = freeswitch.getGlobalVariable(sofia_profile_name.."_sip_port"); - session:execute("bridge", "sofia/"..sofia_profile_name.."/*8@"..call_hostname..":"..port); + session:execute("bridge", "sofia/"..sofia_profile_name.."/**@"..call_hostname..":"..port); freeswitch.consoleLog("NOTICE", "Send call to other host.... \n"); end end