Hi,
My script is almost done.
I am wondering how weights are calculated in order to choose proper gws list.
For this test I've modified gw table in following way (the same weights).
LCR table points to grp_id=1.
+----+----------------------+--------+----------------+----------+------+------------+-----------+-------+------+--------+------+-------+
| id | gw_name | grp_id | ip_addr | hostname |
port | uri_scheme | transport | strip | tag | weight | ping | flags |
+----+----------------------+--------+----------------+----------+------+------------+-----------+-------+------+--------+------+-------+
| 1 | GW11 | 11 | 33.44.55.66 | NULL | 5060 |
NULL | NULL | NULL | NULL | 100 | 0 | 0 |
| 2 | GW1 group 1 | 1 | 11.22.33.10 | NULL | 5060 |
NULL | NULL | NULL | NULL | 100 | 0 | 0 |
| 3 | GW5 | 2 | 22.33.44.55 | NULL | 5060 |
NULL | NULL | NULL | NULL | 100 | 0 | 0 |
| 4 | GW6 | 3 | 22.33.44.56 | NULL | 5060 |
NULL | NULL | NULL | NULL | 100 | 0 | 0 |
| 5 | GW2 group 1 | 1 | 11.22.33.11 | NULL | 5060 |
NULL | NULL | NULL | NULL | 100 | 0 | 0 |
| 6 | GW3 group 1 | 1 | 11.22.33.12 | NULL | 5060 |
NULL | NULL | NULL | NULL | 100 | 0 | 0 |
| 7 | GW4 group 1 | 1 | 11.22.33.13 | NULL | 5060 |
NULL | NULL | NULL | NULL | 100 | 0 | 0 |
+----+----------------------+--------+----------------+----------+------+------------+-----------+-------+------+--------+------+-------+
According to syslog debugs:
Jul 7 09:16:06 skype-sip01 /usr/local/sbin/kamailio[12321]:
DBG:lcr:lcr_hash_table_lookup: looking for <482221>
Jul 7 09:16:06 skype-sip01 /usr/local/sbin/kamailio[12321]:
DBG:lcr:lcr_hash_table_lookup: looking for <48222>
Jul 7 09:16:06 skype-sip01 /usr/local/sbin/kamailio[12321]:
DBG:lcr:do_load_gws: added matched_gws[0]=[2, 5, 1, 238659200]
Jul 7 09:16:06 skype-sip01 /usr/local/sbin/kamailio[12321]:
DBG:lcr:do_load_gws: added matched_gws[1]=[6, 5, 1, 13052500]
Jul 7 09:16:06 skype-sip01 /usr/local/sbin/kamailio[12321]:
DBG:lcr:do_load_gws: added matched_gws[2]=[5, 5, 1, 769501300]
Jul 7 09:16:06 skype-sip01 /usr/local/sbin/kamailio[12321]:
DBG:lcr:do_load_gws: added matched_gws[3]=[3, 5, 1, 440887600]
Jul 7 09:16:06 skype-sip01 /usr/local/sbin/kamailio[12321]:
DBG:lcr:lcr_hash_table_lookup: looking for <4822>
Jul 7 09:16:06 skype-sip01 /usr/local/sbin/kamailio[12321]:
DBG:lcr:lcr_hash_table_lookup: looking for <482>
Jul 7 09:16:06 skype-sip01 /usr/local/sbin/kamailio[12321]:
DBG:lcr:lcr_hash_table_lookup: looking for <48>
Jul 7 09:16:06 skype-sip01 /usr/local/sbin/kamailio[12321]:
DBG:lcr:add_gws_into_avps: added gw_uri_avp
<1|0||4274347715||5060|0|0> with weight <13052500>
Jul 7 09:16:06 skype-sip01 /usr/local/sbin/kamailio[12321]:
DBG:lcr:add_gws_into_avps: added gw_uri_avp
<1|0||3552927427||5060|0|0> with weight <238659200>
Jul 7 09:16:06 skype-sip01 /usr/local/sbin/kamailio[12321]:
DBG:lcr:add_gws_into_avps: added gw_uri_avp
<1|0||3569704643||5060|0|0> with weight <440887600>
Jul 7 09:16:06 skype-sip01 /usr/local/sbin/kamailio[12321]:
DBG:lcr:add_gws_into_avps: added gw_uri_avp
<1|0||4240793283||5060|0|0> with weight <769501300>
Jul 7 09:16:06 skype-sip01 /usr/local/sbin/kamailio[12321]:
DBG:lcr:generate_uris: r_uri <sip:48221112233@11.22.33.12:5060>,
dst_uri <>
Jul 7 09:16:06 skype-sip01 /usr/local/sbin/kamailio[12321]:
DBG:lcr:next_gw: added ruri_user_avp <48221112233>
Jul 7 09:16:06 skype-sip01 /usr/local/sbin/kamailio[12321]:
DBG:lcr:next_gw: added flags_avp <0>
So it means that weights are calculated different way, not directly
and only according to weight column.
What is more defining wieght column does not make any sense, because
data provided there produce different output.
Anybody could point me in right direction.
Thanks,
Maciej.