From a190165f02fa0fc1bb1bce87d6bde37427bd291e Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Wed, 15 Oct 2014 17:32:02 +0000 Subject: [PATCH] Fix the xml handler nil error for number_alias. --- .../resources/scripts/directory/directory.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua b/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua index b0528eb9f1..09384dffd0 100644 --- a/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua +++ b/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua @@ -34,12 +34,16 @@ --get the action action = params:getHeader("action"); purpose = params:getHeader("purpose"); - --sip_auth - registration - --group_call - call group has been called - --user_call - user has been called + --sip_auth - registration + --group_call - call group has been called + --user_call - user has been called --additional information - --event_calling_function = params:getHeader("Event-Calling-Function"); + --event_calling_function = params:getHeader("Event-Calling-Function"); + +--set the variables as a string to prevent nil errors + number_alias = ""; + number_alias_string = ""; --determine the correction action to perform if (purpose == "gateways") then @@ -194,8 +198,6 @@ if (string.len(row.cidr) > 0) then cidr = [[ cidr="]] .. row.cidr .. [["]]; end - number_alias = ""; - number_alias_string = ""; if (string.len(row.number_alias) > 0) then number_alias = row.number_alias; number_alias_string = [[ number-alias="]] .. row.number_alias .. [["]]; @@ -262,8 +264,8 @@ --get the voicemail from the database if (continue) then vm_enabled = "true"; - if (tonumber(user) == nil) then - sql = "SELECT * FROM v_voicemails WHERE domain_uuid = '" .. domain_uuid .. "' and voicemail_id = '" .. number_alias .. "' "; + if tonumber(user) == nil then + sql = "SELECT * FROM v_voicemails WHERE domain_uuid = '" .. domain_uuid .. "' and voicemail_id = '" .. number_alias .. "' "; else sql = "SELECT * FROM v_voicemails WHERE domain_uuid = '" .. domain_uuid .. "' and voicemail_id = '" .. user .. "' "; end