[Serusers] denying call based on country codes

Iqbal iqbal at gigo.co.uk
Mon Oct 10 15:12:37 CEST 2005


yup thats where the problem comes, when you have complex rules for 
instance I have about 25 different packages for different countries and 
prefixes, eg some include UK mobiles others not, which means I have to 
breakdown into the prefix set for each mobile carrier. I am sure there 
is a better way, than grp and if else, I just havent worked it out :-)

Currently a user is linked to a grp, but there is no nice way of linking 
this grp table to the lcr table, or for that matter to dialed prefixes 
outside of the ser.cfg, unless someone has done a nice mysql lookup for 
this.
Iqbal

sip wrote:

> *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
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Serusers mailing list
>serusers at lists.iptel.org
>http://lists.iptel.org/mailman/listinfo/serusers
>  
>




More information about the sr-users mailing list