| 1 |
; |
| 2 |
; AMI - The Asterisk Manager Interface |
| 3 |
; |
| 4 |
; Third party application call management support and PBX event supervision |
| 5 |
; |
| 6 |
; Use the "manager show commands" at the CLI to list available manager commands |
| 7 |
; and their authorization levels. |
| 8 |
; |
| 9 |
; "manager show command <command>" will show a help text. |
| 10 |
; |
| 11 |
; ---------------------------- SECURITY NOTE ------------------------------- |
| 12 |
; Note that you should not enable the AMI on a public IP address. If needed, |
| 13 |
; block this TCP port with iptables (or another FW software) and reach it |
| 14 |
; with IPsec, SSH, or SSL vpn tunnel. You can also make the manager |
| 15 |
; interface available over http/https if Asterisk's http server is enabled in |
| 16 |
; http.conf and if both "enabled" and "webenabled" are set to yes in |
| 17 |
; this file. Both default to no. httptimeout provides the maximum |
| 18 |
; timeout in seconds before a web based session is discarded. The |
| 19 |
; default is 60 seconds. |
| 20 |
; |
| 21 |
[general] |
| 22 |
enabled = no |
| 23 |
;webenabled = yes |
| 24 |
|
| 25 |
port = 5038 |
| 26 |
bindaddr = 0.0.0.0 |
| 27 |
|
| 28 |
; Parameters that control AMI over TLS. ("enabled" must be set too). |
| 29 |
; You can open a connection to this socket with e.g. |
| 30 |
; |
| 31 |
; openssl s_client -connect my_host:5039 |
| 32 |
; |
| 33 |
;tlsenable=no ; set to YES to enable it |
| 34 |
;tlsbindaddr=0.0.0.0:5039 ; address and port to bind to, default to bindaddr and port 5039 |
| 35 |
;tlscertfile=/tmp/asterisk.pem ; path to the certificate. |
| 36 |
;tlsprivatekey=/tmp/private.pem ; path to the private key, if no private given, |
| 37 |
; if no tlsprivatekey is given, default is to search |
| 38 |
; tlscertfile for private key. |
| 39 |
;tlscipher=<cipher string> ; string specifying which SSL ciphers to use or not use |
| 40 |
; |
| 41 |
;allowmultiplelogin = yes ; IF set to no, rejects manager logins that are already in use. |
| 42 |
; ; The default is yes. |
| 43 |
; |
| 44 |
;displayconnects = yes |
| 45 |
; |
| 46 |
; Add a Unix epoch timestamp to events (not action responses) |
| 47 |
; |
| 48 |
;timestampevents = yes |
| 49 |
|
| 50 |
;brokeneventsaction = yes ; Restore previous behavior that caused the events |
| 51 |
; action to not return a response in certain |
| 52 |
; circumstances. Defaults to 'no'. |
| 53 |
|
| 54 |
; |
| 55 |
; Display certain channel variables every time a channel-oriented |
| 56 |
; event is emitted: |
| 57 |
; |
| 58 |
; Note that this does incur a performance penalty and should be avoided if possible. |
| 59 |
; |
| 60 |
;channelvars = var1,var2,var3 |
| 61 |
|
| 62 |
; debug = on ; enable some debugging info in AMI messages (default off). |
| 63 |
; Also accessible through the "manager debug" CLI command. |
| 64 |
|
| 65 |
; authtimeout specifies the maximum number of seconds a client has to |
| 66 |
; authenticate. If the client does not authenticate beofre this timeout |
| 67 |
; expires, the client will be disconnected. (default: 30 seconds) |
| 68 |
|
| 69 |
;authtimeout = 30 |
| 70 |
|
| 71 |
; authlimit specifies the maximum number of unauthenticated sessions that will |
| 72 |
; be allowed to connect at any given time. |
| 73 |
|
| 74 |
;authlimit = 50 |
| 75 |
|
| 76 |
;httptimeout = 60 |
| 77 |
; a) httptimeout sets the Max-Age of the http cookie |
| 78 |
; b) httptimeout is the amount of time the webserver waits |
| 79 |
; on a action=waitevent request (actually its httptimeout-10) |
| 80 |
; c) httptimeout is also the amount of time the webserver keeps |
| 81 |
; a http session alive after completing a successful action |
| 82 |
; |
| 83 |
; disabledevents specifies AMI events which should be completely globally disabled. |
| 84 |
; These events will not be available to any AMI listeners. Use this to disable |
| 85 |
; frequent events which are not desired for any listeners. Default |
| 86 |
; is no events are globally disabled. Event names are case-sensitive. |
| 87 |
; Events disabled in stasis.conf do not also need to be disabled here. |
| 88 |
; If you don't want to completely disable an AMI event, also consider the |
| 89 |
; filter option available on a per-manager user basis to block unwanted |
| 90 |
; events from being received in a stream (as opposed to this option which |
| 91 |
; would prevent specified events from being generated at all). |
| 92 |
|
| 93 |
;disabledevents = Newexten,VarSet |
| 94 |
|
| 95 |
;[mark] |
| 96 |
;secret = mysecret |
| 97 |
;deny=0.0.0.0/0.0.0.0 |
| 98 |
;permit=209.16.236.73/255.255.255.0 |
| 99 |
;acl=named_acl_example ; use a named ACL from acl.conf |
| 100 |
; |
| 101 |
; |
| 102 |
;setvar=PBXACCOUNT=edvina |
| 103 |
; The setvar option defines channel variables that will be set when this account |
| 104 |
; originates a call. You can define multiple setvar= commands for one manager |
| 105 |
; user. |
| 106 |
; |
| 107 |
|
| 108 |
;-- |
| 109 |
-- eventfilter -------------------------------------------------------- |
| 110 |
Include and/or exclude events for this user. |
| 111 |
|
| 112 |
There are two ways to use this feature... Legacy and Advanced. |
| 113 |
|
| 114 |
Legacy Event Filtering: |
| 115 |
|
| 116 |
This is the original method of filtering events. It's no longer |
| 117 |
recommended but still supported for backwards compatibility. The filter |
| 118 |
is a regular expression, optionally prefixed with an exclamation point (!). |
| 119 |
The regular expression is applied to the entire payload of every event. |
| 120 |
If any part of the event payload matches, the event is included. If the |
| 121 |
first character of the filter is an exclamation point (!), the event is |
| 122 |
excluded. On a busy system, this is a resource intensive process and the |
| 123 |
reason it's no longer recommended. |
| 124 |
|
| 125 |
Another issue with legacy filtering is that regexes are very sensitive to |
| 126 |
whitespace and separators. "Event:Newchannel" will NOT work because of |
| 127 |
the missing space after the ':'. Neither will "Event: Newchannel" or |
| 128 |
"Event Newchannel" because of the extra space in the first expression |
| 129 |
and the missing ':' in the second. |
| 130 |
|
| 131 |
Advanced Event Filtering: |
| 132 |
|
| 133 |
Advanced filtering still allows you to use regular expressions but adds |
| 134 |
the ability to pre-select certain events and constrain the regular |
| 135 |
expression to matching the contents of a specific event header. |
| 136 |
The syntax is: |
| 137 |
|
| 138 |
eventfilter(<match_criteria>) = [ <match_expression> ] |
| 139 |
|
| 140 |
<match_criteria> : [ action(include|exclude) | name(<event_name>) | |
| 141 |
header(<header_name>) | method(<match_method>) ][, ...] |
| 142 |
|
| 143 |
You can specify at most one of each of the following in any order, |
| 144 |
separated by commas. |
| 145 |
|
| 146 |
action(include|exclude): Default: 'include'. Instead of using '!' to |
| 147 |
exclude matching events, specify 'action(exclude)'. Although the |
| 148 |
default is "include" if "action" isn't specified, adding |
| 149 |
"action(include)" will help with readability. |
| 150 |
|
| 151 |
name(<event_name>): Include only events with a name exactly matching |
| 152 |
<event_name>. This is actually implemented using the "hash" of the |
| 153 |
event names and is therefore much more efficient than using a regular |
| 154 |
expression. |
| 155 |
|
| 156 |
header(<header_name>): Include only events that have a header exactly |
| 157 |
matching <header_name>. Additionally, the data to be searched will |
| 158 |
be constrained to the value of this header instead of the entire |
| 159 |
event payload. |
| 160 |
|
| 161 |
method(regex | exact | starts_with | ends_with | contains | none ): |
| 162 |
How should <match_expression> be applied to the event data? The data may |
| 163 |
be the entire event payload or, if header(<header_name>) was used, the |
| 164 |
value of that specific header. If 'action(exclude)' was specified, a |
| 165 |
"match" here will cause the event to be excluded instead of included. |
| 166 |
|
| 167 |
regex: As a regular expression that, if matched anywhere in the |
| 168 |
data, constitutes a match. |
| 169 |
|
| 170 |
exact: As a simple string that must match all of the data. |
| 171 |
Probably only useful when the data is constrained to a specific header |
| 172 |
and the data itself is a simple value. |
| 173 |
|
| 174 |
starts_with: As a simple string that, if found at the beginning of the |
| 175 |
data, constitutes a match. |
| 176 |
|
| 177 |
ends_with: As a simple string that, if found at the end of the data, |
| 178 |
constitutes a match. |
| 179 |
|
| 180 |
contains: As a simple string that, if found anywhere in the data, |
| 181 |
constitutes a match. |
| 182 |
|
| 183 |
none: Ignore <match_expression> altogether. This is the default |
| 184 |
because the majority of use cases for event filtering involve |
| 185 |
including or excluding events by event name without regard to the |
| 186 |
event payload. In this case, you can just leave <match_expression> |
| 187 |
empty. |
| 188 |
|
| 189 |
TIP: Although match criteria order doesn't matter to Asterisk, using the |
| 190 |
order shown can help you read them. For instance... |
| 191 |
eventfilter(action(exclude),name(Newchannel),header(Channel),method(starts_with)) = Local/ |
| 192 |
...means "Exclude Newchannel events with a Channel header that starts with Local/" |
| 193 |
|
| 194 |
Event Filter Processing Ordering: |
| 195 |
|
| 196 |
Both Legacy and Advanced filter entries are processed as follows: |
| 197 |
- If no filters are configured, all events are reported as normal. |
| 198 |
|
| 199 |
- If there are 'include' filters only, an event that matches ANY filter |
| 200 |
will be reported. |
| 201 |
|
| 202 |
- If there are 'exclude' filters only, an event that matched ANY filter |
| 203 |
will be excluded. |
| 204 |
|
| 205 |
- If there are both 'include' and 'exclude' filters, all 'include' filters |
| 206 |
are matched first, then the 'exclude' filters will be applied to the |
| 207 |
resulting set. |
| 208 |
--; |
| 209 |
|
| 210 |
; ----- Legacy Filter Examples: |
| 211 |
; Every legacy filter expression results in regular expression matching |
| 212 |
; on the entire payload of every event even if no regular expression |
| 213 |
; meta-characters were used. |
| 214 |
|
| 215 |
; Only include Newchannel events |
| 216 |
;eventfilter=Event: Newchannel |
| 217 |
|
| 218 |
; Only include events of any type with a "Channel" header that matches |
| 219 |
; the regular expression. |
| 220 |
;eventfilter=Channel: (PJ)?SIP/(james|jim|john)- |
| 221 |
|
| 222 |
; Only include Newchannel events which contain a "Channel" header |
| 223 |
; for PJSIP channels. |
| 224 |
;eventfilter = Event: Newchannel.*Channel: PJSIP/ |
| 225 |
|
| 226 |
; Only include Newchannel or Hangup events whose "Channel" header doesn't start |
| 227 |
; with Local/. All other events are filtered out. |
| 228 |
;eventfilter = Event: Newchannel |
| 229 |
;eventfilter = Event: Hangup |
| 230 |
;eventfilter = !Channel: Local/ |
| 231 |
; This causes three regexes to be searched for on every event! |
| 232 |
|
| 233 |
; Include ALL events EXCEPT Newchannel and Hangup events whose "Channel" header |
| 234 |
; starts with Local/. |
| 235 |
; Other Newchannel and Hangup events ARE reported. |
| 236 |
;eventfilter = !Event: (Newchannel|Hangup).*Channel: Local/ |
| 237 |
; This causes one regex to be searched for but it's a fairly expensive |
| 238 |
; one. |
| 239 |
|
| 240 |
; Exclude any event that has a "Channel" header whose value starts with "DADHI/" |
| 241 |
;eventfilter=!Channel: DAHDI/ |
| 242 |
|
| 243 |
; ----- Advanced Filter Examples: |
| 244 |
; All of these examples are WAY more efficient than their legacy |
| 245 |
; equivalents. |
| 246 |
|
| 247 |
; Include only "Newchannel" events. |
| 248 |
; eventfilter(name(Newchannel)) = |
| 249 |
; Note that there's nothing to the right of the '=' because you don't care |
| 250 |
; what's in the payload. You still need the '=' though or the config file |
| 251 |
; parser will complain. 'action(include)' and 'method(none)' are implied. |
| 252 |
|
| 253 |
; Only include events of any type with a "Channel" header that matches |
| 254 |
; the regular expression. |
| 255 |
;eventfilter(action(include),header(Channel),method(regex)) = (PJ)?SIP/(james|jim|john)- |
| 256 |
; We're still testing every event but because we only apply the regex to the |
| 257 |
; value of the Channel header this is still more efficient than using the |
| 258 |
; legacy method. |
| 259 |
|
| 260 |
; Only include Newchannel and Hangup events whose "Channel" header doesn't |
| 261 |
; start with Local/. |
| 262 |
;eventfilter(action(include),name(Newchannel)) = |
| 263 |
;eventfilter(action(include),name(Hangup)) = |
| 264 |
;eventfilter(header(Channel),action(exclude),method(starts_with)) = Local/ |
| 265 |
; No regexes at all. We do the hash match against the event names first and |
| 266 |
; only matching events are passed to the next filter. |
| 267 |
; Then, in only those events, we look for a Channel header by exact match, then |
| 268 |
; look for 'Local/' at the beginning of its value. |
| 269 |
|
| 270 |
; Include ALL events EXCEPT Newchannel and Hangup events whose "Channel" header |
| 271 |
; starts with Local/. |
| 272 |
; Other Newchannel and Hangup events ARE reported. |
| 273 |
;eventfilter(action(exclude),name(Newchannel),header(Channel),method(starts_with)) = Local/ |
| 274 |
;eventfilter(action(exclude),name(Hangup),header(Channel),method(starts_with)) = Local/ |
| 275 |
; Again, no regexes. Very efficient because the filters start by looking for |
| 276 |
; a hash match on the event name. |
| 277 |
|
| 278 |
; Exclude any event that has a "Channel" header whose value starts with "DADHI/" |
| 279 |
;eventfilter(action(exclude),header(Channel),method(starts_with)) = DAHDI/ |
| 280 |
; We're still testing every event but there are no regexes involved at all. |
| 281 |
|
| 282 |
;-- |
| 283 |
-- eventfilter end ---------------------------------------------------- |
| 284 |
--; |
| 285 |
|
| 286 |
; |
| 287 |
; If the device connected via this user accepts input slowly, |
| 288 |
; the timeout for writes to it can be increased to keep it |
| 289 |
; from being disconnected (value is in milliseconds) |
| 290 |
; |
| 291 |
; writetimeout = 100 |
| 292 |
; |
| 293 |
;displayconnects = yes ; Display on CLI user login/logoff |
| 294 |
; |
| 295 |
; Authorization for various classes |
| 296 |
; |
| 297 |
; Read authorization permits you to receive asynchronous events, in general. |
| 298 |
; Write authorization permits you to send commands and get back responses. The |
| 299 |
; following classes exist: |
| 300 |
; |
| 301 |
; all - All event classes below (including any we may have missed). |
| 302 |
; system - General information about the system and ability to run system |
| 303 |
; management commands, such as Shutdown, Restart, and Reload. This |
| 304 |
; class also includes dialplan manipulation actions such as |
| 305 |
; DialplanExtensionAdd and DialplanExtensionRemove. |
| 306 |
; call - Information about channels and ability to set information in a |
| 307 |
; running channel. |
| 308 |
; log - Logging information. Read-only. (Defined but not yet used.) |
| 309 |
; verbose - Verbose information. Read-only. (Defined but not yet used.) |
| 310 |
; agent - Information about queues and agents and ability to add queue |
| 311 |
; members to a queue. |
| 312 |
; user - Permission to send and receive UserEvent. |
| 313 |
; config - Ability to read and write configuration files. |
| 314 |
; command - Permission to run CLI commands. Write-only. |
| 315 |
; dtmf - Receive DTMF events. Read-only. |
| 316 |
; reporting - Ability to get information about the system. |
| 317 |
; cdr - Output of cdr_manager, if loaded. Read-only. |
| 318 |
; dialplan - Receive NewExten and VarSet events. Read-only. |
| 319 |
; originate - Permission to originate new calls. Write-only. |
| 320 |
; agi - Output AGI commands executed. Input AGI command to execute. |
| 321 |
; cc - Call Completion events. Read-only. |
| 322 |
; aoc - Permission to send Advice Of Charge messages and receive Advice |
| 323 |
; - Of Charge events. |
| 324 |
; test - Ability to read TestEvent notifications sent to the Asterisk Test |
| 325 |
; Suite. Note that this is only enabled when the TEST_FRAMEWORK |
| 326 |
; compiler flag is defined. |
| 327 |
; security - Security Events. Read-only. |
| 328 |
; message - Permissions to send out of call messages. Write-only |
| 329 |
; |
| 330 |
;read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan |
| 331 |
;write = system,call,agent,user,config,command,reporting,originate,message |