summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2011-11-10 15:57:23 +0000
committerTed Trask <ttrask01@yahoo.com>2011-11-10 15:57:23 +0000
commit73487121b25df0b3f20666f4ee00b80db3b0081d (patch)
tree2802855688dd564b1a7caaf704027735ee1c772a
parentb810c3882b85d886676caabc112c58b8d19f9172 (diff)
downloadacf-provisioning-73487121b25df0b3f20666f4ee00b80db3b0081d.tar.bz2
acf-provisioning-73487121b25df0b3f20666f4ee00b80db3b0081d.tar.xz
Some minor error checking in snom template
-rw-r--r--config/templates/snom-template.lua10
1 files 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)