asterisk-dialplans.lua 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. -- Copyright 2008 Steven Barth <steven@midlink.org>
  2. -- Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
  3. -- Licensed to the public under the Apache License 2.0.
  4. cbimap = Map("asterisk", "asterisk", "")
  5. dialplan = cbimap:section(TypedSection, "dialplan", "Section dialplan", "")
  6. dialplan.addremove = true
  7. dialplan.dynamic = true
  8. include = dialplan:option(MultiValue, "include", "Include zones and plans", "")
  9. cbimap.uci:foreach( "asterisk", "dialplan", function(s) include:value(s['.name']) end )
  10. cbimap.uci:foreach( "asterisk", "dialzone", function(s) include:value(s['.name']) end )
  11. dialplanexten = cbimap:section(TypedSection, "dialplanexten", "Dialplan Extension", "")
  12. dialplanexten.anonymous = true
  13. dialplanexten.addremove = true
  14. dialplanexten.dynamic = true
  15. dialplangeneral = cbimap:section(TypedSection, "dialplangeneral", "Dialplan General Options", "")
  16. dialplangeneral.anonymous = true
  17. dialplangeneral.addremove = true
  18. allowtransfer = dialplangeneral:option(Flag, "allowtransfer", "Allow transfer", "")
  19. allowtransfer.rmempty = true
  20. canreinvite = dialplangeneral:option(ListValue, "canreinvite", "Reinvite/redirect media connections", "")
  21. canreinvite:value("yes", "Yes")
  22. canreinvite:value("nonat", "Yes when not behind NAT")
  23. canreinvite:value("update", "Use UPDATE rather than INVITE for path redirection")
  24. canreinvite:value("no", "No")
  25. canreinvite.rmempty = true
  26. clearglobalvars = dialplangeneral:option(Flag, "clearglobalvars", "Clear global vars", "")
  27. clearglobalvars.rmempty = true
  28. dialplangoto = cbimap:section(TypedSection, "dialplangoto", "Dialplan Goto", "")
  29. dialplangoto.anonymous = true
  30. dialplangoto.addremove = true
  31. dialplangoto.dynamic = true
  32. dialplanmeetme = cbimap:section(TypedSection, "dialplanmeetme", "Dialplan Conference", "")
  33. dialplanmeetme.anonymous = true
  34. dialplanmeetme.addremove = true
  35. dialplanmeetme.dynamic = true
  36. dialplansaytime = cbimap:section(TypedSection, "dialplansaytime", "Dialplan Time", "")
  37. dialplansaytime.anonymous = true
  38. dialplansaytime.addremove = true
  39. dialplansaytime.dynamic = true
  40. dialplanvoice = cbimap:section(TypedSection, "dialplanvoice", "Dialplan Voicemail", "")
  41. dialplanvoice.anonymous = true
  42. dialplanvoice.addremove = true
  43. dialplanvoice.dynamic = true
  44. dialzone = cbimap:section(TypedSection, "dialzone", "Dial Zones for Dialplan", "")
  45. dialzone.addremove = true
  46. dialzone.template = "cbi/tblsection"
  47. addprefix = dialzone:option(Value, "addprefix", "Prefix to add matching dialplans", "")
  48. addprefix.rmempty = true
  49. --international = dialzone:option(DynamicList, "international", "Match International prefix", "")
  50. international = dialzone:option(Value, "international", "Match International prefix", "")
  51. international.rmempty = true
  52. localprefix = dialzone:option(Value, "localprefix", "Prefix (0) to add/remove to/from intl. numbers", "")
  53. localprefix.rmempty = true
  54. localzone = dialzone:option(Value, "localzone", "Dialzone for intl. numbers matched as local", "")
  55. localzone.titleref = luci.dispatcher.build_url( "admin", "services", "asterisk", "dialplans" )
  56. cbimap.uci:foreach( "asterisk", "dialplan", function(s) localzone:value(s['.name']) end )
  57. cbimap.uci:foreach( "asterisk", "dialzone", function(s) localzone:value(s['.name']) end )
  58. match = dialzone:option(Value, "match", "Match plan", "")
  59. match.rmempty = true
  60. uses = dialzone:option(ListValue, "uses", "Connection to use", "")
  61. uses.titleref = luci.dispatcher.build_url( "admin", "services", "asterisk", "sip-conns" )
  62. cbimap.uci:foreach( "asterisk", "sip", function(s) uses:value('SIP/'..s['.name']) end )
  63. cbimap.uci:foreach( "asterisk", "iax", function(s) uses:value('IAX/'..s['.name']) end )
  64. return cbimap