A little more polish for this feature.

This commit is contained in:
Mark Crane
2015-05-30 04:50:19 +00:00
parent f481386631
commit 629db232ab

View File

@@ -54,10 +54,10 @@
dbh = database_handle('system');
--answer
--session:answer();
session:answer();
--sleep
--session:sleep(500);
session:sleep(500);
--get the domain_uuid
domain_uuid = session:getVariable("domain_uuid");
@@ -160,7 +160,7 @@
event:addHeader('host', row.server_address);
event:addHeader('content-type', 'application/simple-message-summary');
--check sync
event:addHeader('event-string', 'check-sync;reboot=true');
event:addHeader('event-string', 'check-sync;reboot=false');
--send the event
event:fire();
end);
@@ -169,14 +169,16 @@
--add the override to the device uuid (login)
if (authorized == 'true' and action == "login") then
if (device_uuid_alternate ~= nil) then
--send a hangup
session:hangup();
--add the new alternate
sql = [[UPDATE v_devices SET device_uuid_alternate = ']]..device_uuid_alternate..[[']];
sql = sql .. [[WHERE device_uuid = ']]..device_uuid..[[' ]];
sql = sql .. [[AND domain_uuid = ']]..domain_uuid..[[' ]];
if (debug["sql"]) then
freeswitch.consoleLog("NOTICE", "[provision] sql: ".. sql .. "\n");
end
dbh:query(sql);
sql = [[UPDATE v_devices SET device_uuid_alternate = ']]..device_uuid_alternate..[[']];
sql = sql .. [[WHERE device_uuid = ']]..device_uuid..[[' ]];
sql = sql .. [[AND domain_uuid = ']]..domain_uuid..[[' ]];
if (debug["sql"]) then
freeswitch.consoleLog("NOTICE", "[provision] sql: ".. sql .. "\n");
end
dbh:query(sql);
end
end
@@ -195,6 +197,8 @@
--found the device send a sync command
if (authorized == 'true') then
--send a hangup
session:hangup();
--create the event notify object
local event = freeswitch.Event('NOTIFY');
--add the headers
@@ -203,7 +207,7 @@
event:addHeader('host', domain);
event:addHeader('content-type', 'application/simple-message-summary');
--check sync
event:addHeader('event-string', 'check-sync;reboot=true');
event:addHeader('event-string', 'check-sync;reboot=false');
--send the event
event:fire();
end