Hello all.
In my config added LCR routing by this manual:
http://www.amitnepal.com/using-lcr-with-kamailio/ and if added, to
'lcr_rule' table, uri to 'from_uri' column - kamailio always reply 503
- 'No More Gateways' :-( If remove data - routing work. A'm using last
kamailio from git ...
Please help me change my config to working routing by checking 'from_uri' .
Need check routing prefix 5499 only from IP 192.xxx.xxx.59 , as example.
In Log:
Apr 10 17:01:23 r59vredfs /usr/sbin/kamailio[29582]: INFO: <script>:
New request - M=INVITE RURI=sip:5499@192.xxx.xxx.50:5070
F=sip:5491@192.xxx.xxx.59 T=sip:5499@192.xxx.xxx.50:5070
IP=192.xxx.xxx.59 ID=6c518b61-fd9f-122f-91b7-002655e85348
Apr 10 17:01:23 r59vredfs /usr/sbin/kamailio[29582]: INFO: <script>:
Entering route[LCR] for method: INVITE <sip:5499@192.xxx.xxx.50:5070>,
and rU=5499, caller_uri='0'
Apr 10 17:01:23 r59vredfs /usr/sbin/kamailio[29582]: INFO: <script>:
No More Gateways …
Apr 10 17:01:23 r59vredfs /usr/sbin/kamailio[29582]: INFO: <script>:
Send back 503 code …
MySQL data:
mysql> select * from lcr_rule;
+----+--------+--------+----------+---------+---------+
| id | lcr_id | prefix | from_uri | stopper | enabled |
+----+--------+--------+----------+---------+---------+
| 1 | 1 | 5498 | | 0 | 1 |
| 2 | 1 | 57 | NULL | 0 | 1 |
| 3 | 1 | 58 | NULL | 0 | 1 |
| 4 | 1 | 541 | NULL | 0 | 1 |
| 5 | 1 | 5499 | sip:192.xxx.xxx.59 | 1 | 1 |
+----+--------+--------+----------+---------+---------+
5 rows in set (0.00 sec)
mysql> select * from lcr_gw;
+----+--------+---------+----------------+----------+------+--------+------------+-----------+-------+--------+------+-------+---------+
| id | lcr_id | gw_name | ip_addr | hostname | port | params |
uri_scheme | transport | strip | prefix | tag | flags | defunct |
+----+--------+---------+----------------+----------+------+--------+------------+-----------+-------+--------+------+-------+---------+
| 1 | 1 | route1 | 213.xxx.xxx.26 | NULL | 5060 | NULL |
1 | 1 | NULL | | NULL | 1 | NULL |
| 2 | 1 | routemy | 192.xxx.xxx.59 | NULL | 5070 | NULL
| 1 | 1 | NULL | NULL | NULL | 1 | NULL |
| 3 | 1 | route1 | 213.xxx.xxx.27 | NULL | 5060 | NULL |
1 | 1 | NULL | NULL | NULL | 1 | NULL |
+----+--------+---------+----------------+----------+------+--------+------------+-----------+-------+--------+------+-------+---------+
3 rows in set (0.00 sec)
mysql> select * from lcr_rule_target;
+----+--------+---------+-------+----------+--------+
| id | lcr_id | rule_id | gw_id | priority | weight |
+----+--------+---------+-------+----------+--------+
| 1 | 1 | 1 | 1 | 10 | 1 |
| 2 | 1 | 2 | 2 | 10 | 1 |
| 3 | 1 | 3 | 2 | 10 | 1 |
| 4 | 1 | 4 | 2 | 10 | 1 |
| 5 | 1 | 5 | 1 | 10 | 1 |
| 6 | 1 | 5 | 3 | 20 | 1 |
+----+--------+---------+-------+----------+--------+
6 rows in set (0.00 sec)
Config:
#!define WITH_LCR
...
#!ifdef WITH_LCR
loadmodule "avpops.so"
loadmodule "lcr.so"
#!endif
...
#!ifdef WITH_LCR
modparam("lcr", "db_url",DBURL)
modparam("lcr", "gw_uri_avp", "$avp(i:709)")
modparam("lcr", "ruri_user_avp", "$avp(i:500)")
modparam("lcr", "flags_avp", "$avp(i:712)")
modparam("lcr", "lcr_id_avp", "$avp(s:lcr_id_avp)")
#!endif
...
# dispatch destinations to PSTN
route(PSTN);
# LCR route
route(LCR);
# user location service
#route(LOCATION);
...
# --=== LCR routing ===--
#
route[LCR] {
xlog("L_INFO","Entering route[LCR] for method: $rm <$ru>, and
rU=$rU, caller_uri='$var(caller_uri)'\n");
#!ifdef WITH_LCR
### if (!load_gws(1)) {
### if (!load_gws(1, $rU)) {
if (!load_gws(1)) {
sl_send_reply("500", "Server Internal Error - Cannot load
gateways");
exit;
} else {
$var(i) = 0;
while(is_avp_set("$(avp(i:709)[$var(i)])")) {
xlog("L_INFO", "loading
gw_uri_avp[$var(i)]='$(avp(i:709)[$var(i)])'\n");
$var(i) = $var(i) + 1;
}
if(is_avp_set("$avp(i:709)")) {
xlog("L_INFO", "Trying gateway '$avp(i:709)'\n");
} else {
xlog("L_INFO", "No More Gateways …\n");
}
# try the first matched gateway
if (next_gw()) {
xlog("L_INFO", "ruri_user_avp='$avp(i:500)'\n");
# Print AVP - for debug
#avp_print();
# Route to failure for failover
route(RELAY);
} else {
avp_print();
xlog("L_INFO", "Send back 503 code …\n");
sl_send_reply("503", "No available gateways");
exit;
}
}
#!endif
#sl_send_reply("503", "Service Unavailable");
#exit;
return;
}
PS Sorry for my bad English please.
--
"В связи с отсутствием интереса общественности, конец света отменяется" (с) ?
С Уважением, Механошин Алексей