Allow a device that is logged in already to be replaced with a new alternate device.
This commit is contained in:
parent
42924ccead
commit
5d9bb1b9d1
|
|
@ -121,7 +121,22 @@
|
||||||
result = session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/voicemail/vm-fail_auth.wav");
|
result = session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/voicemail/vm-fail_auth.wav");
|
||||||
end
|
end
|
||||||
|
|
||||||
--remove the previous device and send a sync command to it
|
--this device already has an alternate find the correct device_uuid and then override current one
|
||||||
|
if (authorized == 'true' and action == "login" and device_uuid_alternate ~= nil) then
|
||||||
|
sql = [[SELECT * FROM v_devices ]];
|
||||||
|
sql = sql .. [[WHERE device_uuid_alternate = ']]..device_uuid..[[' ]];
|
||||||
|
sql = sql .. [[AND domain_uuid = ']]..domain_uuid..[[' ]];
|
||||||
|
if (debug["sql"]) then
|
||||||
|
freeswitch.consoleLog("NOTICE", "[provision] sql: ".. sql .. "\n");
|
||||||
|
end
|
||||||
|
dbh:query(sql, function(row)
|
||||||
|
if (row.device_uuid_alternate ~= nil) then
|
||||||
|
device_uuid = row.device_uuid;
|
||||||
|
end
|
||||||
|
end);
|
||||||
|
end
|
||||||
|
|
||||||
|
--remove the alternate device from another device so that it can be added to this device
|
||||||
if (authorized == 'true' and action == "login") then
|
if (authorized == 'true' and action == "login") then
|
||||||
sql = [[SELECT * FROM v_device_lines ]];
|
sql = [[SELECT * FROM v_device_lines ]];
|
||||||
sql = sql .. [[WHERE device_uuid = ']]..device_uuid_alternate..[[' ]];
|
sql = sql .. [[WHERE device_uuid = ']]..device_uuid_alternate..[[' ]];
|
||||||
|
|
@ -135,7 +150,7 @@
|
||||||
sql = sql .. [[WHERE device_uuid_alternate = ']]..device_uuid_alternate..[[' ]];
|
sql = sql .. [[WHERE device_uuid_alternate = ']]..device_uuid_alternate..[[' ]];
|
||||||
sql = sql .. [[AND domain_uuid = ']]..domain_uuid..[[' ]];
|
sql = sql .. [[AND domain_uuid = ']]..domain_uuid..[[' ]];
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
--freeswitch.consoleLog("NOTICE", "[provision] sql: ".. sql .. "\n");
|
freeswitch.consoleLog("NOTICE", "[provision] sql: ".. sql .. "\n");
|
||||||
end
|
end
|
||||||
dbh:query(sql);
|
dbh:query(sql);
|
||||||
--send a sync command to the previous device
|
--send a sync command to the previous device
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue