I hope I'm not waisting your time with a problem that has a obvious
solution, I've actually tried to find a similar case without any
success.
I'm making a call between two NATed clients which are using STUN.
The call goes through OpenSER which is configured to use mediaproxy -
see my config at the bottom of my email
Below is a dump from the location table:
MySQL / openser / location
_______________________________________________________________________
| contact | received | flag |
-----------------------------------------------------------------------
|sip:1007@130.XXX.XXX.XXX:49162 |sip:130.XXX.XXX.XXX:49163 | 1 |
|sip:1003@85.XXX.XXX.XXX:3676 | sip:85.XXX.XXX.XXX:3688 | 1 |
-----------------------------------------------------------------------
The problem is that the call from 1003 to 1007 initiates OK, but
disconnects after 20-30 seconds.
From my logs it looks like OpenSER stops sending SIP messages to port
49163 after getting SDP from 1007, but starts sending to 49162
instead, so 1007 never gets the ACK message.
So 1007 repeatedly sends SDP description but OpenSER replies to the wrong port.
Please see the attached picture, graph from Wireshark.If the picture
doesn't attach, it can be found here:
http://hoski.public.is/openser.jpg
So my question is, why does OpenSER stop sending SIP messages to port:
49163 and how can I fix it?
Thanks in advance,
Hoski
listen = XX.XXX.XX.XXX
mpath = "/usr/lib/openser/modules"
children = 8
debug = 3
fork = yes
group = "openser"
user = "openser"
disable_tcp = no
log_facility=LOG_LOCAL7
log_stderror = no
tcp_children = 4
fifo = "/tmp/openser_fifo"
fifo_db_url="mysql://openser:XXXX@localhost/openser"
# ATH: Próeftir BOSTON
fifo_group = "openser"
fifo_mode = 0666
fifo_user = "openser"
mhomed = no
server_signature = yes
sock_group = "openser"
sock_mode = 0600
sock_user = "openser"
unix_sock = "/tmp/openser.sock"
unix_sock_children = 1
reply_to_via = no
sip_warning = no
check_via = no
dns = no
rev_dns = no
syn_branch = yes
disable_core_dump = no
dns_try_ipv6 = yes
dns_use_search_list = yes
loadmodule "usrloc.so"
modparam("usrloc", "user_column", "username")
modparam("usrloc", "domain_column", "domain")
modparam("usrloc", "contact_column", "contact")
modparam("usrloc", "expires_column", "expires")
modparam("usrloc", "q_column", "q")
modparam("usrloc", "callid_column", "callid")
modparam("usrloc", "cseq_column", "cseq")
modparam("usrloc", "methods_column", "methods")
modparam("usrloc", "flags_column", "flags")
modparam("usrloc", "user_agent_column", "user_agent")
modparam("usrloc", "received_column", "received")
modparam("usrloc", "socket_column", "socket")
modparam("usrloc", "use_domain", 0)
modparam("usrloc", "desc_time_order", 0)
modparam("usrloc", "timer_interval", 60)
modparam("usrloc", "db_url",
"mysql://openser:openserrw@localhost/openser")
modparam("usrloc", "db_mode", 1)
modparam("usrloc", "matching_mode", 0)
modparam("usrloc", "cseq_delay", 20)
loadmodule "mediaproxy.so"
modparam("mediaproxy", "mediaproxy_socket",
"/var/run/mediaproxy/proxydispatcher.sock")
modparam("mediaproxy", "sip_asymmetrics",
"/etc/openser/sip-asymmetric-clients")
modparam("mediaproxy", "rtp_asymmetrics",
"/etc/openser/rtp-asymmetric-clients")
modparam("mediaproxy", "natping_interval", 30)
loadmodule "rr.so"
modparam("rr", "enable_full_lr", 0)
modparam("rr", "append_fromtag", 1)
modparam("rr", "enable_double_rr", 1)
modparam("rr", "add_username", 0)
loadmodule "tm.so"
modparam("tm", "fr_timer", 30)
modparam("tm", "fr_inv_timer", 120)
modparam("tm", "wt_timer", 5)
modparam("tm", "delete_timer", 2)
modparam("tm", "retr_timer1p1", 1)
modparam("tm", "retr_timer1p2", 2)
modparam("tm", "retr_timer1p3", 4)
modparam("tm", "retr_timer2", 4)
modparam("tm", "noisy_ctimer", 0)
modparam("tm", "ruri_matching", 1)
modparam("tm", "via1_matching", 1)
modparam("tm", "unix_tx_timeout", 2)
modparam("tm", "restart_fr_on_each_reply", 1)
modparam("tm", "fr_timer_avp", "s:callee_fr_timer")
modparam("tm", "fr_inv_timer_avp",
"s:callee_fr_inv_timer")
modparam("tm", "pass_provisional_replies", 0)
loadmodule "xlog.so"
modparam("xlog", "buf_size", 4096)
modparam("xlog", "force_color", 1)
loadmodule "domain.so"
modparam("domain", "db_url",
"mysql://openser:XXXXXXX@localhost/openser")
modparam("domain", "db_mode", 1)
modparam("domain", "domain_table", "domain")
modparam("domain", "domain_col", "domain")
loadmodule "nathelper.so"
modparam("nathelper", "natping_interval", 180)
modparam("nathelper", "ping_nated_only", 0)
modparam("nathelper", "received_avp", 42)
modparam("nathelper", "rtpproxy_sock",
"unix:/var/run/rtpproxy.sock")
modparam("nathelper", "rtpproxy_disable", 1)
modparam("nathelper", "rtpproxy_disable_tout", 60)
modparam("nathelper", "rtpproxy_tout", 1)
modparam("nathelper", "rtpproxy_retr", 5)
modparam("nathelper", "sipping_method", "OPTIONS")
loadmodule "textops.so"
loadmodule "sl.so"
modparam("sl", "enable_stats", 1)
loadmodule "uri.so"
loadmodule "registrar.so"
modparam("registrar", "default_expires", 3600)
modparam("registrar", "min_expires", 60)
modparam("registrar", "max_expires", 0)
modparam("registrar", "default_q", 0)
modparam("registrar", "append_branches", 1)
modparam("registrar", "use_domain", 0)
modparam("registrar", "case_sensitive", 0)
modparam("registrar", "desc_time_order", 0)
modparam("registrar", "received_avp", 42)
modparam("registrar", "received_param", "received")
modparam("registrar", "max_contacts", 0)
modparam("registrar", "retry_after", 0)
modparam("registrar", "use_branch_flags", 0)
modparam("registrar", "method_filtering", 0)
modparam("registrar", "path_mode", 2)
modparam("registrar", "path_use_received", 0)
modparam("registrar", "nat_flag", 6)
loadmodule "maxfwd.so"
modparam("maxfwd", "max_limit", 256)
loadmodule "mysql.so"
modparam("mysql", "ping_interval", 300)
modparam("mysql", "auto_reconnect", 1)
loadmodule "auth.so"
modparam("auth", "nonce_expire", 300)
modparam("auth", "rpid_suffix",
";party=calling;id-type=subscriber;screen=yes")
modparam("auth", "rpid_avp", "s:rpid")
loadmodule "auth_db.so"
modparam("auth_db", "db_url",
"mysql://openser:XXXXXX@localhost/openser")
modparam("auth_db", "user_column", "username")
modparam("auth_db", "domain_column", "domain")
modparam("auth_db", "password_column", "password")
modparam("auth_db", "password_column_2", "ha1b")
modparam("auth_db", "calculate_ha1", 1)
modparam("auth_db", "use_domain", 0)
modparam("auth_db", "load_credentials", "rpid")
loadmodule "uri_db.so"
modparam("uri_db", "db_url",
"mysql://openser:XXXXXXX@localhost/openser")
modparam("uri_db", "uri_table", "uri")
modparam("uri_db", "uri_user_column", "username")
modparam("uri_db", "uri_domain_column", "domain")
modparam("uri_db", "uri_uriuser_column", "uri_user")
modparam("uri_db", "subscriber_table", "subscriber")
modparam("uri_db", "subscriber_user_column", "username")
modparam("uri_db", "subscriber_domain_column", "domain")
modparam("uri_db", "use_uri_table", 0)
modparam("uri_db", "use_domain", 0)
########################################################################
# Request route 'main'
########################################################################
route[0]
{
xlog("L_INFO", "New request - M=$rm RURI=$ru F=$fu T=$tu
IP=$si ID=$ci\n");
force_rport();
if(msg:len > max_len)
{
xlog("L_INFO", "Message too big - M=$rm RURI=$ru F=$fu
T=$tu IP=$si
ID=$ci\n");
sl_send_reply("513", "Message Too Big");
exit;
}
if (!mf_process_maxfwd_header("10"))
{
xlog("L_INFO", "Too many hops - M=$rm RURI=$ru F=$fu
T=$tu IP=$si ID=$ci\n");
sl_send_reply("483", "Too Many Hops");
exit;
}
if(!is_method("REGISTER"))
{
if(nat_uac_test("19"))
{
record_route(";nat=yes");
}
else
{
record_route();
}
}
if(is_method("CANCEL") || is_method("BYE"))
{
end_media_session();
}
if(loose_route())
{
if(!has_totag())
{
xlog("L_INFO", "Initial loose-routing rejected
- M=$rm RURI=$ru
F=$fu T=$tu IP=$si ID=$ci\n");
sl_send_reply("403", "Initial Loose-Routing
Rejected");
exit;
}
if(nat_uac_test("19") || search("^Route:.*;nat=yes"))
{
fix_nated_contact();
setflag(6);
}
route(3);
}
if(is_method("REGISTER"))
{
route(2);
}
if(is_method("INVITE"))
{
route(4);
}
if(is_method("CANCEL") || is_method("ACK"))
{
route(8);
}
route(9);
}
########################################################################
# Request route 'stop-media-proxy'
########################################################################
route[1]
{
if(isflagset(22))
{
end_media_session();
}
}
########################################################################
# Request route 'base-route-register'
########################################################################
route[2]
{
sl_send_reply("100", "Trying");
if(!www_authorize("", "subscriber"))
{
xlog("L_INFO", "Register authentication failed - M=$rm
RURI=$ru
F=$fu T=$tu IP=$si ID=$ci\n");
www_challenge("", "0");
exit;
}
if(!check_to())
{
xlog("L_INFO", "Spoofed To-URI detected - M=$rm
RURI=$ru F=$fu T=$tu
IP=$si ID=$ci\n");
sl_send_reply("403", "Spoofed To-URI Detected");
exit;
}
consume_credentials();
if(!search("^Contact:[ ]*\*") && nat_uac_test("19"))
{
fix_nated_register();
setflag(6);
}
if(!save("location"))
{
xlog("L_ERR", "Saving contact failed - M=$rm RURI=$ru
F=$fu T=$tu
IP=$si ID=$ci\n");
sl_reply_error();
exit;
}
xlog("L_INFO", "Registration successful - M=$rm RURI=$ru F=$fu
T=$tu
IP=$si ID=$ci\n");
exit;
}
########################################################################
# Request route 'base-outbound'
########################################################################
route[3]
{
if(isflagset(6))
{
if(!isflagset(22) && !search("^Content-Length:[ ]*0"))
{
setflag(22);
use_media_proxy();
}
t_on_reply("2");
}
else
{
t_on_reply("1");
}
if(!isflagset(21))
{
t_on_failure("1");
}
if(isflagset(29))
{
append_branch();
}
if(is_present_hf("Proxy-Authorization"))
{
consume_credentials();
}
xlog("L_INFO", "Request leaving server, D-URI='$du' - M=$rm
RURI=$ru
F=$fu T=$tu IP=$si ID=$ci\n");
if(!t_relay())
{
sl_reply_error();
if(is_method("INVITE") && isflagset(6))
{
end_media_session();
}
}
exit;
}
########################################################################
# Request route 'base-route-invite'
########################################################################
route[4]
{
sl_send_reply("100", "Trying");
if(!proxy_authorize("", "subscriber"))
{
xlog("L_INFO", "Proxy authentication failed - M=$rm
RURI=$ru F=$fu
T=$tu IP=$si ID=$ci\n");
proxy_challenge("", "0");
exit;
}
if(!check_from())
{
xlog("L_INFO", "Spoofed From-URI detected - M=$rm RURI=$ru
F=$fu
T=$tu IP=$si ID=$ci\n");
sl_send_reply("403", "Spoofed From-URI Detected");
exit;
}
if(nat_uac_test("19"))
{
fix_nated_contact();
setflag(6);
}
route(5);
}
########################################################################
# Request route 'invite-find-callee'
########################################################################
route[5]
{
if(!is_domain_local("$ruri"))
{
setflag(20);
route(7);
}
if(does_uri_exist())
{
xlog("L_INFO", "Callee is local - M=$rm RURI=$ru F=$fu
T=$tu IP=$si
ID=$ci\n");
route(6);
}
else
{
xlog("L_INFO", "Callee is not local - M=$rm RURI=$ru F=$fu
T=$tu
IP=$si ID=$ci\n");
route(7);
}
exit;
}
########################################################################
# Request route 'invite-to-internal'
########################################################################
route[6]
{
if(!lookup("location"))
{
xlog("L_INFO", "Local user offline - M=$rm RURI=$ru F=$fu
T=$tu
IP=$si ID=$ci\n");
sl_send_reply("404", "User Offline");
}
else
{
xlog("L_INFO", "Local user online - M=$rm RURI=$ru F=$fu
T=$tu
IP=$si ID=$ci\n");
route(3);
}
exit;
}
########################################################################
# Request route 'invite-to-external'
########################################################################
route[7]
{
if(isflagset(20))
{
xlog("L_INFO", "Call to foreign domain - M=$rm
RURI=$ru F=$fu T=$tu
IP=$si ID=$ci\n");
route(3);
exit;
}
xlog("L_INFO", "Call to unknown user - M=$rm RURI=$ru F=$fu T=$tu
IP=$si ID=$ci\n");
sl_send_reply("404", "User Not Found");
exit;
}
########################################################################
# Request route 'base-route-local'
########################################################################
route[8]
{
t_on_reply("1");
if(t_check_trans())
{
xlog("L_INFO", "Request leaving server - M=$rm
RURI=$ru F=$fu T=$tu
IP=$si ID=$ci\n");
if(!t_relay())
{
sl_reply_error();
}
}
else
{
xlog("L_INFO", "Dropping mis-routed request - M=$rm
RURI=$ru F=$fu
T=$tu IP=$si ID=$ci\n");
}
exit;
}
########################################################################
# Request route 'base-route-generic'
########################################################################
route[9]
{
xlog("L_INFO", "Method not supported - M=$rm RURI=$ru F=$fu T=$tu
IP=$si ID=$ci\n");
sl_send_reply("501", "Method Not Supported Here");
exit;
}
########################################################################
# Request route 'base-filter-failover'
########################################################################
route[10]
{
if(!t_check_status("408|500|503"))
{
xlog("L_INFO", "No failover routing needed for this
response code -
M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
route(1);
exit;
}
}
########################################################################
# Reply route 'base-standard-reply'
########################################################################
onreply_route[1]
{
xlog("L_INFO", "Reply - S=$rs D=$rr F=$fu T=$tu IP=$si
ID=$ci\n");
exit;
}
########################################################################
# Reply route 'base-nat-reply'
########################################################################
onreply_route[2]
{
xlog("L_INFO", "NAT-Reply - S=$rs D=$rr F=$fu T=$tu IP=$si
ID=$ci\n");
if(nat_uac_test("1"))
{
fix_nated_contact();
}
if(isflagset(6) && status=~"(180)|(183)|2[0-9][0-9]")
{
if(!search("^Content-Length:[ ]*0"))
{
use_media_proxy();
}
}
exit;
}
########################################################################
# Failure route 'base-standard-failure'
########################################################################
failure_route[1]
{
route(10);
route(1);
}