Hello and whansk for reply.
Sorry for my bad english please.
My config (working late in 3.2.x and not change):
#!define WITH_LCR
#!define LCR_RELAY
...
#!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
...
request_route {
xlog("L_INFO", "New request - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
....
# dispatch destinations to PSTN
route(PSTN);
# LCR route
route(LCR);
# user location service
#route(LOCATION);
route(RELAY);
..
}
# --=== LCR routing ===--
#
route[LCR] {
xlog("L_INFO","LCR: $rm <$ru>, rU=$rU and fu=$fu\n");
#!ifdef WITH_LCR
#xlog("L_INFO", "request uri is <$ru> and\n");
# Будем проверять 'From uri' по базе.
if (!load_gws(1, $rU, $fu)) {
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)])' and var= $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");
# Route to failure for failover
#!ifdef LCR_RELAY
route(RELAY);
#!else
route(LCRRELAY);
#!endif
} 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;
}
Try call:
SIP captre invite:
INVITE sip:5499@192.168.101.50:5070 SIP/2.0
Via: SIP/2.0/UDP 192.168.101.59:5070;rport;branch=z9hG4bK3cp0XvFZNvpea
Max-Forwards: 69
From: "5714" <sip:5714@192.168.101.59>;tag=2BrZF33pQvegB
To: <sip:5499@192.168.101.50:5070>
Call-ID: 99c1c267-3614-1230-1ab3-002655e85348
CSeq: 29795589 INVITE
Contact: <sip:gw+redfs.proxy@192.168.101.59:5070;transport=udp;gw=redfs.proxy>
User-Agent: FreeSWITCH-mod_sofia/1.1.beta1-git-7a147e4 2012-04-25 17-14-55 -0500
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO, REGISTER, REFER, NOTIFY
Supported: timer, precondition, path, replaces
Allow-Events: talk, hold, refer
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 248
X-CID: 912A0E22-BAA811E1-A590AB83-8626D1EF@192.168.101.9
X-FS-Support: update_display,send_info
Remote-Party-ID: "5714" <sip:5714@192.168.101.59>;party=calling;screen=no;privacy=off
v=0
o=FreeSWITCH 1340238120 1340238121 IN IP4 192.168.101.59
s=FreeSWITCH
c=IN IP4 192.168.101.59
t=0 0
m=audio 25186 RTP/AVP 98 101 13
a=rtpmap:98 iLBC/8000
a=fmtp:98 mode=20
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
And from tables:
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 | kaluga | 213.xxx.xxx.26 | NULL | 5060 | NULL | 1 | 1 | NULL | | NULL | 1 | NULL |
| 2 | 1 | Kama | 192.168.101.59 | NULL | 5070 | NULL | 1 | 1 | NULL | NULL | NULL | 1 | NULL |
| 3 | 1 | kaluga | 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 where id = 1 or id =5 ;
+----+--------+--------+-------------------------------+-------------+---------+---------+
| id | lcr_id | prefix | from_uri | request_uri | stopper | enabled |
+----+--------+--------+-------------------------------+-------------+---------+---------+
| 1 | 1 | 5498 | | NULL | 0 | 1 |
| 5 | 1 | 5499 | sip:5[78]\
d{2}@192.168.101.59 | NULL | 0 | 1 |
+----+--------+--------+-------------------------------+-------------+---------+---------+
2 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 |
| 7 | 1 | 6 | 1 | 10 | 1 |
| 8 | 1 | 7 | 1 | 10 | 1 |
| 9 | 1 | 8 | 1 | 10 | 1 |
+----+--------+---------+-------+----------+--------+
9 rows in set (0.00 sec)
Again, if number 5498 then working:
2012/6/21 Juha Heinanen
<jh@tutpro.com>
Alexey Mechanoshin writes:
> mysql> select * from lcr_rule where id=5;
> +----+--------+--------+-------------------------------+-------------+---------+---------+
> | id | lcr_id | prefix | from_uri | request_uri |
> stopper | enabled |
> +----+--------+--------+-------------------------------+-------------+---------+---------+
> | 5 | 1 | yyyy | sip:x[xx]\d{2}@xxx.xxx.xx.xx | NULL |
> 0 | 1 |
> +----+--------+--------+-------------------------------+-------------+---------+---------+
> and load_gw(...) skip this rule, in log:
> INFO: lcr [lcr_mod.c:1493]: skipping disabled <gw/rule> = <1/5>
the above message comes if enabled rule target cannot be added because
rule or gw is disabled.
> If remove value from 'from_ui' - rule enabled and all work.
this seems to indicate that rule is not loaded if from_uri is present,
but then you should get error message to syslog about bad from_uri.
i cannot say more without trying myself with your records.
-- 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
--
"В связи с отсутствием интереса общественности, конец света отменяется" (с) ?
С Уважением, Механошин Алексей