Issue Drouting prefix overlap

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue Drouting prefix overlap

Mickael HUBERT
Hi list,
I have a issue in my drouting module.

In fact I have many prefixes and overlap is not OK to me.

Example:

Prefix: 3669 (In France is premium rate number, 4 digits is talking clock service)

Prefix: 36.... (is prefix hungary)

In my dr_rule table is:

INSERT INTO `dr_rules` (`ruleid`, `groupid`, `prefix`, `timerec`, `priority`, `routeid`, `gwlist`, `attrs`, `description`) VALUES
(1, '1', '3', '', 1, '', '#1', NULL, 'All numbers 3XYZ'),
(2, '1', '36', '', 1, '', '#2', NULL, 'Hungary prefixe');

If +36 1 398 0344 (to hungary destination), Drouting module choose id 2 no ?
if 3669 (to clock service), drouting module choose id 2 too ?

how to differentiate this two prefixes?

thanks in advance

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Issue Drouting prefix overlap

Nick Altmann
By using another priority.

--
Nick


2013/3/5 Mickael HUBERT <[hidden email]>
Hi list,
I have a issue in my drouting module.

In fact I have many prefixes and overlap is not OK to me.

Example:

Prefix: 3669 (In France is premium rate number, 4 digits is talking clock service)

Prefix: 36.... (is prefix hungary)

In my dr_rule table is:

INSERT INTO `dr_rules` (`ruleid`, `groupid`, `prefix`, `timerec`, `priority`, `routeid`, `gwlist`, `attrs`, `description`) VALUES
(1, '1', '3', '', 1, '', '#1', NULL, 'All numbers 3XYZ'),
(2, '1', '36', '', 1, '', '#2', NULL, 'Hungary prefixe');

If +36 1 398 0344 (to hungary destination), Drouting module choose id 2 no ?
if 3669 (to clock service), drouting module choose id 2 too ?

how to differentiate this two prefixes?

thanks in advance

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Issue Drouting prefix overlap

Mickael HUBERT
Hi Nick,
call drouting command if(!do_routing(...)) with another priority ?

how ?

thanks

Le 05/03/2013 11:12, Nick Altmann a écrit :
By using another priority.

--
Nick


2013/3/5 Mickael HUBERT <[hidden email]>
Hi list,
I have a issue in my drouting module.

In fact I have many prefixes and overlap is not OK to me.

Example:

Prefix: 3669 (In France is premium rate number, 4 digits is talking clock service)

Prefix: 36.... (is prefix hungary)

In my dr_rule table is:

INSERT INTO `dr_rules` (`ruleid`, `groupid`, `prefix`, `timerec`, `priority`, `routeid`, `gwlist`, `attrs`, `description`) VALUES
(1, '1', '3', '', 1, '', '#1', NULL, 'All numbers 3XYZ'),
(2, '1', '36', '', 1, '', '#2', NULL, 'Hungary prefixe');

If +36 1 398 0344 (to hungary destination), Drouting module choose id 2 no ?
if 3669 (to clock service), drouting module choose id 2 too ?

how to differentiate this two prefixes?

thanks in advance

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Issue Drouting prefix overlap

Max Mühlbronner
Hi,

drouting will choose the rule/entry based on the longest matching prefix, which in your case is id2. But additionally you can assign a different priority to each of the rules.(change prio webinterface/DB)

If prefix "3" has a priority of 2 and prefix "36" only has a priority of 1, even if id2 would be the longest match according to the prefix (e.g. number/request uri is 36 1 398 0344) only the entry with priority 2 would be used. (id1)


Best Regards

Max M.

On 03/05/2013 11:44 AM, Mickael HUBERT wrote:
By using another priority.


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Issue Drouting prefix overlap

Bogdan-Andrei Iancu-2
In reply to this post by Mickael HUBERT
Hi  Mickael,

I guess your overlapping happens because the prefixes are not consistent as format. The 3669 is a France national number and 36xxx is international format.

If you want to put those numbers in the same routing group, you should consider having all in the same international format, to avoid collisions :
    +33 3669
    +36 xxxx

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 03/05/2013 11:25 AM, Mickael HUBERT wrote:
Hi list,
I have a issue in my drouting module.

In fact I have many prefixes and overlap is not OK to me.

Example:

Prefix: 3669 (In France is premium rate number, 4 digits is talking clock service)

Prefix: 36.... (is prefix hungary)

In my dr_rule table is:

INSERT INTO `dr_rules` (`ruleid`, `groupid`, `prefix`, `timerec`, `priority`, `routeid`, `gwlist`, `attrs`, `description`) VALUES
(1, '1', '3', '', 1, '', '#1', NULL, 'All numbers 3XYZ'),
(2, '1', '36', '', 1, '', '#2', NULL, 'Hungary prefixe');

If +36 1 398 0344 (to hungary destination), Drouting module choose id 2 no ?
if 3669 (to clock service), drouting module choose id 2 too ?

how to differentiate this two prefixes?

