From 3da08abd0c1660821bc7eaf9cd85ee65a3d5b566 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Sun, 13 Jul 2014 09:24:51 +0000 Subject: [PATCH] Add group confirm to ring group bridge statements --- .../install/scripts/app/ring_groups/index.lua | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/resources/install/scripts/app/ring_groups/index.lua b/resources/install/scripts/app/ring_groups/index.lua index ce5f934df1..2f2b441ea5 100644 --- a/resources/install/scripts/app/ring_groups/index.lua +++ b/resources/install/scripts/app/ring_groups/index.lua @@ -1,17 +1,17 @@ --- ring_groups.lua + -- ring_groups.lua -- Part of FusionPBX --- Copyright (C) 2010-2014 Mark J Crane +-- Copyright (C) 2010-2013 Mark J Crane -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- 1. Redistributions of source code must retain the above copyright notice, --- this list of conditions and the following disclaimer. +-- this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright --- notice, this list of conditions and the following disclaimer in the --- documentation and/or other materials provided with the distribution. +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. -- -- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, -- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY @@ -28,6 +28,7 @@ -- Mark J Crane -- Luis Daniel Lucio Qurioz + --connect to the database dofile(scripts_dir.."/resources/functions/database_handle.lua"); dbh = database_handle('system'); @@ -91,9 +92,9 @@ --set the caller id if (session:ready()) then - if (string.len(ring_group_cid_name_prefix) > 0) then - session:execute("set", "effective_caller_id_name="..ring_group_cid_name_prefix.."#"..caller_id_name); - end + if (string.len(ring_group_cid_name_prefix) > 0) then + session:execute("set", "effective_caller_id_name="..ring_group_cid_name_prefix.."#"..caller_id_name); + end end --process the ring group @@ -274,7 +275,7 @@ dialplan_detail_data = r.dialplan_detail_data:gsub("$1", destination_result); --if the session is set then process the actions if (y == 0) then - square = "[sip_invite_domain="..domain_name..",leg_timeout="..destination_timeout..",leg_delay_start="..destination_delay..","; + square = "[sip_invite_domain="..domain_name..","..group_confirm.."leg_timeout="..destination_timeout..",leg_delay_start="..destination_delay..",ignore_early_media=true"; end if (r.dialplan_detail_type == "set") then --session:execute("eval", dialplan_detail_data); @@ -351,14 +352,14 @@ if (reply == "0 total.") then --not found: user is available if (user_exists == "true") then - dial_string = "[sip_invite_domain="..domain_name..",dialed_extension=" .. destination_number .. "]user/" .. destination_number .. "@" .. domain_name; + dial_string = "["..group_confirm.."sip_invite_domain="..domain_name..",dialed_extension=" .. destination_number .. "]user/" .. destination_number .. "@" .. domain_name; session:execute("bridge", dial_string); elseif (tonumber(destination_number) == nil) then --sip uri - dial_string = "[sip_invite_domain="..domain_name.."]" .. destination_number; + dial_string = "["..group_confirm.."sip_invite_domain="..domain_name.."]" .. destination_number; session:execute("bridge", dial_string); else - dial_string = "[sip_invite_domain="..domain_name.."]loopback/" .. destination_number; + dial_string = "["..group_confirm.."sip_invite_domain="..domain_name.."]loopback/" .. destination_number; session:execute("bridge", dial_string); end else @@ -368,14 +369,14 @@ else --not found: user is available if (user_exists == "true") then - dial_string = "[sip_invite_domain="..domain_name.."dialed_extension=" .. destination_number .. "]user/" .. destination_number .. "@" .. domain_name; + dial_string = "["..group_confirm.."sip_invite_domain="..domain_name.."dialed_extension=" .. destination_number .. "]user/" .. destination_number .. "@" .. domain_name; session:execute("bridge", dial_string); elseif (tonumber(destination_number) == nil) then --sip uri - dial_string = "[sip_invite_domain="..domain_name.."]" .. destination_number; + dial_string = "["..group_confirm.."sip_invite_domain="..domain_name.."]" .. destination_number; session:execute("bridge", dial_string); else - dial_string = "[sip_invite_domain="..domain_name.."]loopback/" .. destination_number; + dial_string = "["..group_confirm.."sip_invite_domain="..domain_name.."]loopback/" .. destination_number; session:execute("bridge", dial_string); end end @@ -412,6 +413,7 @@ end end + --actions --ACTIONS = {} --table.insert(ACTIONS, {"set", "hangup_after_bridge=true"});