Stefan Prelle writes:
I just noticed something weird when working with the
lcr module.
My setup has 5 gateways - 4 in group 1, one in group 2. The lcr-table
has an entry for each group, both reacting on the same prefix.
I am using
load_gws_from_grp("1")
to get a gateway for a target. This usually works fine.
If now all 4 gateways in group 1 ar disabled because the alive check
failed, load_gws_from_grp("1") returns the gateway from group 2 (or
other groups where the prefix from the lcr-table matches.
I would consider this a bug, since I explicitly requested gateways from
a specific group.
stefan,
i was not able to reproduce this. i have
# kamctl fifo lcr_gw_dump
GW:: GRP_ID=8 IP_ADD=192.98.101.11 HOSTNAME= PORT=5060 SCHEME=sip TRANSPORT=udp STRIP=0
TAG= WEIGHT=1 FLAGS=35 PING=0
GW:: GRP_ID=8 IP_ADD=192.98.101.12 HOSTNAME= PORT=5060 SCHEME=sip TRANSPORT=udp STRIP=0
TAG= WEIGHT=1 FLAGS=35 PING=0
GW:: GRP_ID=8 IP_ADD=192.98.101.13 HOSTNAME= PORT=5060 SCHEME=sip TRANSPORT=udp STRIP=0
TAG= WEIGHT=1 FLAGS=35 PING=0
GW:: GRP_ID=8 IP_ADD=192.98.101.14 HOSTNAME= PORT=5060 SCHEME=sip TRANSPORT=udp STRIP=0
TAG= WEIGHT=1 FLAGS=35 PING=0
GW:: GRP_ID=9 IP_ADD=192.98.101.21 HOSTNAME= PORT=5060 SCHEME=sip TRANSPORT=udp STRIP=0
TAG= WEIGHT=1 FLAGS=35 PING=0
# kamctl fifo lcr_lcr_dump
RULE:: PREFIX=0 FROM_URI= GRP_ID=9 PRIORITY=1
RULE:: PREFIX=0 FROM_URI= GRP_ID=8 PRIORITY=1
PREFIX_LENS:: PREFIX_LEN=1
then in load_gws_from_grp i changed the DBG to ERR:
LM_ERR("added matched_gws[%d]=[%u, %u, %u, %u]\n",
gw_index, next_index, 0, 1,
matched_gws[gw_index].weight);
when i call load_gws_from_grp("8") i get:
Mar 10 04:56:09 taimen /usr/sbin/kamailio[12199]: ERROR:lcr:load_gws_from_grp: added
matched_gws[0]=[1, 0, 1, 1364086043]
Mar 10 04:56:09 taimen /usr/sbin/kamailio[12199]: ERROR:lcr:load_gws_from_grp: added
matched_gws[1]=[4, 0, 1, 85553043]
Mar 10 04:56:09 taimen /usr/sbin/kamailio[12199]: ERROR:lcr:load_gws_from_grp: added
matched_gws[2]=[3, 0, 1, 1947781210]
Mar 10 04:56:09 taimen /usr/sbin/kamailio[12199]: ERROR:lcr:load_gws_from_grp: added
matched_gws[3]=[2, 0, 1, 1232419718]
i.e., that is the four gws from grp_id=8.
try a similar debug with your setup.
-- juha