Hello all,
the pdt module was enhanced to support multidomain translation of the
prefixes, i.e. a new R-URI domain is searched by prefix and domain of
FromURI. Until now the search was performed by prefix only.
**************
This means the database table will have three columns (sdomain, prefix,
domain), where sdomain stands for a source domain to which a set of
(prefixes,domain) pairs could be assinged.
Database creation example:
DROP DATABASE IF EXISTS pdt;
CREATE DATABASE pdt;
USE pdt;
-- create table
CREATE TABLE pd_multidomain (
sdomain VARCHAR(255) NOT NULL,
prefix VARCHAR(32) NOT NULL,
domain VARCHAR(255) NOT NULL DEFAULT "",
PRIMARY KEY (sdomain, prefix)
);
**************
The module exports one function prefix2domain(mode) to be used from
script to update the RURI if this is in a PSTN format. For details about
the 'mode' parameter please refer to the README file.
The module parameter called 'prefix' is available to define which URIs
must be translated. Here it is an example how to set it in the script
file modparam("pdt", "prefix", "00"). This means only the
RURIs in the
format 00xxxxx@yyyyy will be updated if predix2domain() is called in the
script. By default is set to NULL, and all RURIs will be updated if
prefix2domain() is called.
An example of translation:
-- Input:
modparam("pdt", "prefix", "00")
Database entries (sdomain - prefix - domain):
(
siphub.org, 123,
alpha.org)
(
siphub.org, 124,
beta.org)
(
siphub.org, 126,
gamma.org)
(
openser.org, 123,
one.org)
(
openser.org, 124,
two.org)
(
openser.org, 125,
three.org)
Message:
RURI: 00123456789(a)mydomain.com
FromURI: alice(a)siphub.org
-- Translation via prefix2domain(0)
-- Output
RURI: 456789(a)alpha.org
**************
Three fifo commands are available for adding, deleting and listing the
(sdomain, prefix, domain) entries in the database.
/*
* How to add a new entry - fifo command example
*
* ---
* :pdt_add:[response_file]\n
* sdomain\n
* prefix\n
* domain\n
* \n
* --
*
* - '.' (dot) means NULL value and is not allowed
*/
/*
* How to delete existent entries - fifo command example:
*
* ---
* :pdt_delete:[response_file]\n
* sdomain
* domain\n
* \n
* --
*
* - the specified (sdomain, *, domain) entry will be deleted
* - '.' (dot) means NULL value and is not allowed
*/
/*
* How to see already defined entries - fifo command example:
*
* ---
* :pdt_list:[response_file]\n
* sdomain\n
* prefix\n
* domain\n
* \n
* --
*
* - '.' (dot) means NULL value
* - the comparison operation is 'START WITH' -- if domain is 'a' then
* all domains starting with 'a' are listed
*/
In the module directory under ./doc/ there are available example shell
scripts for these commands.
Any feedback is highly appreciated.
Regards,
Ramona