From 44766475bf5cb7d9ee16ffafc98d129876e268e6 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Wed, 4 Dec 2013 08:14:40 +0000 Subject: [PATCH] Add per leg ring group domain name control. Contributed by Daniel Lucio. dest1: 100 dest2: 999@otherdomain dest3: 555 --- .../install/scripts/app/ring_groups/index.lua | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/resources/install/scripts/app/ring_groups/index.lua b/resources/install/scripts/app/ring_groups/index.lua index d037393d8d..a706c7ba9d 100644 --- a/resources/install/scripts/app/ring_groups/index.lua +++ b/resources/install/scripts/app/ring_groups/index.lua @@ -23,6 +23,11 @@ -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. +-- +-- Contributor(s): +-- Mark J Crane +-- Luis Daniel Lucio Qurioz + --connect to the database dofile(scripts_dir.."/resources/functions/database_handle.lua"); @@ -105,7 +110,16 @@ if (row.destination_prompt == "1" or row.destination_prompt == "2") then prompt = "true"; end - cmd = "user_exists id ".. row.destination_number .." "..domain_name; + + local array = explode("@",row.destination_number); + if (array[2] == nil) then + -- no @ + leg_domain_name = domain_name; + else + leg_domain_name = array[2]; + row.destination_number = array[1] + end + cmd = "user_exists id ".. row.destination_number .." "..leg_domain_name; user_exists = api:executeString(cmd); if (user_exists == "true") then row['user_exists'] = "true"; @@ -113,6 +127,7 @@ external = "true"; row['user_exists'] = "false"; end + row['domain_name'] = leg_domain_name; destinations[x] = row; x = x + 1; end)); @@ -160,6 +175,7 @@ destination_delay = row.destination_delay; destination_timeout = row.destination_timeout; destination_prompt = row.destination_prompt; + domain_name = row.domain_name; --set ringback if (ring_group_ringback == "${uk-ring}") then @@ -285,8 +301,8 @@ end previous_dialplan_uuid = r.dialplan_uuid; end - --freeswitch.consoleLog("notice", "[ring group] dial_string: " .. dial_string .. "\n"); end + freeswitch.consoleLog("notice", "[ring group] dial_string: " .. dial_string .. "\n"); --prompt will use the confirm lua script and the content of else will use the concatenated dialstring seperated by the delimiter if (prompt == "true") then