[Kamailio-Devel] [ openser-Patches-1965211 ] [PDT] Patch to include "check_domain"
SourceForge.net
noreply at sourceforge.net
Mon Aug 25 13:21:50 CEST 2008
Patches item #1965211, was opened at 2008-05-16 11:47
Message generated for change (Comment added) made by ibc_sf
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=743022&aid=1965211&group_id=139143
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: modules
Group: ver 1.3.x
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Iaki Baz (ibc_sf)
Assigned to: Nobody/Anonymous (nobody)
Summary: [PDT] Patch to include "check_domain"
Initial Comment:
Hi, by default PDT module doesn't allow two entries in 'pdt' table with same "sdomain" and "domain" fields.
AFAIK OpenSer 1.4 includes a "check_table" parameter to allow the above.
I submit a patch that includes this feature for OpenSer 1.3.1 or 1.3.2.
I use it to implement international destination (by prefix) allow/deny system, this is, we can call to Spain, England, Finnland, USA, but not to Brasil (for example). For that I need a change in "pdt" table:
CREATE TABLE `pdt` (
`id` int(10) unsigned NOT NULL auto_increment,
`sdomain` varchar(128) NOT NULL default '*',
`prefix` varchar(32) NOT NULL,
`domain` enum('y','n') NOT NULL default 'y',
`description` varchar(20) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `sdomain_prefix_idx` (`sdomain`,`prefix`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
- 'sdomain' field doesn't matter and it can be whatever ('*' for example).
- 'domain' becomes a SQL ENUM field ('y', 'n').
If 'domain' == 'y' then the destination is allowed, if 'n' then not.
- 'description' can be the country code (or "Spain fixed", "England mobile"...).
- 'prefix' is the E164 country/destination prefix (+34, +349, +44...).
The OpenSer code would be:
----------------
modparam("pdt", "check_domain", 0)
...
route[ROUTE_IS_PREFIX_ALLOWED] {
# Here we must arrive with RURI normalize to E164 (+XXXXXXXXX).
prefix2domain("2");
# If success, the RURI domain is modified (to 'y' so we need to replace later with our carrier IP/domain).
# If -1 then the prefix doesn't exist so not allowed.
if ($rc != 1) {
xlog("L_INFO","--- Destination $rU not allowed \n");
return(-1);
}
# If "domain" is 'n' then this destiantion is not allowed (dissabled).
if ($rd == "n") {
xlog("L_INFO","--- Destination $rU dissabled \n");
return(-1);
}
return(1);
}
# If success remember to set the RURI domain after this route.
----------------
Hope it's useful.
----------------------------------------------------------------------
>Comment By: Iaki Baz (ibc_sf)
Date: 2008-08-25 13:21
Message:
Logged In: YES
user_id=1844020
Originator: YES
It just adds the feature from 1.4 to 1.3, no more.
PD: In the top of my report I say "check_table" when obviously I mean
"check_domain".
----------------------------------------------------------------------
Comment By: Henning Westerholt (henningw)
Date: 2008-08-25 12:58
Message:
Logged In: YES
user_id=337916
Originator: NO
Hi Iaki,
do i understand this correctly, this patch justs ports already available
functionality from 1.4 to the 1.3 version? Or do you also add some more
extensions?
Thanks,
Henning
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=743022&aid=1965211&group_id=139143
More information about the Devel
mailing list