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.
-- "В связи с отсутствием интереса общественности, конец света отменяется" (с) ? С Уважением, Механошин Алексей
Alexey Mechanoshin writes:
Please help me change my config to working routing by checking 'from_uri' .
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
based on the above, looks like your from uri is sip:5491@192.xxx.xxx.59. if so, that does not match to from_uri in your lcr_rule table:
| 5 | 1 | 5499 | sip:192.xxx.xxx.59 | 1 | 1 |
-- juha
Thanks for reply.
Ok, my change in DB to : | 5 | 1 | 5499 | sip:5714@192.xxx.xxx.59 | 0 | 1 | and restart kamailio.
Then, in cfg: request_route { xlog("L_INFO", "New request - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); Log: New request - M=INVITE RURI=sip:5499@192.xxx.xxx.50:5070 F=sip:5714@192.xxx.xxx.59 T=sip:5499@192.xxx.xxx.50:5070 IP=192.xxx.xxx.59 INFO: <script>: No More Gateways …
PS Before sending to mail-list my try any combinations :-(
2012/4/11 Juha Heinanen jh@tutpro.com:
Alexey Mechanoshin writes:
Please help me change my config to working routing by checking 'from_uri' .
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
based on the above, looks like your from uri is sip:5491@192.xxx.xxx.59. if so, that does not match to from_uri in your lcr_rule table:
| 5 | 1 | 5499 | sip:192.xxx.xxx.59 | 1 | 1 |
-- juha
i added a dbg statement in lcr_mod.c that prints log message if from uri matching fails. you can try with latest master and see what you get into syslog at debug level 3 or convert load_gws() LM_DBG statement to LM_INFO statements and try at debug level 2.
-- juha
Ok, change to LM_INFO and retry invite from master branch, by kamailio: #make FLAVOUR=kamailio cfg ... #make deb (Debian squeze)
Apr 11 17:55:41 r59vredfs /usr/sbin/kamailio[14873]: INFO: <script>: Entering route[LCR] for method: INVITE sip:5499@192.xxx.xxx.50:5070, and rU=5499, caller_uri='0' Apr 11 17:55:41 r59vredfs /usr/sbin/kamailio[14873]: INFO: <script>: request uri is sip:5499@192.xxx.xxx.50:5070 Apr 11 17:55:41 r59vredfs /usr/sbin/kamailio[14873]: INFO: lcr [lcr_mod.c:1835]: from uri <> did not match to from regex sip:5714@192.xxx.xxx.59 Apr 11 17:55:41 r59vredfs /usr/sbin/kamailio[14873]: INFO: <script>: No More Gateways …
2012/4/11 Juha Heinanen jh@tutpro.com:
i added a dbg statement in lcr_mod.c that prints log message if from uri matching fails. you can try with latest master and see what you get into syslog at debug level 3 or convert load_gws() LM_DBG statement to LM_INFO statements and try at debug level 2.
-- juha
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Alexey Mechanoshin writes:
Apr 11 17:55:41 r59vredfs /usr/sbin/kamailio[14873]: INFO: <script>: request uri is sip:5499@192.xxx.xxx.50:5070 Apr 11 17:55:41 r59vredfs /usr/sbin/kamailio[14873]: INFO: lcr [lcr_mod.c:1835]: from uri <> did not match to from regex sip:5714@192.xxx.xxx.59
your from uri is empty string. check that you call load_gws() with proper arguments:
4.1. load_gws(lcr_id[, uri_user[, caller_uri]])
Loads attributes of matching gateways to gw_uri_avp (see Overview section). Argument lcr_id specifies the used LCR instance. It can be an integer or a pseudo variable containing an integer value. If uri_user is given, it is used, instead of Request-URI user part, to look for matching gateways. Caller's URI may be given by caller_uri argument. If caller_uri argument is omitted, it defaults to empty string. Both uri_user and caller_uri argument may be a string or a pseudo variable containing a sting value.
-- juha
If uri_user is given, it is used, instead of Request-URI user part, to look for matching gateways
In my config only lcr_id: ... mhomed=1 ... if (!load_gws(1)) { ... and not local registered user and not allow local users subscribe. A'm this calls: 192.xxx.xxx.59 192.xxx.xxx.50 [calling party] ---> FreeSwitch ------192.xxx.xxx.0/24 network----------------------------------->(eth1) Kamailio(eth0) ----> next by IP, getting from LCR --> INVITE only numver, as by not registered gateway
I.e. if I am not registered on Kamailio that to me the given check does not approach?
My test change simple load_gws(1) to load_gws(1,$fU) and this bad routing: |Time | 192.xxx.xxx.59 | | | | 192.xxx.xxx.50 | |0,000 | INVITE SDP (iLBCRTPType-98 telephone-eventRTPT...-101 CN) |SIP From: "5714" <sip:5714@192.xxx.xxx.59 To:<sip:5499@192.xxx.xxx.50:5070 | |(5070) ------------------> (5070) | |0,001 | 100 trying -- your call is important to us |SIP Status | |(5070) <------------------ (5070) | |0,002 | INVITE SDP (iLBCRTPType-98 telephone-eventRTPT...-101 CN) |SIP Request | |(5070) <------------------ (5070) | |0,002 | 100 Trying| |SIP Status | |(5070) ------------------> (5070) | |0,046 | 480 Temporarily Unavailable |SIP Status | |(5070) ------------------> (5070) | |0,046 | ACK | |SIP Request | |(5070) <------------------ (5070) | |0,047 | 480 Temporarily Unavailable |SIP Status | |(5070) <------------------ (5070) | |0,048 | ACK | |SIP Request | |(5070) ------------------> (5070) |
I'm new to set up, and not all understand.
2012/4/11 Juha Heinanen jh@tutpro.com:
your from uri is empty string. check that you call load_gws() with proper arguments:
4.1. load_gws(lcr_id[, uri_user[, caller_uri]])
Alexey Mechanoshin writes:
If uri_user is given, it is used, instead of Request-URI user part, to look for matching gateways.
yes, but since you need also caller's uri, you must call load_gw() like this:
if (!load_gws(1, $rU, $fu)) {
My test change simple load_gws(1) to load_gws(1,$fU) and this bad routing:
see above, second param is uri_user, not caller_uri.
-- juha
Thanks, it works as expected.
2012/4/12 Juha Heinanen jh@tutpro.com: if (!load_gws(1, $rU, $fu)) {