prefix2domain()
prefix2domain
usageThis module translates numerical codes into domains and update accordingly the R-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: read the code after the prefix from the user part of the uri and keep the rest as the user part of the new uri. The host part will be the domain matched for the leading code.
[<prefix>]<code><userid><:password>@<mydomain.com> ...
and the result will be:
<userid><:password>@<domain[:port]>...
The code is always ended with a special digit (a parameter of the module). This digit will not be inside the code at all.
See SQL script for creating databases and a sample of cfg file in './doc/'.
The web interface is in doc/web/ and the SQL script for creating the database for user interface is './doc/admin.sql'.
Sample shell script to use with fifo interface is './doc/fifo.sh'.
The following libraries or applications must be installed before running SER with this module loaded:
None.
SQL URL of database--username, password, host, port and database (ex: sql://username:password@hostname.com/database)
Default value is "sql://root@127.0.0.1/pdt".
Default 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 code 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 find the code.
Default value is NULL.
prefix2domain()
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 or it does not match the prefix parameter). Returns -1 in error cases.
The module registers also a function that works with the fifo server ( get_domaincode ). That will provide support for a web user interface which will be used by admins to register new domains and by simple users to find the code for a domain.
Registered domains are stored in a database and in tables in share memory. The database is kept consistent with the tables in memory. When a new domain is registered the information goes first in the database and only than in tables in share memory.
Data in share memory is kept in hashtables to have fast searches. Searches are possible for domains, but also for codes. Searches for codes are necessary more often, every time when a message that needs to be translated passes through SER Searches for domains are requested by the user interface only.
Through the web interface a normal user can find the code for a domain and a privileged user (i.e., admins) can register new domains too. The web interface also encounters problems of mutual exclusion. Any user of the interface posts a request to the fifo server and waits his response in a file. The file must be unique per user to avoid interfering responses for different simultaneous user. That problem is solved using session per user offered by the PHP language.
Take a look at http://iptel.org/ser.
First at all check if your question was already answered on one of our mailing lists:
E-mails regarding any stable version should be sent to <serusers@iptel.org>
and e-mail
regarding development versions or CVS snapshots should be send to <serdev@iptel.org>
.
If you want to keep the mail private, send it to <serhelp@iptel.org>
.
Please follow the guidelines provided at: http://iptel.org/ser/bugs