Sure... it's possible and actually pretty easy, dependent on how things are set up. Assuming, for the sake of argument, that you have two servers that handle PSTN calls and one handles calls to anywhere and one handles calls to only 36 countries:
I'd use the grp table for this sort of thing (although some people would use AVPops). I'd just add the users to a particular kind of group for all access....
In MySQL, you'd want to do something like:
insert into grp values('<username>','<domainname>','fullaccess',now());
Then, set a flag if the user is in that group...
if(is_user_in("Request-URI", "fullaccess"))
{
setflag(19);
};
Then... somewhere in an INVITE check block (or wherever, really), check for the URI and the flag.
if (uri =~ "^sip:00*")
{
if(isflagset(19))
{
log(1, "request for alternate 800 provider received\n");
rewritehostport("10.1.1.1:5060"); # PSTN for ALL numbers
forward(uri:host, uri:port);
route(1);
break;
}
else
{
log(1, "request for alternate 800 provider received\n");
rewritehostport("10.1.1.2:5060"); # PSTN for only 36 countries
forward(uri:host, uri:port);
route(1);
break;
};
};
Now, the trick comes when you DON'T have PSTN server separate for different countries...
THEN you might have to do some very in-depth rules based on the format of the URI to the 36 countries in question which really isn't THAT bad, but dependent on their numeric format for numbers, it could get annoying to specify each one (especially if they have differing formats for land line and mobile numbers). It's not undoable, though.
N.
On Mon, 10 Oct 2005 20:17:50 +0800, Nhadie wrote
> Hi All,
>
> I'd like to setup to groups, one that can call only around 36
countries and one that can call anywhere. Currently, when I see that the URI
starts with 00 i'll check if it belongs to the world-pstn group then it can
dial-out if not it's blocked. Is what I'm thinking
possible?
>
> TIA
>
> Regards,
> Nhadie