Fix. Find in database not empty phone number for speed dial. (#2242)
Also do not store `context` in memcache
This commit is contained in:
committed by
FusionPBX
parent
90dc900933
commit
72dfd3a362
@@ -22,7 +22,7 @@
|
|||||||
require "resources.functions.config";
|
require "resources.functions.config";
|
||||||
|
|
||||||
--set debug
|
--set debug
|
||||||
debug["sql"] = true;
|
-- debug["sql"] = true;
|
||||||
|
|
||||||
--load libraries
|
--load libraries
|
||||||
local log = require "resources.functions.log"["app:dialplan:outbound:speed_dial"]
|
local log = require "resources.functions.log"["app:dialplan:outbound:speed_dial"]
|
||||||
@@ -46,8 +46,8 @@
|
|||||||
-- decode value from memcache
|
-- decode value from memcache
|
||||||
if value then
|
if value then
|
||||||
local t = json.decode(value)
|
local t = json.decode(value)
|
||||||
if not (t and t.phone_number and t.context) then
|
if not (t and t.phone_number) then
|
||||||
log.warning("can not decode value from memcache: %s", value)
|
log.warningf("can not decode value from memcache: %s", value)
|
||||||
value = nil
|
value = nil
|
||||||
else
|
else
|
||||||
value = t
|
value = t
|
||||||
@@ -67,6 +67,7 @@
|
|||||||
sql = sql .. "FROM v_contact_phones "
|
sql = sql .. "FROM v_contact_phones "
|
||||||
sql = sql .. "WHERE phone_speed_dial = :phone_speed_dial "
|
sql = sql .. "WHERE phone_speed_dial = :phone_speed_dial "
|
||||||
sql = sql .. "AND domain_uuid = :domain_uuid "
|
sql = sql .. "AND domain_uuid = :domain_uuid "
|
||||||
|
sql = sql .. "AND (phone_number <> '' AND phone_number IS NOT NULL) "
|
||||||
|
|
||||||
local params = {phone_speed_dial = destination, domain_uuid = domain_uuid};
|
local params = {phone_speed_dial = destination, domain_uuid = domain_uuid};
|
||||||
|
|
||||||
@@ -81,7 +82,7 @@
|
|||||||
|
|
||||||
-- set the cache
|
-- set the cache
|
||||||
if phone_number then
|
if phone_number then
|
||||||
value = {context = context, phone_number = phone_number}
|
value = {phone_number = phone_number}
|
||||||
cache.set(key, json.encode(value), expire["speed_dial"])
|
cache.set(key, json.encode(value), expire["speed_dial"])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user