Dear Bogdan,<br><br>Thanks very much for your time.<br><br>Regards,<br>-LN<br><br><div class="gmail_quote">On Tue, Mar 31, 2009 at 8:53 PM, Bogdan-Andrei Iancu <span dir="ltr"><<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Please use fix_nated_register() for REGISTER requests - this will set the appropriate info to be saved in usrloc.<br>
<br>
fix_nated_register() is not changing the contact (so the usrloc will save the real contact), but is just setting some additional info to be saved in usrloc (the received field)<br>
<br>
fix_nated_contact() is actually changing the contact from the request - this is to be used for non-REGISTER requests.<div class="im"><br>
<br>
Regards,<br>
Bogdan<br>
<br>
oso che bol wrote:<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">
<br>
Dear Bogdan<br>
<br>
I change the config of NATed REGISTER request to:<br>
<br>
/ if (nat_uac_test("19")) {<br>
if (is_method("REGISTER") || !search("^Record-Route")) {<br>
log("LOG: HTK Someone trying to register from private IP, rewriting\n");<br>
fix_nated_contact(); # Rewrite contact with source IP of signalling<br>
force_rport(); # Add rport parameter to topmost Via<br>
setbflag(6); # Mark as NATed<br>
if (method=="INVITE") {<br>
fix_nated_sdp("1"); # Add direction=active to SDP<br>
force_rport(); # Add rport parameter to topmost Via<br>
setbflag(6); # Mark as NATed<br>
};<br>
};/<br>
<br>
Output of "opensipsctl ul show":<br>
<br>
/[root@LN]# opensipsctl ul show<br>
database engine 'MYSQL' loaded<br>
Control engine 'FIFO' loaded<br>
entering fifo_cmd ul_dump<br>
Mar 31 07:17:27 [6412] DBG:mi_fifo:mi_parse_node: end of input tree<br>
Mar 31 07:17:27 [6412] DBG:mi_fifo:mi_fifo_server: done parsing the mi tree<br>
Domain:: aliases table=512 records=0 max_slot=0<br>
Domain:: location table=512 records=2 max_slot=1<br>
AOR:: 5000<br>
Contact:: sip:5000@77.69.220.94:5060;transport=UDP Q=<br>
Expires:: 1038<br>
Callid:: A9AOj5F5oIeDS04U53IMr4_65zZvf5<br>
Cseq:: 6049<br>
User-agent:: E66-1 RM-343 102.07.81<br>
State:: CS_SYNC<br>
Flags:: 0<br>
Cflag:: 64<br>
Socket:: udp:174.132.X.Y:5060<br>
Methods:: 4294967295<br>
AOR:: 6000<br>
Contact:: sip:6000@58.186.156.135:11370;rinstance=dbe921dccef4bee4 Q=<br>
Expires:: 1060<br>
Callid:: MDdmOTVkNzAzODAxN2JiMjk0MTk1NTEwNThjOWE2ZTM.<br>
Cseq:: 6<br>
User-agent:: X-Lite release 1100l stamp 47546<br>
State:: CS_SYNC<br>
Flags:: 0<br>
Cflag:: 64<br>
Socket:: udp:174.132.X.Y:5060<br>
Methods:: 5951<br>
FIFO command was:<br>
:ul_dump:opensips_receiver_6568/<br>
<br>
Could you please explain why with mobile user 5000, the contact /sip:5000@77.69.220.94:5060;transport=UDP /and with X-Lite User 6000 the contact is /6000@58.186.156.135:11370;rinstance=dbe921dccef4bee4/<br>
<br>
How fix_nated_register() differ with fix_nated_register(), do we need to call fix_nated_register() at REGISTER processing?<br>
<br>
Thanks and Regards,<br>
<br>
-LN<br>
<br></div></div><div class="im">
On Tue, Mar 31, 2009 at 6:19 PM, Bogdan-Andrei Iancu <<a href="mailto:bogdan@voice-system.ro" target="_blank">bogdan@voice-system.ro</a> <mailto:<a href="mailto:bogdan@voice-system.ro" target="_blank">bogdan@voice-system.ro</a>>> wrote:<br>
<br>
Hi,<br>
<br>
if the online-user info is correct, it looks like the<br>
fix_nated_register() is not done.<br>
<br>
Please post the output of "opensipsctl ul show", for that specific<br>
user.<br>
<br>
Also test by using xlog if the at register time your processing<br>
gets inside the "if (!search("^Contact:[ ]*\*") &&<br>
nat_uac_test("19")) {".<br>
<br>
Regards,<br>
Bogdan<br>
<br>
oso che bol wrote:<br>
<br>
Dear All,<br>
<br>
I use Opensips 1.4.1 with rtpproxy 1.2 for NAT support.<br>
<br>
I use X-Lite which is Behind NAT, register to OpenSIPs proxy,<br>
Opensips store right contact address. But, when i use Nokia<br>
E66 to register to Opensips, the contact address is bellow:<br>
Online SIP Users<br>
Username Domain Contact Expires User Agent<br>
5000 *<a href="mailto:sip%3A5000@192.168.1.100" target="_blank">sip:5000@192.168.1.100</a> <mailto:<a href="mailto:sip%253A5000@192.168.1.100" target="_blank">sip%3A5000@192.168.1.100</a>><br>
<mailto:<a href="mailto:sip%253A5000@192.168.1.100" target="_blank">sip%3A5000@192.168.1.100</a><br></div>
<mailto:<a href="mailto:sip%25253A5000@192.168.1.100" target="_blank">sip%253A5000@192.168.1.100</a>>>;transport=UDP* 2009-03-30<div><div></div><div class="h5"><br>
07:20:24.0 E66-1 RM-343 102.07.81<br>
<br>
<br>
User 5000 do not store with external IP address of its<br>
(external address not 192.168.1.100). Do you have any ideas<br>
about this?<br>
<br>
Bellow is my Opensips.conf<br>
<br>
Thanks and Regards,<br>
<br>
-LN<br>
<br>
Opensips.conf<br>
<br>
==================<br>
<br>
####### Global Parameters #########<br>
<br>
debug=4<br>
log_stderror=yes<br>
log_facility=LOG_LOCAL0<br>
<br>
fork=yes<br>
children=4<br>
<br>
/* uncomment the following lines to enable debugging */<br>
#debug=6<br>
#fork=no<br>
#log_stderror=yes<br>
<br>
#disable_tcp=yes<br>
#disable_dns_blacklist=no<br>
#dns_try_ipv6=yes<br>
#auto_aliases=no<br>
<br>
/* uncomment the following lines to enable TLS support<br>
(default off) */<br>
#disable_tls = no<br>
#listen = tls:your_IP:5061<br>
#tls_verify_server = 1<br>
#tls_verify_client = 1<br>
#tls_require_client_certificate = 0<br>
#tls_method = TLSv1<br>
#tls_certificate = "//etc/opensips/tls/user/user-cert.pem"<br>
#tls_private_key = "//etc/opensips/tls/user/user-privkey.pem"<br>
#tls_ca_list = "//etc/opensips/tls/user/user-calist.pem"<br>
<br>
<br>
port=5060<br>
listen=udp:MY_OPENSIP_IP:5060<br>
<br>
<br>
####### Modules Section ########<br>
<br>
#set module path<br>
mpath="//lib/opensips/modules/"<br>
<br>
/* uncomment next line for MySQL DB support */<br>
loadmodule "db_mysql.so"<br>
loadmodule "sl.so"<br>
loadmodule "tm.so"<br>
loadmodule "rr.so"<br>
loadmodule "maxfwd.so"<br>
loadmodule "usrloc.so"<br>
loadmodule "registrar.so"<br>
loadmodule "textops.so"<br>
loadmodule "mi_fifo.so"<br>
loadmodule "uri_db.so"<br>
loadmodule "uri.so"<br>
loadmodule "xlog.so"<br>
loadmodule "acc.so"<br>
loadmodule "auth.so"<br>
loadmodule "auth_db.so"<br>
<br>
#loadmodule "presence.so"<br>
#loadmodule "presence_xml.so"<br>
<br>
loadmodule "nathelper.so"<br>
loadmodule "avpops.so"<br>
######################<br>
<br>
<br>
modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")<br>
modparam("rr", "enable_full_lr", 1)<br>
modparam("rr", "append_fromtag", 0)<br>
modparam("registrar", "method_filtering", 1)<br>
<br>
/* uncomment the next line to disable parallel forking via<br>
location */<br>
# modparam("registrar", "append_branches", 0)<br>
/* uncomment the next line not to allow more than 10 contacts<br>
per AOR */<br>
#modparam("registrar", "max_contacts", 10)<br>
modparam("uri_db", "use_uri_table", 1)<br>
modparam("uri_db", "db_url",<br>
"mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")<br>
#them for bug9, like guide in bug9<br>
modparam("uri_db", "db_table", "uri")<br>
<br>
<br>
# ----- acc params -----<br>
/* what sepcial events should be accounted ? */<br>
modparam("acc", "early_media", 1)<br>
modparam("acc", "report_ack", 1)<br>
modparam("acc", "report_cancels", 1)<br>
modparam("acc", "detect_direction", 0)<br>
modparam("acc", "failed_transaction_flag", 3)<br>
modparam("acc", "log_flag", 1)<br>
modparam("acc", "log_missed_flag", 2)<br>
modparam("acc", "db_flag", 1)<br>
modparam("acc", "db_missed_flag", 2)<br>
<br>
modparam("usrloc", "db_mode", 2)<br>
modparam("usrloc", "db_url",<br>
"mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")<br>
<br>
modparam("auth_db", "calculate_ha1", yes)<br>
modparam("auth_db", "password_column", "password")<br>
modparam("auth_db|permission", "db_url",<br>
"mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")<br>
<br>
modparam("avpops", "avp_url",<br>
"mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin")<br>
modparam("avpops", "avp_table", "usr_preferences")<br>
<br>
#try for fix error of Mobile Address<br>
modparam("registrar", "received_avp", "$avp(s:rcv)")<br>
modparam("nathelper", "received_avp", "$avp(s:rcv)")<br>
<br>
#Theo guide<br>
<a href="http://www.opensips.org/html/docs/modules/1.4.x/registrar.html" target="_blank">http://www.opensips.org/html/docs/modules/1.4.x/registrar.html</a><br>
modparam("usrloc", "nat_bflag", 6)<br>
modparam("nathelper", "ping_nated_only", 1)<br>
modparam("nathelper", "sipping_bflag", 8)<br>
<br>
#modparam("nathelper", "rtpproxy_sock", "udp:MY_RTPPROXY_IP:7890")<br>
modparam("nathelper", "force_socket", "udp:MY_RTPPROXY_IP:7890")<br>
modparam("nathelper", "natping_interval", 89)<br>
modparam("nathelper", "sipping_from", "sip:1000@MY_OPENSIP_IP")<br>
<br>
<br>
# main request routing logic<br>
<br>
route {<br>
<br>
#<br>
-----------------------------------------------------------------<br>
# Sanity Check Section<br>
#<br>
-----------------------------------------------------------------<br>
if (!mf_process_maxfwd_header("10")) {<br>
sl_send_reply("483", "Too Many Hops");<br>
exit;<br>
}<br>
<br>
if (msg:len > max_len) {<br>
sl_send_reply("513", "Message Overflow");<br>
exit;<br>
}<br>
<br>
#<br>
-----------------------------------------------------------------<br>
# Record Route Section<br>
#<br>
-----------------------------------------------------------------<br>
if (method!="REGISTER") {<br>
record_route();<br>
}<br>
<br>
if (method=="BYE" || method=="CANCEL") {<br>
unforce_rtp_proxy();<br>
}<br>
<br>
#<br>
-----------------------------------------------------------------<br>
# Loose Route Section<br>
#<br>
-----------------------------------------------------------------<br>
if (loose_route()) {<br>
<br>
if ((method=="INVITE" || method=="REFER") &&<br>
!has_totag()) {<br>
sl_send_reply("403", "Forbidden");<br>
exit;<br>
}<br>
<br>
if (method=="INVITE") {<br>
<br>
if (!proxy_authorize("MY_OPENSIPS_IP","subscriber")) {<br>
proxy_challenge("MY_OPENSIPS_IP","0");<br>
exit;<br>
} else if (!check_from()) {<br>
sl_send_reply("403", "Use From=ID");<br>
exit;<br>
}<br>
consume_credentials();<br>
<br>
if (nat_uac_test("19")) {<br>
setflag(6);<br>
force_rport();<br>
fix_nated_contact();<br>
}<br>
force_rtp_proxy("l");<br>
}<br>
route(1);<br>
exit;<br>
}<br>
<br>
#<br>
-----------------------------------------------------------------<br>
# Call Type Processing Section<br>
#<br>
-----------------------------------------------------------------<br>
if (uri!=myself) {<br>
route(4);<br>
route(1);<br>
exit;<br>
}<br>
<br>
if (method=="ACK") {<br>
route(1);<br>
exit;<br>
} else if (method=="CANCEL") {<br>
route(1);<br>
exit;<br>
} else if (method=="INVITE") {<br>
route(3);<br>
exit;<br>
} else if (method=="REGISTER") {<br>
route(2);<br>
exit;<br>
}<br>
<br>
lookup("aliases");<br>
if (uri!=myself) {<br>
route(4);<br>
route(1);<br>
exit;<br>
}<br>
<br>
if (!lookup("location")) {<br>
sl_send_reply("404", "User Not Found");<br>
exit;<br>
}<br>
<br>
route(1);<br>
}<br>
<br>
route[1] {<br>
<br>
#<br>
-----------------------------------------------------------------<br>
# Default Message Handler<br>
#<br>
-----------------------------------------------------------------<br>
<br>
t_on_reply("1");<br>
<br>
if (!t_relay()) {<br>
if (method=="INVITE" && isflagset(6)) {<br>
unforce_rtp_proxy();<br>
};<br>
sl_reply_error();<br>
}<br>
}<br>
<br>
route[2] {<br>
<br>
#<br>
-----------------------------------------------------------------<br>
# REGISTER Message Handler<br>
#<br>
----------------------------------------------------------------<br>
<br>
if (!search("^Contact:[ ]*\*") && nat_uac_test("19")) {<br>
setflag(6);<br>
fix_nated_register();<br>
force_rport();<br>
}<br>
<br>
sl_send_reply("100", "Trying");<br>
<br>
if (!www_authorize("MY_OPENSIPS_IP","subscriber")) {<br>
www_challenge("MY_OPENSIPS_IP","0");<br>
exit;<br>
}<br>
<br>
#if (!check_to()) {<br>
# sl_send_reply("401", "Unauthorized Loi Ngo");<br>
# exit;<br>
#}<br>
<br>
consume_credentials();<br>
<br>
if (!save("location")) {<br>
sl_reply_error();<br>
};<br>
}<br>
<br>
route[3] {<br>
<br>
#<br>
-----------------------------------------------------------------<br>
# INVITE Message Handler<br>
#<br>
-----------------------------------------------------------------<br>
#Drop because error Use From=ID when call. Open<br>
#if (!proxy_authorize("","subscriber")) {<br>
# proxy_challenge("","0");<br>
# exit;<br>
#} else if (!check_from()) {<br>
# sl_send_reply("403", "Use From=ID");<br>
# exit;<br>
#}<br>
<br>
#consume_credentials();<br>
<br>
if (nat_uac_test("19")) {<br>
setflag(6);<br>
}<br>
<br>
lookup("aliases");<br>
if (uri!=myself) {<br>
route(4);<br>
route(1);<br>
exit;<br>
}<br>
<br>
if (!lookup("location")) {<br>
sl_send_reply("404", "User Not Found");<br>
exit;<br>
}<br>
<br>
route(4);<br>
route(1);<br>
}<br>
<br>
route[4] {<br>
<br>
#<br>
-----------------------------------------------------------------<br>
# NAT Traversal Section<br>
#<br>
-----------------------------------------------------------------<br>
<br>
if (isflagset(6)) {<br>
force_rport();<br>
fix_nated_contact();<br>
force_rtp_proxy();<br>
}<br>
}<br>
<br>
onreply_route[1] {<br>
<br>
if (isflagset(6) && status=~"(180)|(183)|2[0-9][0-9]") {<br>
if (!search("^Content-Length:[ ]*0")) {<br>
force_rtp_proxy();<br>
}<br>
}<br>
<br>
if (nat_uac_test("1")) {<br>
fix_nated_contact();<br>
}<br>
}<br>
<br>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
Users mailing list<br></div></div>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a> <mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>><div class="im"><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br>
<br>
<br>
</div></blockquote>
<br>
</blockquote></div><br>