[ASTPPCOM-1409] Anonymous calls to calling card access number drop and result in SQL query error Created: 09/Feb/24  Updated: 09/Feb/24

Status: Open
Project: ASTPP Community
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Medium
Reporter: Jack Birnbaum Assignee: Samir Doshi
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Reproducibility: always
Category: Performance
Edition: Community

 Description   

Anonymous calls to calling card access numbers 16045554444 and 14162225523 get dropped due to SQL lookup error for a field 'anonymous'.
https://pastebin.com/AhBfyB1b

I fixed it by skipping the sql query if ani_number is 'anonymous' or 'private'
in '/opt/ASTPP/freeswitch/scripts/astpp/lib/calingcard.functions.lua'

--[[ Check DID info. Original code changed to DCI code below
function get_ani(ani_number)
local query = "SELECT * FROM ani_map WHERE number = ".. ani_number
Logger.debug("[CHECK_DID] Query :" .. query)
assert (dbh:query(query, function(u)
ani = u;
end))
return ani;
end ]]

– DCI change. Check DID info. Skip sql query if ani_number is anonymous
function get_ani(ani_number)
local ani = nil – Initialize ani variable to nil
– Check if ani_number contains alphanumeric characters to avoid SQL query execution
if ani_number == "anonymous" or ani_number == "private" or ani_number == "Unavailable" then
Logger.debug("[CHECK_DID] Skipping SQL query for ani_number: " .. ani_number)
else
local query = "SELECT * FROM ani_map WHERE number = ".. ani_number
Logger.debug("[CHECK_DID] Query :" .. query)
– Execute the SQL query only if ani_number doesn't contain special values
assert(dbh:query(query, function(u)
ani = u;
end))
end
return ani;
end – DCI end ]]


Generated at Sat Feb 10 07:25:52 CET 2024 using Jira 8.13.3#813003-sha1:22ebedbb75c99b147c66f14e031dd8a2d214753a.