Thanks to for your advice, I got it working!
For now, I crippled nat_uac_test.
I have:
2.3 My SIP phone
2.4 IVR server
2.10 OpenSER with RTPProxy.
And instead of 2.5, I'm now hitting 2.4. 2.4 Replies with a 302
(temporarily moved) to 2.10, which is relayed to 2.3. When I monitor the
traffic, 2.3 ACKs 2.10 and *still* starts the RTP directly with 2.4.
I'm going to try customizing onreply_route[1] to accommodate this. Correct?
Eric
#
# sample config file to be used with nathelper/rtpproxy
#
# start RTPProxy with: rtpproxy -l your_public_ip -s udp:localhost:8899
#
# ----------- global configuration parameters ------------------------
debug=3 # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=no # (cmd line: -E)
/* Uncomment these lines to enter debugging mode
fork=no
log_stderror=yes
*/
check_via=no # (cmd. line: -v)
dns=no # (cmd. line: -r)
rev_dns=no # (cmd. line: -R)
port=5060
children=4
# --- module loading
mpath="/usr/local/lib/openser/modules/"
loadmodule "mysql.so"
loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "textops.so"
loadmodule "auth.so"
loadmodule "auth_db.so"
loadmodule "xlog.so"
loadmodule "registrar.so"
loadmodule "mi_fifo.so"
loadmodule "presence.so"
loadmodule "presence_xml.so"
loadmodule "xcap_client.so"
loadmodule "nathelper.so"
loadmodule "uri.so"
# --- setting module parameters
modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")
modparam("auth_db","db_url","mysql://openser:Don'tBother@127.0.0.1/openser")
modparam("registrar", "received_avp", "$avp(s:rcv)")
modparam("xcap_client", "db_url",
"mysql://openser:Don'tBother@127.0.0.1/openser")
# -- usrloc params --
modparam("usrloc", "db_url",
"mysql://openser:Don'tBother@127.0.0.1/openser")
modparam("usrloc", "db_mode", 2)
modparam("usrloc", "nat_bflag", 3)
# -- registrar params --
modparam("registrar", "received_avp", "$avp(s:rcv)")
# -- auth params --
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
# -- rr params --
modparam("rr", "enable_full_lr", 1)
# -- nathelper
modparam("nathelper", "rtpproxy_sock",
"udp:127.0.0.1:8899")
modparam("nathelper", "natping_interval", 30)
modparam("nathelper", "ping_nated_only", 1)
#modparam("nathelper", "sipping_bflag", 7)
modparam("nathelper", "sipping_from",
"sip:pinger@openser.org")
modparam("nathelper", "received_avp", "$avp(s:rcv)")
# -- xlog
modparam("xlog", "buf_size", 8192)
# -- presence params --
modparam("presence|presence_xml|usrloc", "db_url",
"mysql://openser:Don'tBother@127.0.0.1/openser")
modparam("presence", "max_expires", 3600)
modparam("presence_xml", "force_active", 1)
modparam("presence", "server_address", "sip:127.0.0.1:5060"
)
# --- main routing logic
route{
xlog("***start***\n");
xlog("***$fd $si***\n");
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
xlog("***end - Too Many Hops");
exit;
};
if (msg:len >= 2048 ) {
sl_send_reply("513", "Message too big");
xlog("***end - Too big");
exit;
};
# NAT detection
route(2);
if (!method=="REGISTER") {
xlog("***route - recordroute\n");
record_route();
}
if (loose_route()) {
xlog("***route - looseroute\n");
append_hf("P-hint: rr-enforced\r\n");
route(1);
};
if (!uri==myself) {
xlog("***route - not myself\n");
append_hf("P-hint: outbound\r\n");
route(1);
};
if (uri==myself) {
if (method=="REGISTER") {
xlog("***route - register");
if (!www_authorize("openser.org", "subscriber")) {
xlog("***route - challenging");
www_challenge("openser.org", "0");
exit;
};
if (isflagset(5)) {
xlog("***route - isflagset(5)");
setflag(6);
# if you want OPTIONS natpings uncomment
next
# setflag(7);
};
save("location");
xlog("***route - registered");
exit;
};
if (!lookup("location")) {
sl_send_reply("404", "Not Found");
xlog("***route - 404, Not found");
exit;
};
append_hf("P-hint: usrloc applied\r\n");
};
route(1);
xlog("***end***\n");
}
route[1] {
xlog("***route1***\n");
if (subst_uri('/(sip:.*);nat=yes/\1/')){
xlog("***route[1] - setflag(6)");
setflag(6);
};
if (isflagset(5)||isflagset(6)||isflagset(7)) {
xlog("***route[1] - route(3)");
route(3);
}
add_uri_param("transport=tcp");
if (!t_relay()) {
xlog("***route[1] - error");
sl_reply_error();
};
xlog("***end - route[1]");
exit;
}
route[2]{
xlog("***route2***\n");
force_rport();
# if (nat_uac_test("19")) {
if (nat_uac_test("0")) {
xlog("***route2 - nat_uac_test(19)\n");
if (method=="REGISTER") {
xlog("***route2 - fix nated register\n");
fix_nated_register();
} else {
xlog("***route2 - fix nated contact\n");
fix_nated_contact();
};
setflag(5);
} else {
#local network
setflag(7);
};
}
route[3] {
xlog("***route3***\n");
if (is_method("BYE|CANCEL")) {
xlog("***route3 - unforce\n");
unforce_rtp_proxy();
} else if (is_method("INVITE")){
xlog("***route3 - force\n");
if (isflagset(7)) {
force_rtp_proxy("i");
} else {
force_rtp_proxy();
}
t_on_failure("1");
};
if (isflagset(5)) {
xlog("***route3 - isflagset(5)\n");
if (!isflagset(7)) {
search_append('Contact:.*sip:[^>[:cntrl:]]*',
';nat=yes');
}
}
t_on_reply("1");
}
failure_route[1] {
xlog("***failureroute1***\n");
if (isflagset(6) || isflagset(5) || isflagset(7)) {
xlog("***failroute1 - unforce\n");
unforce_rtp_proxy();
}
}
onreply_route[1] {
xlog("***onreplyroute1***\n");
if ((isflagset(5) || isflagset(6) || isflagset(7)) &&
status=~"(183)|(2[0-9][0-9])") {
xlog("***onreplyroute1 - force\n");
if (isflagset(7)) {
force_rtp_proxy("i");
} else {
force_rtp_proxy();
}
}
if (!isflagset(7)) {
search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes');
}
if (isflagset(6)) {
xlog("***onreplyroute1 - contact\n");
fix_nated_contact();
}
xlog("***end - onreplyrout[1]");
exit;
}
Eric
-----Original Message-----
From: Robert Dyck [mailto:rob.dyck@telus.net]
Sent: Friday, February 15, 2008 4:23 PM
To: Eric Phetteplace
Cc: users(a)lists.openser.org
Subject: Re: [OpenSER-Users] OpenSerand RTPProxy, no RTP audio
The example script you are using and maybe all the example scripts were
written from the perspective of a service provider. The idea is to detect
users who had to pass through a NAT to reach openser. The contact
information
that these users provide cannot be relied upon so openser needs to work
around the misinformation. The NAT is of no concern when calling between
local phones.
In my case I use openser as an ALG and for local calling. I make no attempt
to
test whether any user is behind a NAT. A local origination is determined by
# Check if package originates from LAN
if (src_ip==192.168.1.0/255.255.255.0)
{
}
else
{
}
Is this generally what you are trying to accomplish?