I'm using openser 1.0.1 with rtpproxy and nathelper. Calls are goin through with good audio. Hanging up is fine too. However I've noticed I've been getting errors in my logs:
ERROR: extract_body: message body has length zero
ERROR: force_rtp_proxy2: can't extract body from the message
I'm assuming I'm doin something wrong in my config but I dont know where. Can someone please point out my mistakes? Thank you
# 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
*/
port=5060
children=4
listen=68.xxx.xxx.xxx
alias=test.com
check_via=no # (cmd. line: -v)
dns=no # (cmd. line: -r)
rev_dns=no # (cmd. line: -R)
fifo="/tmp/openser_fifo"
fifo_db_url="mysql://openser:openserrw@localhost/openser"
# --- module loading
loadmodule "/usr/local/lib/openser/modules/mysql.so"
loadmodule "/usr/local/lib/openser/modules/sl.so"
loadmodule "/usr/local/lib/openser/modules/tm.so"
loadmodule "/usr/local/lib/openser/modules/rr.so"
loadmodule "/usr/local/lib/openser/modules/maxfwd.so"
loadmodule "/usr/local/lib/openser/modules/usrloc.so"
loadmodule "/usr/local/lib/openser/modules/registrar.so"
loadmodule "/usr/local/lib/openser/modules/auth.so"
loadmodule "/usr/local/lib/openser/modules/auth_db.so"
loadmodule "/usr/local/lib/openser/modules/uri.so"
loadmodule "/usr/local/lib/openser/modules/uri_db.so"
loadmodule
"/usr/local/lib/openser/modules/domain.so"
loadmodule "/usr/local/lib/openser/modules/nathelper.so"
loadmodule "/usr/local/lib/openser/modules/avpops.so"
loadmodule "/usr/local/lib/openser/modules/textops.so"
loadmodule "/usr/local/lib/openser/modules/xlog.so"
loadmodule "/usr/local/lib/openser/modules/permissions.so"
# --- setting module parameters
modparam("auth_db|permissions|uri_db|usrloc", "db_url",
"mysql://openser:openserrw@localhost/openser")
# -- usrloc params --
modparam("usrloc", "db_mode", 2)
# -- registrar params --
modparam("registrar", "nat_flag", 6)
modparam("registrar", "sip_natping_flag", 7)
# -- 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",
"unix:/var/run/rtpproxy.sock")
modparam("nathelper", "natping_interval", 30)
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "sipping_from", "sip:pinger@test.com")
# -- tm params --
modparam("tm", "fr_inv_timer", 27)
modparam("tm", "fr_inv_timer_avp", "inv_timeout")
# -- permissions param --
modparam("permissions", "db_mode", 1)
modparam("permissions", "trusted_table", "trusted")
# --- main routing logic
route{
# -----------------------------------------------------------------
# Sanity Check Section
# -----------------------------------------------------------------
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);
# -----------------------------------------------------------------
# Record Route Section
# -----------------------------------------------------------------
if (!method=="REGISTER")
record_route();
# -----------------------------------------------------------------
# Loose Route Section
# -----------------------------------------------------------------
if (loose_route()) {
append_hf("P-hint: rr-enforced\r\n");
if ((method=="INVITE" || method=="REFER") && !has_totag()) {
sl_send_reply("403", "Forbidden");
return;
};
if (method=="INVITE") {
if (!proxy_authorize("","subscriber")) {
proxy_challenge("","0");
return;
} else if (!check_from()) {
sl_send_reply("403", "Use From=ID");
return;
};
consume_credentials();
};
route(1);
};
# -----------------------------------------------------------------
# Call Type Processing Section
# -----------------------------------------------------------------
if (!is_uri_host_local()) {
if (is_from_local() || allow_trusted()) {
route(4);
route(1);
} else {
sl_send_reply("403", "Forbidden");
};
};
if (method=="ACK") {
route(1);
return;
} else if (method=="CANCEL") {
route(1);
return;
} else if (method=="INVITE") {
route(5);
return;
} else if (method=="REGISTER") {
route(4);
return;
};
lookup("aliases");
if (!is_uri_host_local()) {
route(4);
route(1);
return;
};
if (!lookup("location")) {
sl_send_reply("404", "User Not Found");
exit;
};
append_hf("P-hint: usrloc applied\r\n");
route(1);
}
route[1] {
if (subst_uri('/(sip:.*);nat=yes/\1/')){
setflag(6);
};
if (isflagset(5)||isflagset(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");
}
route[4] {
if (!www_authorize("", "subscriber")) {
www_challenge("", "0");
exit;
};
if (isflagset(5)) {
setflag(6);
# if you want OPTIONS natpings uncomment next
# setflag(7);
};
save("location");
if (!lookup("location")) {
sl_reply_error();
};
append_hf("P-hint: usrloc applied\r\n");
}
route[5] {
# -----------------------------------------------------------------
# INVITE Message Handler
# -----------------------------------------------------------------
if (!allow_trusted()) {
if (!proxy_authorize("","subscriber")) {
proxy_challenge("","0");
return;
} else if (!check_from()) {
sl_send_reply("403", "Use From=ID");
return;
};
};
lookup("aliases");
if (!is_uri_host_local()) {
route(1);
return;
};
if (uri=~"^sip:[0-9]{3}@") {
lookup("aliases");
lookup("location");
route(1);
return;
};
if(!lookup("location")){
if (uri=~"^sip:[0-9]*@") {
route(6);
return;
};
sl_send_reply("404", "User Not Found");
return;
};
route(1);
}
route[6] {
# -----------------------------------------------------------------
# PSTN Handler
# -----------------------------------------------------------------
rewritehostport("pstn.gateway:5060");
avp_write("i:45", "inv_timeout");
route(1);
}
failure_route[1] {
if (isflagset(6) || isflagset(5)) {
unforce_rtp_proxy();
}
}
onreply_route[1] {
if ((isflagset(5) || isflagset(6)) && status=~"(183)|(2[0-9][0-9])") {
force_rtp_proxy();
}
search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes');
if (isflagset(6)) {
fix_nated_contact();
}
exit;
}