thanks in advance
_______________________________________________ Users mailing list [hidden email] http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Issue Drouting prefix overlap

Mickael HUBERT
Hi,
It's not OK for me, look:

If I have:
+33 366985475 (landline number in France)

and

+33 3669 (premium rate number in France)

In my DB in dr_rules table I have:

INSERT INTO `dr_rules` (`ruleid`, `groupid`, `prefix`, `timerec`, `priority`, `routeid`, `gwlist`, `attrs`, `description`) VALUES
(1, '1', '333', '', 1, '', '#1', NULL, 'all number 3XYZ'),

but landline number match with rule 1.

how to differentiate this two prefixes?

Actualy I've coded:

560      if(uri=~"^sip:3[0-9]{3}@" || uri=~"^sip:10[0-9]{2}@" || uri=~"^sip:118[0-9]{3}@") # premium rate number FRANCE no E164 format
561      { 
562         if(!do_routing("3"))
563         {  
564             send_reply("503","No Rules matching the URI");
565             xlog("L_ERR","$ci No DR_RULES matching the URI for DR_GROUP 3\n");
566             exit;
567         }
568      }
569      else # other number E164 format
570      {     
571             strip(1);
572             setflag(29);
573
574             if(!do_routing("1"))
575             {  
576                 send_reply("503","No Rules matching the URI");
577                 xlog("L_ERR","$ci No DR_RULES matching the URI for DR_GROUP 1\n");
578                 exit;
579             }
580      }

Should I continue with this code ? I will wish improve this code and make it simple ;)


Le 05/03/2013 14:07, Bogdan-Andrei Iancu a écrit :
Hi  Mickael,

I guess your overlapping happens because the prefixes are not consistent as format. The 3669 is a France national number and 36xxx is international format.

If you want to put those numbers in the same routing group, you should consider having all in the same international format, to avoid collisions :
    +33 3669
    +36 xxxx

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 03/05/2013 11:25 AM, Mickael HUBERT wrote:
Hi list,
I have a issue in my drouting module.

In fact I have many prefixes and overlap is not OK to me.

Example:

Prefix: 3669 (In France is premium rate number, 4 digits is talking clock service)

Prefix: 36.... (is prefix hungary)

In my dr_rule table is:

INSERT INTO `dr_rules` (`ruleid`, `groupid`, `prefix`, `timerec`, `priority`, `routeid`, `gwlist`, `attrs`, `description`) VALUES
(1, '1', '3', '', 1, '', '#1', NULL, 'All numbers 3XYZ'),
(2, '1', '36', '', 1, '', '#2', NULL, 'Hungary prefixe');

If +36 1 398 0344 (to hungary destination), Drouting module choose id 2 no ?
if 3669 (to clock service), drouting module choose id 2 too ?

how to differentiate this two prefixes?

thanks in advance
_______________________________________________ Users mailing list [hidden email] http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Issue Drouting prefix overlap

Bogdan-Andrei Iancu-2
Hi Mickael,

In this case I would suggest using 2 groups of rules - one for the short numbers, one for the normal numbers.

First try the short numbers and enforce the matching based on the len of the number (I guess the premium numbers have some fix len) ; also consider the L flag (see http://www.opensips.org/html/docs/modules/1.9.x/drouting.html#id293614).

If this first matching failed -> try in the second group with the long numbers.

More or less, your approach seems correct, I would say.

Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 03/06/2013 12:09 PM, Mickael HUBERT wrote:
Hi,
It's not OK for me, look:

If I have:
+33 366985475 (landline number in France)

and

+33 3669 (premium rate number in France)

In my DB in dr_rules table I have:

INSERT INTO `dr_rules` (`ruleid`, `groupid`, `prefix`, `timerec`, `priority`, `routeid`, `gwlist`, `attrs`, `description`) VALUES
(1, '1', '333', '', 1, '', '#1', NULL, 'all number 3XYZ'),

but landline number match with rule 1.

how to differentiate this two prefixes?

Actualy I've coded:

560      if(uri=~"^<a class="moz-txt-link-freetext" href="sip:3">sip:3[0-9]{3}@" || uri=~"^<a class="moz-txt-link-freetext" href="sip:10">sip:10[0-9]{2}@" || uri=~"^<a class="moz-txt-link-freetext" href="sip:118">sip:118[0-9]{3}@") # premium rate number FRANCE no E164 format
561      { 
562         if(!do_routing("3"))
563         {  
564             send_reply("503","No Rules matching the URI");
565             xlog("L_ERR","$ci No DR_RULES matching the URI for DR_GROUP 3\n");
566             exit;
567         }
568      }
569      else # other number E164 format
570      {     
571             strip(1);
572             setflag(29);
573
574             if(!do_routing("1"))
575             {  
576                 send_reply("503","No Rules matching the URI");
577                 xlog("L_ERR","$ci No DR_RULES matching the URI for DR_GROUP 1\n");
578                 exit;
579             }
580      }

Should I continue with this code ? I will wish improve this code and make it simple ;)


