From 73487121b25df0b3f20666f4ee00b80db3b0081d Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Thu, 10 Nov 2011 15:57:23 +0000 Subject: Some minor error checking in snom template --- config/templates/snom-template.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/config/templates/snom-template.lua b/config/templates/snom-template.lua index a299054..dc56f18 100644 --- a/config/templates/snom-template.lua +++ b/config/templates/snom-template.lua @@ -66,7 +66,7 @@ end xml_elem('block_url_dialing', not values.device.urldialingenable, 'R') xml_elem('call_waiting', values.services.callwaitingenable, 'R') -if values.services.mailbox ~= "" then +if values.services and values.services.mailbox and values.services.mailbox ~= "" then xml_elem('user_mailbox', 'sip:'..values.services.mailbox, 'R') else xml_elem('user_mailbox', '', 'R') @@ -86,8 +86,8 @@ else xml_elem('redirect_on_timeout', false, 'RW') end -if values.services and values.services.hotlineenable then - xml_elem('action_offhook_url', 'http://127.0.0.1/command.htm?number='..values.services.hotlinedestinaion, 'R') +if values.services and values.services.hotlineenable and values.services.hotlinedestination and values.services.hotlinedestination ~= "" then + xml_elem('action_offhook_url', 'http://127.0.0.1/command.htm?number='..values.services.hotlinedestination, 'R') else xml_elem('action_offhook_url', '', 'R') end @@ -149,7 +149,9 @@ for pg, pg_t in pairs(values) do xml_elem('record_missed_calls', values.services.callhistoryenable, 'R', num) xml_elem('record_received_calls', values.services.callhistoryenable, 'R', num) xml_elem('user_host', values.device.registrar, 'R', num ) - xml_elem('user_moh', 'sip:'..values.device.musiconhold, 'R', num) + if values.device.musiconhold and values.device.musiconhold ~= "" then + xml_elem('user_moh', 'sip:'..values.device.musiconhold, 'R', num) + end xml_elem('user_name', pg_t.extension, 'R', num) xml_elem('user_outbound', values.device.registrar, 'R', num) xml_elem('user_pass', pg_t.password, 'R', num) -- cgit v1.2.3