Table of Contents
List of Examples
The name of the db table storing prefix rules.
Default value is “trie_table”.
If enabled, the module will not allow do run multiple trie_reload MI commands in parallel (with overlapping) Any new reload will be rejected (and discarded) while an existing reload is in progress.
If you have a large routing set (millions of rules/prefixes), you should consider disabling concurrent reload as they will exhaust the shared memory (by reloading into memory, in the same time, multiple instances of routing data).
Default value is “0 (disabled)”.
Example 1.2. Set no_concurrent_reload
parameter
... # do not allow parallel reload operations modparam("trie", "no_concurrent_reload", 1) ...
Flag to configure whether to use partitions for tries. If this
flag is set then the db_partitions_url
and
db_partitions_table
variables become mandatory.
Default value is “0”.
The url to the database containing partition-specific
information.The use_partitions
parameter
must be set to 1.
Default value is “"NULL"”.
Example 1.4. Set db_partitions_url
parameter
... modparam("trie", "db_partitions_url", "mysql://user:password@localhost/opensips_partitions") ...
Function to search for an entry ( number ) in a trie.
This function can be used from all routes.
If you set use_partitions
to 1 the
partition last parameter becomes
mandatory.
All parameters are optional. Any of them may be ignored, provided the necessary separation marks "," are properly placed.
number (str) - number to be searched in the trie
flags (string, optional) - a list of letter-like flags for controlling the routing behavior. Possible flags are:
L - Do strict length matching over the prefix - actually the trie engine will do full number matching and not prefix matching anymore.
trie_attrs_pvar (var, optional) - a writable variable which will be populated with the attributes of the matched trie rule.
match_prefix_pvar (var, optional) - a writable variable which will be the actual prefix matched in the trie.
partition (string, optional) - the name of the trie partition to be used. This parameter is to be defined ONLY if the "use_partition" module parameter is turned on.
Example 1.7. trie_search
usage
... if (trie_search("$rU","L",$avp(code_attrs),,"my_partition")) { # we found it in the trie, it's a match xlog("We found $rU in the trie with attrs $avp(code_attrs) \n"); }
Command to reload trie rules from database.
if use_partition
is set to 0 - all routing rules will be reloaded.
if use_partition
is set to 1, the parameters are:
partition_name (optional) - if not provided all the partitions will be reloaded, otherwise just the partition given as parameter will be reloaded.
MI FIFO Command Format:
opensips-cli -x mi trie_reload part_1
Gets the time of the last reload for any partition.
if use_partition
is set to 0 - the function
doesn't receive any parameter. It will list the date of the
last reload for the default (and only) partition.
if use_partition
is set to 1, the parameters are:
partition_name (optional) - if not provided the function will list the time of the last update for every partition. Otherwise, the function will list the time of the last reload for the given partition.
Example 1.8. trie_reload_status
usage when use_partitions
is 0
$ opensips-cli -x mi dr_reload_status Date:: Tue Aug 12 12:26:00 2014
Tries to match a number in the existing tries loaded from the database.
if use_partition
is set to 1 the function
will have 2 parameters:
partition_name
number - the number to test against
if use_partition
is set to 0 the function will have 1 parameter:
number - the number to test against
MI FIFO Command Format:
opensips-cli -x mi trie_search partition_name=part1 number=012340987
Deletes individual entries in the trie, without reloading all of the data
if use_partition
is set to 1 the function
will have 2 parameters:
partition_name
number - the array of numbers to delete
MI FIFO Command Format:
opensips-cli -x mi trie_number_delete partition_name=part1 number=["012340987","4858345"]
Upserts ( insert if not found, update is found ) an array of numbers in the trie, without reloading all of the data
if use_partition
is set to 1 the function
will have 3 parameters:
partition_name
number - the array of numbers to update
attrs - the array of new attributes for the numbers
MI FIFO Command Format:
opensips-cli -x mi trie_number_upsert partition_name=part1 number=["012340987"] attrs=["my_attrs"]
The module requires some tables in the OpenSIPS database. You can also find the complete database documentation on the project webpage, https://opensips.org/docs/db/db-schema-devel.html.
Documentation Copyrights:
Copyright © 2024 OpenSIPS Project