Le 05/03/2013 14:07, Bogdan-Andrei Iancu a écrit :
Hi  Mickael,

I guess your overlapping happens because the prefixes are not consistent as format. The 3669 is a France national number and 36xxx is international format.

If you want to put those numbers in the same routing group, you should consider having all in the same international format, to avoid collisions :
    +33 3669
    +36 xxxx

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 03/05/2013 11:25 AM, Mickael HUBERT wrote:
Hi list,
I have a issue in my drouting module.

In fact I have many prefixes and overlap is not OK to me.

Example:

Prefix: 3669 (In France is premium rate number, 4 digits is talking clock service)

Prefix: 36.... (is prefix hungary)

In my dr_rule table is:

INSERT INTO `dr_rules` (`ruleid`, `groupid`, `prefix`, `timerec`, `priority`, `routeid`, `gwlist`, `attrs`, `description`) VALUES
(1, '1', '3', '', 1, '', '#1', NULL, 'All numbers 3XYZ'),
(2, '1', '36', '', 1, '', '#2', NULL, 'Hungary prefixe');

If +36 1 398 0344 (to hungary destination), Drouting module choose id 2 no ?
if 3669 (to clock service), drouting module choose id 2 too ?

how to differentiate this two prefixes?

thanks in advance
_______________________________________________ Users mailing list [hidden email] http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Issue Drouting prefix overlap

Mickael HUBERT
Thanks to your response.

I will testing this solution

bye

Le 06/03/2013 11:54, Bogdan-Andrei Iancu a écrit :
Hi Mickael,

In this case I would suggest using 2 groups of rules - one for the short numbers, one for the normal numbers.

First try the short numbers and enforce the matching based on the len of the number (I guess the premium numbers have some fix len) ; also consider the L flag (see http://www.opensips.org/html/docs/modules/1.9.x/drouting.html#id293614).

If this first matching failed -> try in the second group with the long numbers.

More or less, your approach seems correct, I would say.

Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 03/06/2013 12:09 PM, Mickael HUBERT wrote:
Hi,
It's not OK for me, look:

If I have:
+33 366985475 (landline number in France)

and

+33 3669 (premium rate number in France)

In my DB in dr_rules table I have:

INSERT INTO `dr_rules` (`ruleid`, `groupid`, `prefix`, `timerec`, `priority`, `routeid`, `gwlist`, `attrs`, `description`) VALUES
(1, '1', '333', '', 1, '', '#1', NULL, 'all number 3XYZ'),

but landline number match with rule 1.

how to differentiate this two prefixes?

Actualy I've coded:

560      if(uri=~"^<a moz-do-not-send="true" class="moz-txt-link-freetext" href="sip:3">sip:3[0-9]{3}@" || uri=~"^<a moz-do-not-send="true" class="moz-txt-link-freetext" href="sip:10">sip:10[0-9]{2}@" || uri=~"^<a moz-do-not-send="true" class="moz-txt-link-freetext" href="sip:118">sip:118[0-9]{3}@") # premium rate number FRANCE no E164 format
561      { 
562         if(!do_routing("3"))
563         {  
564             send_reply("503","No Rules matching the URI");
565             xlog("L_ERR","$ci No DR_RULES matching the URI for DR_GROUP 3\n");
566             exit;
567         }
568      }
569      else # other number E164 format
570      {     
571             strip(1);
572             setflag(29);
573
574             if(!do_routing("1"))
575             {  
576                 send_reply("503","No Rules matching the URI");
577                 xlog("L_ERR","$ci No DR_RULES matching the URI for DR_GROUP 1\n");
578                 exit;
579             }
580      }

Should I continue with this code ? I will wish improve this code and make it simple ;)


Le 05/03/2013 14:07, Bogdan-Andrei Iancu a écrit :
Hi  Mickael,

I guess your overlapping happens because the prefixes are not consistent as format. The 3669 is a France national number and 36xxx is international format.

If you want to put those numbers in the same routing group, you should consider having all in the same international format, to avoid collisions :
    +33 3669
    +36 xxxx

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 03/05/2013 11:25 AM, Mickael HUBERT wrote:
Hi list,
I have a issue in my drouting module.

In fact I have many prefixes and overlap is not OK to me.

Example:

Prefix: 3669 (In France is premium rate number, 4 digits is talking clock service)

Prefix: 36.... (is prefix hungary)

In my dr_rule table is:

INSERT INTO `dr_rules` (`ruleid`, `groupid`, `prefix`, `timerec`, `priority`, `routeid`, `gwlist`, `attrs`, `description`) VALUES
(1, '1', '3', '', 1, '', '#1', NULL, 'All numbers 3XYZ'),
(2, '1', '36', '', 1, '', '#2', NULL, 'Hungary prefixe');

If +36 1 398 0344 (to hungary destination), Drouting module choose id 2 no ?
if 3669 (to clock service), drouting module choose id 2 too ?

how to differentiate this two prefixes?

thanks in advance
_______________________________________________ Users mailing list [hidden email] http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users