Copyright © 2003 FhG FOKUS
Copyright © 2004 voice-system.ro
db_url
(string)db_table
(string)prefix_column
(string)domain_column
(string)prefix
(string)hsize_2pow
(integer)sync_time
(integer)clean_time
(integer)prefix2domain(mode)
db_url
parameterdb_table
parameterprefix_column
parameterdomain_column
parameterprefix
parameterhsize_2pow
parametersync_time
parameterclean_time
parameterprefix2domain
usageThis module translates a numerical prefix into a domain and updates accordingly the request URI.
The module looks up at the R-URI part of a message and if the user part begins with an established prefix it will update the URI. Updating the uri consists of: remove the prefix from the user part of the uri and keep the rest as the user part of the new uri. The host and port are changed with the domain matched for the leading prefix.
<prefix><userid><:password>@<mydomain.com> ...
and the result will be:
<userid><:password>@<domain[:port]>...
Example 1-1. prefix-domain translation
prefix=123 domain[123]=alpha.org sip:12391001@mydomain.com => sip:91001@alpha.org
The prefix could be prefixed by other digits. These digits will not be used to look up the domain (the classic example, 00 used for international calls, then follows the country prefix). For more information on this, see 'prefix' parameter.
A sample config file and the MySQL script to create the database needed by PDT are located in './doc/'.
Sample shell scripts to manage prefix-domain pairs are also located in './doc/' (pdt_fifo_add.sh, pdt_fifo_delete.sh, pdt_fifo_list.sh).
The following modules must be loaded before this module:
A OpenSER database module (e.g., mysql, dbtext).
The following libraries or applications must be installed before running OpenSER with this module loaded:
None.
db_url
(string)SQL URL of database--username, password, host, port and database (ex: mysql://username:password@hostname.com/database)
Default value is "mysql://root@127.0.0.1/pdt".
prefix
(string)Default leading prefix who denotes what URI needs to be translated - if it is NULL the module will not check the R-URI against it and the PDT prefix is considered starting from the first digit. Otherwise, the module will check first if the R-URI starts with it and will skip it to look up the domain.
Default value is NULL.
sync_time
(integer)Time in seconds to synchronize the cache of each process with the changes made through FIFO. Any prefix-domain change made through FIFO is guaranteed to have efect after this period of time past.
Default value is 600.
clean_time
(integer)Time in seconds to clean the changes inserted via FIFO. The changes will be removed from FIFO diff list only when all OpenSER processes applied these changes.
Default value is 900.
prefix2domain(mode)
Build a new URI if it is necessary. Returns 1 when the translation was made or there was nothing to translate (user part of the URI is empty, it does not match the prefix parameter or there is no domain associated with a possible prefix from user part). Returns -1 in error cases.
The "mode" parameter specifies whether to strip or not the prefix from user part. If the parameter is missing or it has the value "0", then the prefix is removed along with the leading prefix. If the value is "1", only the leading prefix is removed. If the values is "2" the user part of the URI is not changed.
Make sure you have created the table needed by this module.
The modules uses only the cache to look up domains. If you want to add or delete a new prefix-domain pair you have to use FIFO commands. All changes made via FIFO are applied to database. The database is loaded only at OpenSER start up time.
There are three FIFO commands to use with PDT.
pdt_add - add a new prefix-domain pair
pdt_delete - remove a prefix-domain pair
pdt_list - list the prefixes and the domains
Example shell scripts for these commands are placed in './doc/' (pdt_fifo_add.sh, pdt_fifo_delete.sh, pdt_fifo_list.sh). More about, in the comments before the implementation of the functions, inside the 'pdt.c' file.
Take a look at http://openser.org/.
First at all check if your question was already answered on one of our mailing lists:
User Mailing List - http://openser.org/mailman/listinfo/users
Developer Mailing List - http://openser.org/mailman/listinfo/devel
E-mails regarding any stable OpenSER release should be sent to
<users@openser.org>
and e-mails regarding development versions
should be sent to <devel@openser.org>
.
If you want to keep the mail private, send it to
<team@openser.org>
.
Please follow the guidelines provided at: http://openser.org/bugs.