OpenSER v1.2.x and RTPProxy
This is a basic configuration file for OpenSER v1.2.x to do VoIP NAT traversal using RTPProxy.
The difference against v1.1.x is the flag 6 is now a branch flag and it has to be set/reset/test with setbflag()/resetbflag()/isbflagset(). Also, nat_flag parameter of registrar module has been moved as nat_bflag in usrloc module. For more, see OpenSER Flags Description.
The difference against v1.1.x is the flag 6 is now a branch flag and it has to be set/reset/test with setbflag()/resetbflag()/isbflagset(). Also, nat_flag parameter of registrar module has been moved as nat_bflag in usrloc module. For more, see OpenSER Flags Description.
#
# 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=7 # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=yes # (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 "registrar.so"
loadmodule "textops.so"
loadmodule "nathelper.so"
loadmodule "auth.so"
loadmodule "auth_db.so"
loadmodule "mi_fifo.so"
# --- setting module parameters
# -- mi_fifo params --
modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")
modparam("usrloc|auth_db","db_url","mysql://openser:openserrw@localhost/openser")
# -- usrloc params --
modparam("usrloc", "db_mode", 2)
modparam("usrloc", "nat_bflag", 6)
# -- registrar params --
modparam("registrar|nathelper", "received_avp", "$avp(i:42)")
# -- 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:7890")
modparam("nathelper", "natping_interval", 30)
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "sipping_bflag", 7)
modparam("nathelper", "sipping_from", "sip:pinger@openser.org")
# --- main routing logic
route{
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit;
};
if (msg:len >= 2048 ) {
sl_send_reply("513", "Message too big");
exit;
};
# NAT detection
route(2);
if (!method=="REGISTER")
record_route();
if (loose_route()) {
append_hf("P-hint: rr-enforced\r\n");
route(1);
};
if (!uri==myself) {
append_hf("P-hint: outbound\r\n");
route(1);
};
if (uri==myself) {
if (method=="REGISTER") {
if (!www_authorize("openser.org", "subscriber")) {
www_challenge("openser.org", "0");
exit;
};
if (isflagset(5)) {
setbflag(6);
# if you want OPTIONS natpings uncomment next
# setbflag(7);
};
save("location");
exit;
};
if (!lookup("location")) {
sl_send_reply("404", "Not Found");
exit;
};
append_hf("P-hint: usrloc applied\r\n");
};
route(1);
}
route[1] {
if (subst_uri('/(sip:.*);nat=yes/\1/')){
setbflag(6);
};
if (isflagset(5)||isbflagset(6)) {
route(3);
}
if (!t_relay()) {
sl_reply_error();
};
exit;
}
route[2]{
force_rport();
if (nat_uac_test("19")) {
if (method=="REGISTER") {
fix_nated_register();
} else {
fix_nated_contact();
};
setflag(5);
};
}
route[3] {
if (is_method("BYE|CANCEL")) {
unforce_rtp_proxy();
} else if (is_method("INVITE")){
force_rtp_proxy();
t_on_failure("1");
};
if (isflagset(5))
search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes');
t_on_reply("1");
}
failure_route[1] {
if (isbflagset(6) || isflagset(5)) {
unforce_rtp_proxy();
}
}
onreply_route[1] {
if ((isflagset(5) || isbflagset(6)) && status=~"(183)|(2[0-9][0-9])") {
force_rtp_proxy();
}
search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes');
if (isbflagset(6)) {
fix_nated_contact();
}
exit;
}


Comments
333OpenSER + rtpproxy + video problem
and I allways face with the next issue:
2 UAs are behind NAT;
each UA could call another; IM works; Audio works;
but looks-like video streams are handled by openSER and rtpproxy incorretly,
and I'm unable to make a video call to any ua, -
x-lite sip phone shows "Could not start video" on one side, and "No matching video codec" on the other side...
I'm using x-lite.. Has anybody faced with such issues later or has any ideas ?
best regards,
Dorin
333
333Registration error: 513 - Message too big
check the realm option configured in asterisk sip.conf file in the general section, and configure the same value in your SIP client
it worked for me last time I encountered a message : Registration error: 513 - Message too big.
I only use asterisk only, not Openser
hope it will help you.