Hi, kamailio 1.5.4, let's suppose the following tables for LCR:
lcr:
+----+-----------+-------------+---------+----------+
| id l prefix | from_uri | grp_id | priority |
+----+-----------+-------------+---------+----------+
| 1 | NULL | NULL | 1 | 1 |
| 2 | NULL | NULL | 2 | 2 |
+----+-----------+-------------+---------+----------+
gw:
+----+--------+---------------------+------+-----------+
| id | grp_id | ip_addr | port | weight |
+-----+--------+---------------------+------+-----------+
| 1 | 1 | 1.1.1.1 | 5060 | 1 |
| 2 | 1 | 2.2.2.2 | 5060 | 1 |
| 3 | 2 | 2.2.2.2 | 5062 | 1 |
+----+--------+--------+---------------------+---------+
IMHO it's clear what *should* occur when a request arrives and
load_gw() is called:
1) First the rule 1 should be executed, so gws with id 1 and 2 would
be tested (when invoking next_gw() in route and failure_route).
2) In case both gws fail them the gw 3 should be used.
However this is what occurs:
DBG:lcr:do_load_gws: added matched_gws[0]=[3, 1, 2, 2460706]
DBG:lcr:do_load_gws: added matched_gws[1]=[1, 1, 1, 3162440]
DBG:lcr:add_gws_into_avps: added gw_uri_avp <1|0||33686018||5062|0|0>
DBG:lcr:add_gws_into_avps: added gw_uri_avp <1|0||16843009||5060|0|0>
This is, just gws 1 and 2 are loaded in gw_uri_avp (or sometimes gws 1
and 3). Note that gws 2 and 3 have same IP but *different* port, so
there is no reason at all not to load gw 3.
IMHO this shouldn't be the behavior, in fact it seems buggy IMHO. I
know that same occurs in 3.0 version. Any comment?
BTW I strongly think that LCR module should be improved and I would
like to do it. Some ideas I have in mind:
- Improve the tables design by having three tables: lcr_rules,
lcr_groups and lcr_gws.
- Allow loading same gw twice in gw_uri_avp when it belongs to
different lcr_rule/lcr_groups.
- An option to enable/dissable a gw (by setting a 0 in a new "enabled" column).
- Am option to allow stopping lcr_rules, this is, if the lcr_rule is
choosen (by priority/prefix/from_uri) and the request fails, no other
gateways from other lcr_rules would be tryed.
Well, I'll detail it further soon. Regards.
--
Iñaki Baz Castillo
<ibc(a)aliax.net>