From 29f04383cbbf82a73406e976cb6006cfa1289ca2 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Sat, 26 Aug 2023 15:29:58 -0600 Subject: [PATCH] Inbound number not found send to the log --- .../resources/scripts/dialplan/dialplan.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/switch/resources/scripts/app/xml_handler/resources/scripts/dialplan/dialplan.lua b/app/switch/resources/scripts/app/xml_handler/resources/scripts/dialplan/dialplan.lua index 30424ce1f2..8b3ef54aea 100644 --- a/app/switch/resources/scripts/app/xml_handler/resources/scripts/dialplan/dialplan.lua +++ b/app/switch/resources/scripts/app/xml_handler/resources/scripts/dialplan/dialplan.lua @@ -203,10 +203,23 @@ end end); if (xml == nil) then + --sanitize the destination if not numeric + if (type(destination_number) == "string") then + destination_number = destination_number:gsub("^%+", ""); + destination_number = tonumber(destination_number); + if (type(tonumber(destination_number)) ~= "number") then + destination_number = 'not numeric'; + end + end + if (type(destination_number) == "numeric") then + destination_number = tostring(destination_number); + end + + --build 404 not found XML xml:append([[ ]]); xml:append([[ ]]); xml:append([[ ]]); - xml:append([[ ]]); + xml:append([[ ]]); xml:append([[ ]]); xml:append([[ ]]); end