[OpenSER-Devel] LCR comments

Peter Spikings peter.spikings at power.net.uk
Wed Jul 4 10:41:44 CEST 2007


On Tuesday 03 July 2007 21:16:34 you wrote:
> Peter Spikings writes:
>  > Firstly why are the LCR entries sorted by prefix length and then by
>  > priority?
>
> because of the geographical thinking model behind lcr module where for
> example a country is served by a group of gws and then inside a country
> an area code is served by a group of gateways.

Yes, I know that prefix length should be one of the things sorted on so
that it's possible to automatically use longer matches where possible,
however I think that if you want to override this behaviour then you
should be able to or having setting LCR up to route ALL calls to a specific
gateway and then falling back to others if that fails based on the called
prefix becomes impossible.

E.g. here are some illustrating rows from my setup:

LCR:
+----+----------+----------+----------+--------+
| id | from_uri | priority | group_id | prefix |
+----+----------+----------+----------+--------+
|  1 |          |        1 |        1 |        |
|  3 |          |       11 |        3 | 01234  |
|  4 |          |       11 |        3 | 01235  |
|  5 |          |       11 |        3 | 01236  |
| 16 |          |       21 |        2 | 01     |
| 17 |          |       21 |        2 | 02     |
| 18 |          |       21 |        2 | 03     |
+----+----------+----------+----------+--------+

GW:
+----+---------------+------------+------+------------+-----------+----------+-------+--------+
| id | name          | ip_addr    | port | uri_scheme | transport | group_id | strip | prefix |
+----+---------------+------------+------+------------+-----------+----------+-------+--------+
|  2 | B             | X          | 5061 |          1 |         1 |        2 |     0 | 00002  |
|  1 | A             | Y          | 5060 |          1 |         1 |        1 |     0 |        |
|  3 | B             | X          | 5061 |          1 |         1 |        3 |     0 | 00003  |
+----+---------------+------------+------+------------+-----------+----------+-------+--------+

Now that it sorts by prioirty first this does what I want which is to try
gateway A first always. Then it should try gateway B with a prefix of 00002
but only if the prefix matches 0123[4-6]. Then try gateway B with a prefix
of 00003 if the prefix matches 01,02,03. It's setup this way because
gateway A is the cheapest to use, but we need to fall back to gateway B
if A is down or too busy. Gateway B has two routes out of it and which one
to pick depends on the called prefix.

I guess my main point is that I agree that long prefixes should match first
over short ones but there needs to be a way to override that behaviour and
the priority column is the obvious way. If you want automatic selection
based on prefix length all you'd need to do is give them the same priority.

>  > Another issue I had (and see my setup again) was that duplicates in
>  > the list of entries are detected by comparing the IP addresses of the
>  > gateways. Surely it's far better (and again I changed the source to
>  > do this) to detect duplicates based on the group ID of the entry?
>
> is the end result the same, i.e., is this just an optimization?

No.... Once I'd made the above change I noticed that when I made a call
to a number starting with 01234 (in the exmaple above) that it tried A (which
I'd disabled for testing), then it tried B with a prefix of 00002 which I
also made reject the call. Then it stopped because it sees the IP of B
showing up twice and ignoring it as a duplicate - logically it wasn't a
duplicate of course. Once I changed it to match duplicates based on
group_id it worked fine.

Another thing I noticed but didn't change as it didn't affect me was that
when it does detect a duplicate it picks the highest prefix length to use.
Again this seems odd, if you have a duplicate routes to the same gateway,
one with a prefix of 01 and one with 01234 you want to use the entry with
the prefix of 01 surely so calls to 01987 don't get lost. In the case the
intent of the rules creator would be to route all 01 calls to the gateway
and it's probably a mistake to have the 01234 rule there.

Thanks,

Peter.
This message has been comprehensively scanned for viruses,
please visit http://www.avg.power.net.uk/ for details.



More information about the Devel mailing list