Minor formatting change to test a mantis change ...
[asterisk-bristuff.git] / configs / extensions.lua.sample
bloba6ae60ca684390e10854348c86d29f451b0ca127
3 CONSOLE = "Console/dsp" -- Console interface for demo
4 --CONSOLE = "Zap/1"
5 --CONSOLE = "Phone/phone0"
7 IAXINFO = "guest"       -- IAXtel username/password
8 --IAXINFO = "myuser:mypass"
10 TRUNK = "Zap/G2"
11 TRUNKMSD = 1
12 -- TRUNK = "IAX2/user:pass@provider"
16 -- Extensions are expected to be defined in a global table named 'extensions'.
17 -- The 'extensions' table should have a group of tables in it, each
18 -- representing a context.  Extensions are defined in each context.  See below
19 -- for examples.
21 -- This file can be automatically included in the extensions.conf file using
22 -- the 'utils/build-extensions-conf.lua' script and a #exec statement in
23 -- extensions.conf.
25 --   #exec /usr/bin/utils/build-extensions.conf.lua -c
26 -- 
27 -- The 'execincludes' option must be set to 'yes' in the [options] section of
28 -- asterisk.conf for this to work properly.
29 -- 
30 -- Extension names may be numbers, letters, or combinations thereof. If
31 -- an extension name is prefixed by a '_' character, it is interpreted as
32 -- a pattern rather than a literal.  In patterns, some characters have
33 -- special meanings:
34 --                                                                           
35 --   X - any digit from 0-9
36 --   Z - any digit from 1-9
37 --   N - any digit from 2-9
38 --   [1235-9] - any digit in the brackets (in this example, 1,2,3,5,6,7,8,9)
39 --   . - wildcard, matches anything remaining (e.g. _9011. matches 
40 --       anything starting with 9011 excluding 9011 itself)
41 --   ! - wildcard, causes the matching process to complete as soon as
42 --       it can unambiguously determine that no other matches are possible
43 --                                                                           
44 -- For example the extension _NXXXXXX would match normal 7 digit
45 -- dialings, while _1NXXNXXXXXX would represent an area code plus phone
46 -- number preceded by a one.
47 -- 
48 -- If your extension has special characters in it such as '.' and '!' you must
49 -- explicitly make it a string in the tabale definition:
51 --   ["_special."] = function;
52 --   ["_special!"] = function;
54 -- There are no priorities.  All extensions to asterisk appear to have a single
55 -- priority as if they consist of a single priority.
56 -- 
57 -- Each context is defined as a table in the extensions table.  The
58 -- context names should be strings.
60 -- One context may be included in another context using the 'includes'
61 -- extension.  This extension should be set to a table containing a list
62 -- of context names.  Do not put references to tables in the includes
63 -- table.
64 -- 
65 --   include = {"a", "b", "c"};
67 -- Channel variables can be accessed thorugh the global 'channel' table.
69 --   v = channel.var_name
70 --   v = channel["var_name"]
71 --   v.value
72 --   v:get()
74 --   channel.var_name = "value"
75 --   channel["var_name"] = "value"
76 --   v:set("value")
78 --   channel.func_name(1,2,3):set("value")
79 --   value = channel.func_name(1,2,3):get()
81 --   channel["func_name(1,2,3)"]:set("value")
82 --   channel["func_name(1,2,3)"] = "value"
83 --   value = channel["func_name(1,2,3)"]:get()
85 -- Note the use of the ':' operator to access the get() and set()
86 -- methods.
88 -- Also notice the absence of the following constructs from the examples above:
89 --   channel.func_name(1,2,3) = "value"  -- this will NOT work
90 --   value = channel.func_name(1,2,3)    -- this will NOT work as expected
91 -- 
93 -- Dialplan applications can be accessed through the global 'app' table.
95 --    app.Dial("Zap/1")
96 --    app.dial("Zap/1")
98 -- More examples can be found below.
100 -- Before starting long running operations, an autoservice should be started
101 -- using the autoservice_start() function.  This autoservice will automatically
102 -- be stopped before executing applications and dialplan functions and will be
103 -- restarted afterwards.  The autoservice can be stopped using
104 -- autoservice_stop() and the autoservice_status() function will return true if
105 -- an autoservice is currently running.
108 function outgoing_local(c, e)
109         app.dial("zap/1/" .. e, "", "")
112 function demo_instruct()
113         app.background("demo-instruct")
114         app.waitexten()
117 function demo_congrats()
118         app.background("demo-congrats")
119         demo_instruct()
122 -- Answer the chanel and play the demo sound files
123 function demo_start(context, exten)
124         app.wait(1)
125         app.answer()
127         channel.TIMEOUT("digit"):set(5)
128         channel.TIMEOUT("response"):set(10)
129         -- app.set("TIMEOUT(digit)=5")
130         -- app.set("TIMEOUT(response)=10")
132         demo_congrats(context, exten)
135 function demo_hangup()
136         app.playback("demo-thanks")
137         app.hangup()
140 extensions = {
141         demo = {
142                 s = demo_start;
144                 ["2"] = function()
145                         app.background("demo-moreinfo")
146                         demo_instruct()
147                 end;
148                 ["3"] = function ()
149                         channel.LANGUAGE():set("fr") -- set the language to french
150                         demo_congrats()
151                 end;
153                 ["1000"] = function()
154                         app.goto("default", "s", 1)
155                 end;
157                 ["1234"] = function()
158                         app.playback("transfer", "skip")
159                         -- do a dial here
160                 end;
162                 ["1235"] = function()
163                         app.voicemail("1234", "u")
164                 end;
166                 ["1236"] = function()
167                         app.dial("Console/dsp")
168                         app.voicemail(1234, "b")
169                 end;
171                 ["#"] = demo_hangup;
172                 t = demo_hangup;
173                 i = function()
174                         app.playback("invalid")
175                         demo_instruct()
176                 end;
178                 ["500"] = function()
179                         app.playback("demo-abouttotry")
180                         app.dial("IAX2/guest@misery.digium.com/s@default")
181                         app.playback("demo-nogo")
182                         demo_instruct()
183                 end;
185                 ["600"] = function()
186                         app.playback("demo-echotest")
187                         app.echo()
188                         app.playback("demo-echodone")
189                         demo_instruct()
190                 end;
192                 ["8500"] = function()
193                         app.voicemailmain()
194                         demo_instruct()
195                 end;
197         };
199         default = {
200                 -- by default, do the demo
201                 include = {"demo"};
202         };
204         ["local"] = {
205                 ["_NXXXXXX"] = outgoing_local;
206         };