summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-pbx/luasrc
diff options
context:
space:
mode:
authorIordan Iordanov <iiordanov@gmail.com>2013-03-09 22:52:53 +0000
committerIordan Iordanov <iiordanov@gmail.com>2013-03-09 22:52:53 +0000
commita0183b2f75a772366336671a818707df3dc04e79 (patch)
treea93c028a0b361fd1181a5c4b3ce9d3afbbae8d6d /applications/luci-pbx/luasrc
parent7021120936575df16a3af6606399504d42e73531 (diff)
- added beep.gsm
- now escaping special characters in pbx-asterisk - changed location of voicemail temp stuff and log file - changed pbx-send-voicemail to use base64 instead of uuencode - added many missing dependencies - now allowing ip addresses as well as hostnames for external host - constrained # seconds to ring to positive integers - specifying externrefresh in sip.conf template - fixed voicemail (sending recordings, recording new greeting, instructions) - Implemented callback
Diffstat (limited to 'applications/luci-pbx/luasrc')
-rw-r--r--applications/luci-pbx/luasrc/model/cbi/pbx-advanced.lua16
-rw-r--r--applications/luci-pbx/luasrc/model/cbi/pbx-calls.lua85
2 files changed, 87 insertions, 14 deletions
diff --git a/applications/luci-pbx/luasrc/model/cbi/pbx-advanced.lua b/applications/luci-pbx/luasrc/model/cbi/pbx-advanced.lua
index 4f1034019f..5d4f135c5b 100644
--- a/applications/luci-pbx/luasrc/model/cbi/pbx-advanced.lua
+++ b/applications/luci-pbx/luasrc/model/cbi/pbx-advanced.lua
@@ -250,6 +250,7 @@ s:tab("qos", translate("QoS Settings"),
ringtime = s:taboption("general", Value, "ringtime", translate("Number of Seconds to Ring"),
translate("Set the number of seconds to ring users upon incoming calls before hanging up \
or going to voicemail, if the voicemail is installed and enabled."))
+ringtime.datatype = "port"
ringtime.default = 30
ua = s:taboption("general", Value, "useragent", translate("User Agent String"),
@@ -259,17 +260,18 @@ ua = s:taboption("general", Value, "useragent", translate("User Agent String"),
ua.default = appname
h = s:taboption("remote_usage", Value, "externhost", translate("Domain/IP Address/Dynamic Domain"),
- translate("You can enter your domain name, external IP address, or dynamic domain name here \
- Please keep in mind that if your IP address is dynamic and it changes your configuration \
- will become invalid. Hence, it's recommended to set up Dynamic DNS in this case."))
-h.datatype = "hostname"
+ translate("You can enter your domain name, external IP address, or dynamic domain name here. \
+ The best thing to input is a static IP address. If your IP address is dynamic and it changes, \
+ your configuration will become invalid. Hence, it's recommended to set up Dynamic DNS in this case. \
+ and enter your Dynamic DNS hostname here. You can configure Dynamic DNS with the luci-app-ddns package."))
+h.datatype = "host"
p = s:taboption("remote_usage", Value, "bindport", translate("External SIP Port"),
translate("Pick a random port number between 6500 and 9500 for the service to listen on. \
Do not pick the standard 5060, because it is often subject to brute-force attacks. \
- When finished, (1) click \"Save and Apply\", and (2) click the \"Restart VoIP Service\" \
- button above. Finally, (3) look in the \"SIP Device/Softphone Accounts\" section for \
- updated Server and Port settings for your SIP Devices/Softphones."))
+ When finished, (1) click \"Save and Apply\", and (2) look in the \
+ \"SIP Device/Softphone Accounts\" section for updated Server and Port settings \
+ for your SIP Devices/Softphones."))
p.datatype = "port"
p = s:taboption("remote_usage", Value, "rtpstart", translate("RTP Port Range Start"),
diff --git a/applications/luci-pbx/luasrc/model/cbi/pbx-calls.lua b/applications/luci-pbx/luasrc/model/cbi/pbx-calls.lua
index d4f21cdcc3..ca373d63a3 100644
--- a/applications/luci-pbx/luasrc/model/cbi/pbx-calls.lua
+++ b/applications/luci-pbx/luasrc/model/cbi/pbx-calls.lua
@@ -150,7 +150,7 @@ for k,v in pairs(validoutaccounts) do
patterns = s:option(DynamicList, k, v)
-- If the saved field is empty, we return a string
- -- telling the user that this account would dial any exten.
+ -- telling the user that this provider would dial any exten.
function patterns.cfgvalue(self, section)
value = self.map:get(section, self.option)
@@ -200,8 +200,8 @@ s.anonymous = true
for k,v in pairs(validinaccounts) do
users = s:option(DynamicList, k, v)
- -- If the saved field is empty, we return a string
- -- telling the user that this account would dial any exten.
+ -- If the saved field is empty, we return a string telling the user that
+ -- this provider would ring all users configured for incoming calls.
function users.cfgvalue(self, section)
value = self.map:get(section, self.option)
@@ -253,8 +253,8 @@ s.anonymous = true
for k,v in pairs(validoutusers) do
providers = s:option(DynamicList, k, k)
- -- If the saved field is empty, we return a string
- -- telling the user that this account would dial any exten.
+ -- If the saved field is empty, we return a string telling the user
+ -- that this user uses all providers enavled for outgoing calls.
function providers.cfgvalue(self, section)
value = self.map:get(section, self.option)
@@ -289,11 +289,64 @@ end
----------------------------------------------------------------------------------------------------
s = m:section(TypedSection, "callthrough_numbers", translate("Call-through Numbers"),
translate("Designate numbers that are allowed to call through this system and which user's \
- privileges it will have."))
+ privileges they will have."))
+s.anonymous = true
+s.addremove = true
+
+num = s:option(DynamicList, "callthrough_number_list", translate("Call-through Numbers"),
+ translate("Specify numbers individually here. Press enter to add more numbers. \
+ You will have to experiment with what country and area codes you need to add \
+ to the number."))
+num.datatype = "uinteger"
+
+p = s:option(ListValue, "enabled", translate("Enabled"))
+p:value("yes", translate("Yes"))
+p:value("no", translate("No"))
+p.default = "yes"
+
+user = s:option(Value, "defaultuser", translate("User Name"),
+ translate("The number(s) specified above will be able to dial out with this user's providers. \
+ Invalid usernames, including users not enabled for outgoing calls, are dropped silently. \
+ Please verify that the entry was accepted."))
+function user.write(self, section, value)
+ trimuser = luci.util.trim(value)
+ if allvalidusers[trimuser] == true then
+ Value.write(self, section, trimuser)
+ end
+end
+
+pwd = s:option(Value, "pin", translate("PIN"),
+ translate("Your PIN disappears when saved for your protection. It will be changed \
+ only when you enter a value different from the saved one. Leaving the PIN \
+ empty is possible, but please beware of the security implications."))
+pwd.password = true
+pwd.rmempty = false
+
+-- We skip reading off the saved value and return nothing.
+function pwd.cfgvalue(self, section)
+ return ""
+end
+
+-- We check the entered value against the saved one, and only write if the entered value is
+-- something other than the empty string, and it differes from the saved value.
+function pwd.write(self, section, value)
+ local orig_pwd = m:get(section, self.option)
+ if value and #value > 0 and orig_pwd ~= value then
+ Value.write(self, section, value)
+ end
+end
+
+----------------------------------------------------------------------------------------------------
+s = m:section(TypedSection, "callback_numbers", translate("Call-back Numbers"),
+ translate("Designate numbers to whom the system will hang up and call back, which provider will \
+ be used to call them, and which user's privileges will be granted to them."))
s.anonymous = true
s.addremove = true
-num = s:option(DynamicList, "callthrough_number_list", translate("Call-through Numbers"))
+num = s:option(DynamicList, "callback_number_list", translate("Call-back Numbers"),
+ translate("Specify numbers individually here. Press enter to add more numbers. \
+ You will have to experiment with what country and area codes you need to add \
+ to the number."))
num.datatype = "uinteger"
p = s:option(ListValue, "enabled", translate("Enabled"))
@@ -301,6 +354,13 @@ p:value("yes", translate("Yes"))
p:value("no", translate("No"))
p.default = "yes"
+delay = s:option(Value, "callback_hangup_delay", translate("Hang-up Delay"),
+ translate("How long to wait before hanging up. If the provider you use to dial automatically forwards \
+ to voicemail, you can set this value to a delay that will allow you to hang up before your call gets \
+ forwarded and you get billed for it."))
+delay.datatype = "uinteger"
+delay.default = 0
+
user = s:option(Value, "defaultuser", translate("User Name"),
translate("The number(s) specified above will be able to dial out with this user's providers. \
Invalid usernames, including users not enabled for outgoing calls, are dropped silently. \
@@ -333,6 +393,17 @@ function pwd.write(self, section, value)
end
end
+provider = s:option(Value, "callback_provider", translate("Call-back Provider"),
+ translate("Enter a VoIP provider to use for call-back in the format username@some.host.name, as listed in \
+ \"Outgoing Calls\" above. It's easiest to copy and paste the providers from above. Invalid entries, including \
+ providers not enabled for outgoing calls, will be rejected silently."))
+function provider.write(self, section, value)
+ cooked = string.gsub(luci.util.trim(value), "%W", "_")
+ if validoutaccounts[cooked] ~= nil then
+ Value.write(self, section, value)
+ end
+end
+
----------------------------------------------------------------------------------------------------
s = m:section(NamedSection, "blacklisting", "call_routing", translate("Blacklisted Numbers"),
translate("Enter phone numbers that you want to decline calls from automatically. \