2004-07-02 09:44:55 +00:00
|
|
|
; Minimalistic basic regular expressions information
|
|
|
|
; ^ matches start of string
|
|
|
|
; $ matches end of string
|
|
|
|
; . matches any character
|
|
|
|
; [list] matches one character in the list
|
|
|
|
; [^list] matches one character not in list
|
|
|
|
; Lists can be individual characters or ranges char-char. You can insert ]
|
|
|
|
; by making it the first character in list and ^ by making it not the first
|
|
|
|
; character
|
|
|
|
; * matches preceeding expression any number of times (including zero)
|
|
|
|
; \+ matches preceeding expression at least one time
|
|
|
|
; \? matches preceeding expression zero or one time
|
2007-05-09 22:47:18 +00:00
|
|
|
; \{N\} matches preceeding expression exactly N times
|
|
|
|
; \{N,\} matches preceeding expression N or more times
|
|
|
|
; \{N,M\} matches preceeding expression between N and M times
|
2010-06-11 12:33:28 +00:00
|
|
|
; \| matches either the preceeding or following expression
|
2004-07-02 09:44:55 +00:00
|
|
|
; \( \) captures the contained subexpression
|
|
|
|
; Remember matches are greedy, they will match as much as possible
|
|
|
|
; You must escape ^ $ . * [ and \ with \ whenever you want them to be normal
|
|
|
|
; characters except in lists
|
|
|
|
; Please see the manual pages for grep and sed for more information
|
|
|
|
|
2006-06-29 15:53:25 +00:00
|
|
|
; Functions callable in the right-hand side:
|
|
|
|
; $() = a ; character
|
2009-03-24 16:00:33 +00:00
|
|
|
; $($) = a $ character
|
2006-06-29 15:53:25 +00:00
|
|
|
; $(++N) = N+1
|
|
|
|
; $(--N) = N-1
|
|
|
|
; $(length,STRING) = length of STRING
|
|
|
|
; $(upper,STRING) = STRING converted to upper case
|
|
|
|
; $(lower,STRING) = STRING converted to lower case
|
2009-03-24 16:00:33 +00:00
|
|
|
; $(chr,N) = character with numeric code N
|
2011-02-04 16:50:27 +00:00
|
|
|
; $(hex,N[,LEN]) = little endian hexadecimal value of N with space between octets
|
2006-06-29 15:53:25 +00:00
|
|
|
; $(add,VAL1,VAL2[,LEN]) = VAL1+VAL2 left filled to LEN or length of VAL1
|
|
|
|
; $(sub,VAL1,VAL2[,LEN]) = VAL1-VAL2 left filled to LEN or length of VAL1
|
|
|
|
; $(mul,VAL1,VAL2[,LEN]) = VAL1*VAL2 left filled to LEN or length of VAL1
|
|
|
|
; $(div,VAL1,VAL2[,LEN]) = VAL1/VAL2 left filled to LEN or length of VAL1
|
|
|
|
; $(mod,VAL1,VAL2[,LEN]) = VAL1%VAL2 left filled to LEN or length of VAL1
|
2007-05-09 22:47:18 +00:00
|
|
|
; $(eq,VAL1,VAL2) = "true" if VAL1 = VAL2 (numerically), "false" otherwise
|
|
|
|
; $(ne,VAL1,VAL2) = "true" if VAL1 != VAL2 (numerically), "false" otherwise
|
2007-01-02 08:20:48 +00:00
|
|
|
; $(lt,VAL1,VAL2) = "true" if VAL1 < VAL2, "false" otherwise
|
|
|
|
; $(gt,VAL1,VAL2) = "true" if VAL1 > VAL2, "false" otherwise
|
|
|
|
; $(le,VAL1,VAL2) = "true" if VAL1 <= VAL2, "false" otherwise
|
|
|
|
; $(ge,VAL1,VAL2) = "true" if VAL1 >= VAL2, "false" otherwise
|
2007-05-09 22:47:18 +00:00
|
|
|
; $(streq,VAL1,VAL2) = "true" if VAL1 = VAL2 (string), "false" otherwise
|
|
|
|
; $(strne,VAL1,VAL2) = "true" if VAL1 != VAL2 (string), "false" otherwise
|
2011-06-15 13:12:09 +00:00
|
|
|
; $(strpos,VAL1,VAL2) = 0-based position of VAL1 in VAL2, -1 if not found
|
2006-06-29 15:53:25 +00:00
|
|
|
; $(random,STRING) = STRING with each ? character replaced with a random digit
|
|
|
|
; $(index,N,ITEM1,ITEM2,...) = N-th (modulo length of list) item in list
|
|
|
|
; $(rotate,N,ITEM1,ITEM2,...) = list rotated N (modulo length of list) times
|
2011-10-06 11:41:25 +00:00
|
|
|
; $(config,SECTION,KEY) = value of KEY= in [SECTION] of main config file (yate.conf, yate-qt4.conf)
|
2009-11-18 13:20:52 +00:00
|
|
|
; $(engine,NAME) = value of Engine's runtime parameter NAME
|
2007-01-02 08:20:48 +00:00
|
|
|
; $(runid) = the current Engine run identifier
|
2008-11-25 16:49:42 +00:00
|
|
|
; $(nodename) = the node name the Engine runs as, may be empty
|
2009-05-20 14:33:45 +00:00
|
|
|
; $(threadname) = name of the thread that dispatched the message, may be empty
|
2009-04-30 10:30:51 +00:00
|
|
|
; $(dispatching) = the reentry depth, 0 if the message is not generated locally
|
2012-05-21 10:31:03 +00:00
|
|
|
; $(message,name) = name of the message handled
|
|
|
|
; $(message,time) = time of the message handled, seconds since UNIX Epoch
|
|
|
|
; $(message,broadcast) = true if the message is a broadcast, false otherwise
|
|
|
|
; $(message,count) = parameter count of the message handled
|
|
|
|
; $(message,parameters) = parameter list of the message handled, comma separated
|
|
|
|
; $(message,parameters,sep) = parameter list of the message handled, explicit separator
|
2007-03-28 22:12:21 +00:00
|
|
|
; $(transcode,FLAGS,FORMAT1,FORMAT2,...) = list of formats the input can be transcoded into
|
|
|
|
; e - exclude initial formats form generated list
|
|
|
|
; r - allow rate conversion (for use with wideband)
|
|
|
|
; c - allow changing channels number
|
2006-06-29 15:53:25 +00:00
|
|
|
; Note that functions ++, --, index and rotate will automatically update N
|
|
|
|
; if it is a variable in the $varname format.
|
|
|
|
|
|
|
|
|
2004-05-22 00:05:20 +00:00
|
|
|
[priorities]
|
2004-07-02 09:44:55 +00:00
|
|
|
; Set the priorities for the insertion of the regular expression module in the
|
|
|
|
; handler chain; a priority of 0 disables the handler entirely
|
2004-05-22 00:05:20 +00:00
|
|
|
|
2004-07-02 09:44:55 +00:00
|
|
|
; preroute: int: Priority of the prerouting message handler
|
|
|
|
;preroute=100
|
2004-05-22 00:05:20 +00:00
|
|
|
|
2004-07-02 09:44:55 +00:00
|
|
|
; route: int: Priority of the routing message handler
|
|
|
|
;route=100
|
2004-05-22 00:05:20 +00:00
|
|
|
|
2009-08-14 16:27:46 +00:00
|
|
|
; extended: bool: Use extended regular expressions
|
|
|
|
;extended=no
|
|
|
|
|
|
|
|
; insensitive: bool: Make the regular expressions case insensitive
|
|
|
|
;insensitive=no
|
|
|
|
|
2011-09-20 12:19:58 +00:00
|
|
|
; defaultrule: regexp: Default expression to use in matches if not specified
|
|
|
|
; Works only for ${param} or $(expression) matches
|
|
|
|
; Default matches any string that is not empty or explicitely false or zero
|
|
|
|
;defaultrule=^\(false\|no\|off\|disable\|f\|0*\)$^
|
|
|
|
|
2009-08-14 16:27:46 +00:00
|
|
|
; prerouteall: bool: Preroute even calls having a context or with empty caller
|
|
|
|
;prerouteall=no
|
|
|
|
|
2011-06-15 13:20:12 +00:00
|
|
|
; maxdepth: int: Maximum number of jumps or recursive includes
|
|
|
|
; Values are clamped to interval 5-100
|
|
|
|
;maxdepth=5
|
|
|
|
|
2012-06-12 23:47:01 +00:00
|
|
|
; trackparam: bool: Add the module to the handler tracking parameter
|
2012-06-13 07:21:13 +00:00
|
|
|
; Set it to false to disable defaults and do all tracking in user rules
|
|
|
|
;trackparam=true
|
2012-06-12 23:47:01 +00:00
|
|
|
|
2004-05-22 00:05:20 +00:00
|
|
|
|
2006-06-29 15:53:25 +00:00
|
|
|
[$once]
|
|
|
|
; First-time only global variables initialization.
|
|
|
|
; It is executed during first initialization before the [$init] section
|
|
|
|
; Each line must be of the form:
|
|
|
|
; varname=value
|
|
|
|
|
|
|
|
|
|
|
|
[$init]
|
|
|
|
; Reload time global variables initialization
|
|
|
|
; Each line must be of the form:
|
|
|
|
; varname=value
|
|
|
|
|
|
|
|
|
2008-07-14 16:59:21 +00:00
|
|
|
[extra]
|
|
|
|
; This section allows installing handlers for any message name.
|
|
|
|
; Each line must be of the form:
|
2010-06-16 10:46:22 +00:00
|
|
|
; message.name=priority[,[paramname][,context]]
|
|
|
|
; For each handler create a corresponding [context] or [message.name] section
|
|
|
|
; in which implement handling for that specific message. If paramname is not
|
|
|
|
; set you will need to match parameters explicitely or set a new match string.
|
|
|
|
; Examples:
|
|
|
|
; engine.command=90
|
|
|
|
; call.execute=120,callto
|
|
|
|
; call.route=200,called,reroute
|
2008-07-14 16:59:21 +00:00
|
|
|
|
|
|
|
|
2004-07-02 09:44:55 +00:00
|
|
|
[contexts]
|
|
|
|
; This section is used by the prerouting handler to classify calls by the
|
|
|
|
; caller name; each call is assigned an input context (only if none exists
|
|
|
|
; already) that is used later in the routing stage
|
|
|
|
; Expressions are scanned from top to bottom; the first match returns the value
|
|
|
|
; Each line must be of the form:
|
|
|
|
; regexp=context_name
|
2004-12-01 00:54:04 +00:00
|
|
|
; To match a message parameter you can use the format:
|
|
|
|
; ${paramname}regexp=context_name
|
2004-07-02 09:44:55 +00:00
|
|
|
; Strings captured with the regular expression construct \(...\) can be
|
|
|
|
; inserted in the context name using \1, \2, \3, ... while \0 holds the entire
|
|
|
|
; matched regexp even if no capture was used
|
2004-12-01 00:54:04 +00:00
|
|
|
; Message parameters can be inserted in the context name using ${paramname}
|
2004-07-02 09:44:55 +00:00
|
|
|
;
|
|
|
|
; Example:
|
|
|
|
;^$=empty
|
|
|
|
;^00=international
|
|
|
|
;^0=longdistance
|
|
|
|
;.*=default
|
|
|
|
|
2004-05-22 00:05:20 +00:00
|
|
|
|
2004-07-02 09:44:55 +00:00
|
|
|
[default]
|
|
|
|
; Sections like this one are used by the routing handler to find the target
|
|
|
|
; of calls by the called name
|
|
|
|
; The [default] context is special, it is used when no context has been set
|
|
|
|
; otherwise you have to place the entries in a section with the same name
|
|
|
|
; as the context
|
|
|
|
; Expressions are scanned from top to bottom; the first match returns the value
|
|
|
|
; Each line must be of the form:
|
|
|
|
; regexp=target
|
2004-12-01 00:54:04 +00:00
|
|
|
; To match a message parameter you can use the format:
|
|
|
|
; ${paramname}regexp=target
|
2007-05-09 22:47:18 +00:00
|
|
|
; To match a function possibly containing parameters you can use the format:
|
|
|
|
; $(function,param...)regexp=target
|
2007-07-09 19:20:17 +00:00
|
|
|
; To act on non-matching expressions add a ^ at end of the regexp. In this
|
|
|
|
; case the \0 ... \9 replacements will always be empty
|
|
|
|
; regexp^=target
|
2004-07-02 09:44:55 +00:00
|
|
|
; Strings captured with the regular expression construct \(...\) can be
|
|
|
|
; inserted in the target using \1, \2, \3, ...
|
2004-12-01 00:54:04 +00:00
|
|
|
; Message parameters can be inserted in the target using ${paramname}
|
2006-06-29 15:53:25 +00:00
|
|
|
; Functions can be inserted using $(function,param,param)
|
2004-07-02 09:44:55 +00:00
|
|
|
;
|
2006-06-29 15:53:25 +00:00
|
|
|
; First word of a matched target has a special meaning:
|
2013-01-25 16:39:42 +00:00
|
|
|
; if, and - make a new match using the rest of the line up to the = character
|
2012-05-21 10:31:03 +00:00
|
|
|
; or - alternative match using the rest of the line up to the = character
|
2004-12-01 00:54:04 +00:00
|
|
|
; return - returns immediately from the context without routing
|
2013-01-25 16:39:42 +00:00
|
|
|
; include, call - calls another context, returns at the next entry if the other
|
2004-12-01 00:54:04 +00:00
|
|
|
; context did not return successfully
|
2013-01-25 16:39:42 +00:00
|
|
|
; jump, goto - jumps to another context, does not return to this context
|
2004-12-01 00:54:04 +00:00
|
|
|
; match - modify the matched string instead of specifying a target
|
2007-05-09 22:47:18 +00:00
|
|
|
; rename - changes the name of the message
|
|
|
|
; enqueue - puts a new message in the engine, parameters are taken from the
|
|
|
|
; old message but placed in the new one
|
2009-04-30 10:30:51 +00:00
|
|
|
; dispatch - dispatches a new message in the engine waiting for it to return,
|
|
|
|
; parameters are taken from the old message but placed in the new one
|
2005-02-10 13:26:26 +00:00
|
|
|
; echo - displays that line after making substitutions
|
2012-05-21 10:31:03 +00:00
|
|
|
; { - starts a block that ends on another line with }
|
2013-01-25 16:39:42 +00:00
|
|
|
; The @jump, @goto, @include and @call forms suppress warning if missing target
|
2004-11-29 21:01:04 +00:00
|
|
|
;
|
|
|
|
; It is possible to set message parameters by appending them as name=value
|
|
|
|
; while separating them with semicolons (;)
|
2006-06-29 15:53:25 +00:00
|
|
|
; Placing just the parameter name without the = sign will clear the parameter
|
|
|
|
; Using $name=value will instead change the global variable with that name.
|
|
|
|
; Similarily specifying just $name will clear the global variable
|
|
|
|
;
|
2004-12-01 00:54:04 +00:00
|
|
|
; Please note that the match string is not changed together with the message
|
|
|
|
; parameter from which it was copied; for example in routing stage using
|
|
|
|
; "match 123" and ";called=123" have different effects
|
2004-11-29 21:01:04 +00:00
|
|
|
;
|
2004-07-02 09:44:55 +00:00
|
|
|
; Example:
|
2004-11-29 21:01:04 +00:00
|
|
|
; route the emergency 112 and 911 numbers to POTS, any channel on an E1,
|
|
|
|
; force specific data format too
|
|
|
|
;^112$=zap/1-31; format=alaw
|
|
|
|
;^911$=zap/1-31; format=mulaw
|
|
|
|
; route international calls over SIP, replace caller name
|
|
|
|
;^00\(.*\)$=sip/sip:\1@international.gateway ; callername = International call
|
2004-07-02 09:44:55 +00:00
|
|
|
; route value added services over IAX, trailing part is sent as IAX extension
|
|
|
|
;^09\(.*\)$=iax/vap@gateway.for.vap/\1
|
|
|
|
; route green calls over IAX with 2 digits used to form an user name,
|
|
|
|
; remaining digits are sent as extension
|
|
|
|
;^08\(..\)\(.*\)$=iax/green-\1@gateway.for.green/\2
|
|
|
|
; everything else starting with 0 is routed over H.323
|
|
|
|
;^0\(.*\)$=h323/\1@long.distance.gateway
|
|
|
|
; route short 3digit numbers to SIP using a DNS scheme 123 -> 3.2.1.domain
|
|
|
|
;^\(.\)\(.\)\(.\)$=sip/sip:\0@\3.\2.\1.domain
|
2011-02-05 09:59:27 +00:00
|
|
|
; route only calls from SIP starting with 123 to a H.323 gateway
|
|
|
|
;${id}^sip/=if ^123.*$=h323/\0@provider.gw
|
2004-07-02 09:44:55 +00:00
|
|
|
; is there anything else left? they go on E1 but only 15 channels can be used
|
2004-11-29 21:01:04 +00:00
|
|
|
; we also make sure the number is at least 4 characters long
|
|
|
|
; and we set a national caller dialplan
|
|
|
|
;.....*=zap/1-15 ; callerplan = national
|
2004-07-02 09:44:55 +00:00
|
|
|
; leftovers... should not happen but let's handle them. we may not route the
|
|
|
|
; call at all and let the caller receive a "no route" error
|
|
|
|
;.*=wave/play/sounds/invalid_number.gsm
|
|
|
|
;
|
|
|
|
; The following are for testing purposes
|
|
|
|
^99991001$=tone/dial
|
|
|
|
^99991002$=tone/busy
|
|
|
|
^99991003$=tone/ring
|
|
|
|
^99991004$=tone/specdial
|
2004-11-04 00:32:25 +00:00
|
|
|
^99991005$=tone/congestion
|
|
|
|
^99991006$=tone/outoforder
|
|
|
|
^99991007$=tone/milliwatt
|
2009-04-30 10:30:51 +00:00
|
|
|
^99991008$=tone/info
|
2007-01-10 11:12:28 +00:00
|
|
|
|
|
|
|
; Example of handling call authorization by caller authentication or ip address
|
|
|
|
; If the user is not authenticated call the subsection check_addr_auth
|
|
|
|
;${username}^$=call check_addr_auth
|
|
|
|
; Optionally, force caller id to authenticated username (if any)
|
|
|
|
;${username}.=;caller=${username}
|
|
|
|
;
|
|
|
|
;[check_addr_auth]
|
|
|
|
; Here we check for trusted gateways or networks by the "address" parameter
|
|
|
|
; that for VoIP protocols is in the format: ip.ad.dr.ess:port
|
|
|
|
;
|
|
|
|
; allow trusted gateway 10.0.1.2
|
|
|
|
;${address}^10\.0\.1\.2:=return
|
|
|
|
; also trust callers from network 192.168.0.*
|
|
|
|
;${address}^192\.168\.0\.=return
|
|
|
|
; all others should be challenged (SIP,IAX) or rejected (other protocols)
|
|
|
|
;.*=-;error=noauth
|