3 CONSOLE = "Console/dsp" -- Console interface for demo
5 --CONSOLE = "Phone/phone0"
7 IAXINFO = "guest" -- IAXtel username/password
8 --IAXINFO = "myuser:mypass"
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
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
25 -- #exec /usr/bin/utils/build-extensions.conf.lua -c
27 -- The 'execincludes' option must be set to 'yes' in the [options] section of
28 -- asterisk.conf for this to work properly.
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
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
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.
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.
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
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"]
74 -- channel.var_name = "value"
75 -- channel["var_name"] = "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()
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
93 -- Dialplan applications can be accessed through the global 'app' table.
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")
117 function demo_congrats()
118 app.background("demo-congrats")
122 -- Answer the chanel and play the demo sound files
123 function demo_start(context, exten)
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")
145 app.background("demo-moreinfo")
149 channel.LANGUAGE():set("fr") -- set the language to french
153 ["1000"] = function()
154 app.goto("default", "s", 1)
157 ["1234"] = function()
158 app.playback("transfer", "skip")
162 ["1235"] = function()
163 app.voicemail("1234", "u")
166 ["1236"] = function()
167 app.dial("Console/dsp")
168 app.voicemail(1234, "b")
174 app.playback("invalid")
179 app.playback("demo-abouttotry")
180 app.dial("IAX2/guest@misery.digium.com/s@default")
181 app.playback("demo-nogo")
186 app.playback("demo-echotest")
188 app.playback("demo-echodone")
192 ["8500"] = function()
200 -- by default, do the demo
205 ["_NXXXXXX"] = outgoing_local;