Update cidlookup.lua (#5134)

Added callee parameter to SQL query and changed v_destinations.destination_number to look at callee.
This commit is contained in:
Adrian Fretwell
2020-01-29 04:33:10 +00:00
committed by GitHub
parent 492e88592f
commit d5823a88c3

View File

@@ -87,15 +87,15 @@
sql = "SELECT v_contacts.contact_name_given || ' ' || v_contacts.contact_name_family AS name FROM v_contacts ";
end
sql = sql .. "INNER JOIN v_contact_phones ON v_contact_phones.contact_uuid = v_contacts.contact_uuid ";
sql = sql .. "INNER JOIN v_destinations ON v_destinations.domain_uuid = v_contacts.domain_uuid AND v_destinations.destination_number = :caller ";
sql = sql .. "INNER JOIN v_destinations ON v_destinations.domain_uuid = v_contacts.domain_uuid AND v_destinations.destination_number = :callee ";
local params;
if ((not domain_uuid) or (domain_uuid == "")) then
sql = sql .. "WHERE v_contact_phones.phone_number = :caller ";
params = {caller = caller};
params = {caller = caller, callee = callee};
else
sql = sql .. "WHERE v_contacts.domain_uuid = :domain_uuid and v_contact_phones.phone_number = :caller ";
params = {caller = caller, domain_uuid = domain_uuid};
params = {caller = caller, domain_uuid = domain_uuid, callee = callee};
end
if (debug["sql"]) then