From d5823a88c34d6705e6dcc13a92d71d737f048ce9 Mon Sep 17 00:00:00 2001 From: Adrian Fretwell Date: Wed, 29 Jan 2020 04:33:10 +0000 Subject: [PATCH] Update cidlookup.lua (#5134) Added callee parameter to SQL query and changed v_destinations.destination_number to look at callee. --- app/scripts/resources/scripts/cidlookup.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/scripts/resources/scripts/cidlookup.lua b/app/scripts/resources/scripts/cidlookup.lua index 2828e51988..d901597b5c 100644 --- a/app/scripts/resources/scripts/cidlookup.lua +++ b/app/scripts/resources/scripts/cidlookup.lua @@ -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