From f789ed4811d1115a38b11d00204d530334526fdb Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Wed, 28 Mar 2018 22:40:55 -0600 Subject: [PATCH] Update index.lua --- .../install/scripts/app/provision/index.lua | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/resources/install/scripts/app/provision/index.lua b/resources/install/scripts/app/provision/index.lua index 52a898f3bf..3256e785d7 100644 --- a/resources/install/scripts/app/provision/index.lua +++ b/resources/install/scripts/app/provision/index.lua @@ -1,5 +1,5 @@ -- Part of FusionPBX --- Copyright (C) 2015 Mark J Crane +-- Copyright (C) 2015-2018 Mark J Crane -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -28,13 +28,13 @@ --define the explode function require "resources.functions.explode"; + require "resources.functions.trim"; --set the defaults max_tries = 3; digit_timeout = 5000; max_retries = 3; tries = 0; - profile = "internal"; --connect to the database local Database = require "resources.functions.database"; @@ -177,6 +177,12 @@ freeswitch.consoleLog("NOTICE", "[provision] SQL: ".. sql .. "; params: " .. json.encode(params) .. "\n"); end dbh:query(sql, params); + --get the sip profile + api = freeswitch.API(); + local sofia_contact = trim(api:executeString("sofia_contact */"..row.user_id.."@"..row.server_address)); + array = explode("/", sofia_contact); + profile = array[2]; + freeswitch.consoleLog("NOTICE", "[provision] profile: ".. profile .. "\n"); --send a sync command to the previous device --create the event notify object local event = freeswitch.Event('NOTIFY'); @@ -226,6 +232,12 @@ --found the device send a sync command if (authorized == 'true') then + --get the sip profile + api = freeswitch.API(); + local sofia_contact = trim(api:executeString("sofia_contact */"..user.."@"..domain)); + array = explode("/", sofia_contact); + profile = array[2]; + freeswitch.consoleLog("NOTICE", "[provision] profile: ".. profile .. "\n"); --send a hangup session:hangup(); --create the event notify object