- MiaRec v.3 (old) documentation
- FAQ
- Installation
- Backup/restore calls
- Live monitoring
- MiaRec.ini configuration file
- Troubleshooting
- SOAP API
On this page:
MiaRec supports very powerful recording filters, which allow to:
Recording filters are specified inside section [Filters::OnCallStart] in MiaRec.ini configuration file.
Example:
[Filters::OnCallStart] filter1 condition = caller-number = '100' OR callee-number = '100' filter1 action = record filter2 condition = caller-number = '200' OR callee-number = '200' filter2 action = record filter3 condition = caller-number = '300' OR callee-number = '300' filter3 action = record default_action = ignore
In this example only those calls will be recorded, which are made from/to phones 100, 200 or 300.
All other calls will be ignored (see default_action = ignore).
Note, starting from version 5.0 MiaRec supports configuring per-user recording rules via web interface. These per-user rules are executed after recording filters in INI file. Recording filters from INI file are always executed first. If one of filter's condition matches, then per-user rules are not executed. This allows to configure some advanced global ignore rules, like "ignore all internal calls":
[Filters::OnCallStart] # Ignore all internal calls, where both caller and called phone numbers are 3 digits. filter_internal_calls_action = ignore filter_internal_calls_condition = caller-number LIKE '___' AND callee-number LIKE '___'
Syntax of filters is following:
<unique-name-of-filter>condition = CONDITION <unique-name-of-filter>action = [ record | ignore ] <unique-name-of-filter>filename = FILENAME-FORMAT
Each filter has unique name and consits of three lines: action, condition and filename. The last line (filename) is optional.
Each recording filter should have unique name. For example:
[Filters::OnCallStart] filter1_condition = caller-number = 12345 filter1_action = record filter2_condition = caller-ip = 10.0.0.0/24 filter2_action = record filter2_filename = C:\Calls\Network2\%{setup-time#%Y%m%d%H%M%S}.mp3 my new filter condition = caller-ip = 10.0.5.0/24 my new filter action = ignore
In this example three filters are specified with the following names:
Filter name may contain letters, digits, underscore and space characters.
condition is a logical expression. Example:
filter1 condition = caller-ip = 192.168.0.1 filter2 condition = caller-ip >= 192.168.0.10 AND caller-ip <= 192.168.0.20 filter3 condition = caller-number LIKE '011%' filter4 condition = caller-ip = 10.0.0.5 AND NOT (callee-ip = 10.0.0.1 OR callee-ip = 10.0.0.2)
Read Syntax of filter condition for details.
action specifies what to do with a call. Following actions are supported:
Action | Description |
---|---|
record | Record the call, which matches that filter's condition. If filename line exists, then call will be recorded with specified name, otherwise the default file name will be used. |
ignore | Ignore a call (do not record it). Audio file for that call will not be stored on disk and normally such call will not be visible inside MiaRec web-interface. But, optionally, it is possible to show ignored calls inside MiaRec web-interface (see SaveCDRsForIgnoredCalls). |
filename specifies a file name format for calls, which match the filter's condition. It is optional. If it is omitted, then a default file name format is used as specified in section [Recording] parameter FileNameFormat. A syntax of this field is the same (see File name format).
Note, starting from version 5.2 a default action is configured inside web-interfaces. Settings for default action inside INI file are ignored during normal system operation. Although they are used when MiaRec recorder functions without a database.
For calls, which do not match any of recording filters, a default action is performed. Default action may be record or ignore. Optionally, a default file name format (default_filename) can be specified.
Example:
[Filters::OnCallStart] filter1_condition = caller-number = '123456' OR callee-number = '123456' filter1_action = record default_action = ignore
In above example only phone with number '123456' will be recorded. All other calls will be ignored (see default_action = ignore).
Optionally, you can specify default_filename. This parameter will override the one, which is specified inside FileNameFormat in section [Recording].
Example:
[Filters::OnCallStart] filter1_condition = caller-number = '123' OR callee-number = '123' filter1_action = record filter1_filename = C:\Phone123\%{setup-time#%Y%m%d%H%M%S}.mp3 default_action = record default_filename = C:\OtherPhones\%{setup-time#%Y%m%d%H%M%S}.mp3
In this example, calls with number 123 will be stored inside directory C:\Phone123\.
All other calls will be stored inside directory C:\OtherPhones\.
Note, if a default action is omitted, then it has implicit value record.
The order of filters is important when a call may match multiple filters. In this case the first matched filter is used.
For example, we have following filters:
[Filters::OnCallStart] filter1_action = record filter1_condition = caller-ip = '192.168.0.0/24' filter2_action = ignore filter2_condition = caller-port = 5060
And our call has caller-ip equal to 192.168.0.5 and caller-ip equal to 5060.
Such call will match a condition of both filters, but action of the first one will be pefrormed (record).
If you change the order of filters inside INI file, like:
[Filters::OnCallStart] filter2_action = ignore filter2_condition = caller-port = 5060 filter1_action = record filter1_condition = caller-ip = '192.168.0.0/24'
Then the mentioned call will be ignored because first matched filter has action ignore.
When recording filters are not working as you expected, then use the following recommendations: