summaryrefslogtreecommitdiffstats
path: root/config/templates/linksysata-template.lua
blob: a8f90221a0ddee1131ee6c1b5cf1cdd341e3ed9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<%
-- Linksys ATA Configuration File Template
local values = ...
server=values.device.registrar
web_server=string.gsub(ENV['HTTP_HOST'], ":[0-9]*$", "")
moh=values.device.musiconhold
dialpattern="( " .. values.device.digitmap .. " )"

local cid
if values.reg1.callerid == "" then
	cid = values.reg1.extension
else
	cid = values.reg1.callerid
end
%>

<% local values = ... %>

<%

local function yesno ( bool )
	if bool then
		return "Yes"
	else
		return "No"
	end
end
%>

<flat-profile>

<Admin_Passwd ua="na"><%= values.device.adminpassword %></Admin_Passwd>
<User_Password ua="na"><%= values.device.adminpassword %></User_Password>

<HostName ua="na"><% io.write(values.reg1.extension) %></HostName>

<Syslog_Server ua="na"><%= web_server %></Syslog_Server>
<Debug_Server ua="na"><%= web_server %></Debug_Server>

<Line_Enable_1_ ua="na">Yes</Line_Enable_1_>
<MOH_Server_1_ ua="na"><% io.write(moh) %></MOH_Server_1_>
<Proxy_1_ ua="na"><% io.write(server) %></Proxy_1_>
<Register_1_ ua="na">Yes</Register_1_>
<Make_Call_Without_Reg_1_ ua="na">No</Make_Call_Without_Reg_1_>

<Display_Name_1_ ua="na"><%= cid %></Display_Name_1_>
<User_ID_1_ ua="na"><% io.write(values.reg1.extension) %></User_ID_1_>
<Password_1_ ua="na"><% io.write(values.reg1.password) %></Password_1_>

<Call_Waiting_Serv_1_ ua="na"><%= yesno(values.services and values.services.callwaitingenable) %></Call_Waiting_Serv_1_>

<Dial_Plan_1_ ua="na"><% io.write(dialpattern) %></Dial_Plan_1_>

<%
	if values.services and values.services.forwarding and values.reg1 then
		local pg_t = values.reg1
		local fwddata = {}

		if pg_t.forwardallenable then
			fwddata.all = pg_t.forwardall
		else
			fwddata.all = ""
		end
		if pg_t.forwardbusyenable then
			fwddata.busy = pg_t.forwardbusy
		else
			fwddata.busy = ""
		end
		if pg_t.forwardnoanswerenable then
			fwddata.noanswer = pg_t.forwardnoanswer
			fwddata.noanswerdelay = "20"
		else
			fwddata.noanswer = ""
			fwddata.noanswerdelay = ""
		end
%>
<Cfwd_All_Dest_1_ ua="na"><%= fwddata.all %></Cfwd_All_Dest_1_>
<Cfwd_Busy_Dest_1_ ua="na"><%= fwddata.busy %></Cfwd_Busy_Dest_1_>
<Cfwd_No_Ans_Dest_1_ ua="na"><%= fwddata.noanswer %></Cfwd_No_Ans_Dest_1_>
<Cfwd_No_Ans_Delay_1_ ua="na"><%= fwddata.noanswerdelay %></Cfwd_No_Ans_Delay_1_>
<%
	end
%>

</flat-profile>