<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi,<br><br>I installed opensips version 1.8, I can register and make
calls ok between endpoints. I have opensips installed behind a NAT and
my user agent are also behind NAT. i can register and I got rtpproxy
working.<br><br>I enabled NAT during the setup phase using the menuconfig.<br><br>The problem I'm having; is calls are dropping exactly after 30-34 seconds. <br><br>How do I enable NAT?<br><br>Thanks<br><br><br>Here's my .cfg file<br>--------------------------------------------------------------------------------------------------<br><br>#<br># $Id: opensips_residential.m4 9042 2012-05-17 13:57:10Z vladut-paiu $<br>#<br># OpenSIPS residential configuration script<br># by OpenSIPS Solutions <team@opensips-solutions.com><br>#<br># This script was generated via "make menuconfig", from<br># the "Residential" scenario.<br># You can enable / disable more features / functionalities by<br># re-generating the scenario with different options.#<br>#<br># Please refer to the Core CookBook at:<br># http://www.opensips.org/Resources/DocsCookbooks<br># for a explanation of possible statements, functions and parameters.<br>#<br><br><br>####### Global Parameters #########<br><br>debug=3<br>log_stderror=no<br>log_facility=LOG_LOCAL1<br><br>fork=yes<br>children=4<br><br>advertised_address="x.x.x.x"<br>#alias="x.x.x.x:5060"<br><br>/* uncomment the following lines to enable debugging */<br>#debug=6<br>#fork=no<br>#log_stderror=yes<br><br>/* uncomment the next line to enable the auto temporary blacklisting of <br> not available destinations (default disabled) */<br>#disable_dns_blacklist=no<br><br>/* uncomment the next line to enable IPv6 lookup after IPv4 dns <br> lookup failures (default disabled) */<br>#dns_try_ipv6=yes<br><br>/* comment the next line to enable the auto discovery of local aliases<br> based on revers DNS on IPs */<br>auto_aliases=no<br><br><br>listen=udp:x.x.x.x:5060 # CUSTOMIZE ME<br><br>disable_tcp=no<br>listen=tcp:x.x.x.x:5060 # CUSTOMIZE ME <br><br>disable_tls=no<br>listen=tls:x.x.x.x:5061 # CUSTOMIZE ME<br>tls_verify_server=1<br>tls_verify_client = 1<br>tls_require_client_certificate = 0<br>tls_method = TLSv1<br>tls_certificate = "/usr/local/opensips_proxy/etc/opensips/tls/user/user-cert.pem"<br>tls_private_key = "/usr/local/opensips_proxy/etc/opensips/tls/user/user-privkey.pem"<br>tls_ca_list = "/usr/local/opensips_proxy/etc/opensips/tls/user/user-calist.pem"<br><br><br>####### Modules Section ########<br><br>#set module path<br>mpath="/usr/local/opensips_proxy/lib/opensips/modules/"<br><br>#### SIGNALING module<br>loadmodule "signaling.so"<br><br>#### StateLess module<br>loadmodule "sl.so"<br><br>#### Transaction Module<br>loadmodule "tm.so"<br>modparam("tm", "fr_timer", 5)<br>modparam("tm", "fr_inv_timer", 30)<br>modparam("tm", "restart_fr_on_each_reply", 0)<br>modparam("tm", "onreply_avp_mode", 1)<br><br>#### Record Route Module<br>loadmodule "rr.so"<br>/* do not append from tag to the RR (no need for this script) */<br>modparam("rr", "append_fromtag", 0)<br><br>#### MAX ForWarD module<br>loadmodule "maxfwd.so"<br><br>#### SIP MSG OPerationS module<br>loadmodule "sipmsgops.so"<br><br>#### FIFO Management Interface<br>loadmodule "mi_fifo.so"<br>modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")<br>modparam("mi_fifo", "fifo_mode", 0666)<br><br><br>#### URI module<br>loadmodule "uri.so"<br>modparam("uri", "use_uri_table", 0)<br>modparam("uri", "db_url",<br> "mysql://user:userpass@x.x.x.x/opensips")<br><br><br><br><br>#### MYSQL module<br>loadmodule "db_mysql.so"<br><br>#### USeR LOCation module<br>loadmodule "usrloc.so"<br>modparam("usrloc", "nat_bflag", 10)<br>modparam("usrloc", "db_mode", 2)<br>modparam("usrloc", "db_url",<br> "mysql://user:userpass@x.x.x.x/opensips") # CUSTOMIZE ME<br><br><br>#### REGISTRAR module<br>loadmodule "registrar.so"<br>modparam("registrar", "tcp_persistent_flag", 7)<br>modparam("registrar", "received_avp", "$avp(received_nh)")<br>/* uncomment the next line not to allow more than 10 contacts per AOR */<br>#modparam("registrar", "max_contacts", 10)<br><br>#### ACCounting module<br>loadmodule "acc.so"<br>/* what special events should be accounted ? */<br>modparam("acc", "early_media", 0)<br>modparam("acc", "report_cancels", 0)<br>/* by default we do not adjust the direct of the sequential requests.<br> if you enable this parameter, be sure the enable "append_fromtag"<br> in "rr" module */<br>modparam("acc", "detect_direction", 0)<br>modparam("acc", "failed_transaction_flag", 3)<br>/* account triggers (flags) */<br>modparam("acc", "db_flag", 1)<br>modparam("acc", "db_missed_flag", 2)<br>modparam("acc", "db_url",<br> "mysql://user:userpass@x.x.x.x/opensips") # CUSTOMIZE ME<br><br><br>#### AUTHentication modules<br>loadmodule "auth.so"<br>loadmodule "auth_db.so"<br>modparam("auth_db", "calculate_ha1", yes)<br>modparam("auth_db", "password_column", "password")<br>modparam("auth_db", "db_url",<br> "mysql://user:userpass@x.x.x.x/opensips") # CUSTOMIZE ME<br>modparam("auth_db", "load_credentials", "")<br><br><br><br><br><br><br><br><br>#### DIALOG module<br>loadmodule "dialog.so"<br>modparam("dialog", "dlg_match_mode", 1)<br>modparam("dialog", "default_timeout", 21600) # 6 hours timeout<br>modparam("dialog", "db_mode", 2)<br>modparam("dialog", "db_url",<br> "mysql://user:userpass@x.x.x.x/opensips") # CUSTOMIZE ME<br><br><br>#### NAT modules<br>loadmodule "nathelper.so"<br>modparam("nathelper", "natping_interval", 10)<br>modparam("nathelper", "ping_nated_only", 1)<br>modparam("nathelper", "natping_processes", 3)<br>modparam("nathelper", "received_avp", "$avp(received_nh)")<br><br><br><br><br>loadmodule "rtpproxy.so"<br>modparam("rtpproxy", "rtpproxy_sock", "udp:127.0.0.1:12221") # CUSTOMIZE ME<br><br><br><br><br><br>####### Routing Logic ########<br><br># main request routing logic<br><br>route{<br> force_rport();<br> if (nat_uac_test("23")) {<br> if (is_method("REGISTER")) {<br> fix_nated_register();<br> setbflag(10);<br> } else {<br> fix_nated_contact();<br> setflag(10);<br> }<br> }<br> <br>if (has_totag() ) {<br> # sequential request withing a dialog should<br> # take the path determined by record-routing<br> if (loose_route() ) {<br> if (is_method("BYE" ) ) {<br> setflag(1) ; # do accounting . . .<br> setflag(3 ) ; # . . . even if the transaction fails<br> } else if ( is_method( "INVITE" ) ) {<br> # even if in most of the cases is useless, do RR for<br> # re-INVITEs alos, as some buggy clients do change route set<br> # during the dialog.<br> record_route() ;<br> }<br> # route it out to whatever destination was set by loose_route()<br> # in $du (destination URI) .<br> route( 1) ;<br> } else {<br> if ( is_method(" ACK") ) {<br> if ( t_check_trans( ) ) {<br> # non loose- route, but stateful ACK; must be an ACK after<br> # a 487 or e. g. 404 from upstream server<br> t_relay() ;<br> exit;<br> } else {<br> # ACK without matching transaction -><br> # ignore and discard<br> exit;<br> }<br> }<br> sl_send_reply("404" , " Not here") ;<br> }<br> exit;<br><br> } <br> <br> if (!mf_process_maxfwd_header("10")) {<br> sl_send_reply("483","Too Many Hops");<br> exit;<br> }<br><br> if (has_totag()) {<br> # sequential request withing a dialog should<br> # take the path determined by record-routing<br> if (loose_route()) {<br> <br> # validate the sequential request against dialog<br> if ( $DLG_status!=NULL && !validate_dialog() ) {<br> xlog("In-Dialog $rm from $si (callid=$ci) is not valid according to dialog\n");<br> ## exit;<br> }<br> <br> if (is_method("BYE")) {<br> setflag(1); # do accounting ...<br> setflag(3); # ... even if the transaction fails<br> } else if (is_method("INVITE")) {<br> # even if in most of the cases is useless, do RR for<br> # re-INVITEs alos, as some buggy clients do change route set<br> # during the dialog.<br> record_route();<br> }<br><br> if (check_route_param("nat=yes")) <br> setflag(10);<br><br> # route it out to whatever destination was set by loose_route()<br> # in $du (destination URI).<br> route(1);<br> } else {<br> <br> if ( is_method("ACK") ) {<br> if ( t_check_trans() ) {<br> # non loose-route, but stateful ACK; must be an ACK after <br> # a 487 or e.g. 404 from upstream server<br> t_relay();<br> exit;<br> } else {<br> # ACK without matching transaction -><br> # ignore and discard<br> exit;<br> }<br> }<br> sl_send_reply("404","Not here");<br> }<br> exit;<br> }<br><br> # CANCEL processing<br> if (is_method("CANCEL"))<br> {<br> if (t_check_trans())<br> t_relay();<br> exit;<br> }<br><br> t_check_trans();<br><br> if ( !(is_method("REGISTER") ) ) {<br> <br> if (from_uri==myself)<br> <br> {<br> <br> # authenticate if from local subscriber<br> # authenticate all initial non-REGISTER request that pretend to be<br> # generated by local subscriber (domain from FROM URI is local)<br> if (!proxy_authorize("", "subscriber")) {<br> proxy_challenge("", "0");<br> exit;<br> }<br> if (!db_check_from()) {<br> sl_send_reply("403","Forbidden auth ID");<br> exit;<br> }<br> <br> consume_credentials();<br> # caller authenticated<br> <br> } else {<br> # if caller is not local, then called number must be local<br> <br> if (!uri==myself) {<br> send_reply("403","Rely forbidden");<br> exit;<br> }<br> }<br><br> }<br><br> # preloaded route checking<br> if (loose_route()) {<br> xlog("L_ERR",<br> "Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");<br> if (!is_method("ACK"))<br> sl_send_reply("403","Preload Route denied");<br> exit;<br> }<br><br> # record routing<br> if (!is_method("REGISTER|MESSAGE"))<br> record_route();<br><br> # account only INVITEs<br> if (is_method("INVITE")) {<br> <br> # create dialog with timeout<br> if ( !create_dialog("B") ) {<br> send_reply("500","Internal Server Error");<br> exit;<br> }<br> <br> setflag(1); # do accounting<br> }<br><br> <br> if (!uri==myself) {<br> append_hf("P-hint: outbound\r\n"); <br> <br> # if you have some interdomain connections via TLS<br> ## CUSTOMIZE IF NEEDED<br> ##if ($rd=="tls_domain1.net"<br> ## || $rd=="tls_domain2.net"<br> ##) {<br> ## force_send_socket(tls:127.0.0.1:5061); # CUSTOMIZE<br> ##}<br> <br> route(1);<br> }<br><br> # requests for my domain<br> <br> if (is_method("PUBLISH|SUBSCRIBE"))<br> {<br> sl_send_reply("503", "Service Unavailable");<br> exit;<br> }<br><br> if (is_method("REGISTER"))<br> {<br> <br> # authenticate the REGISTER requests<br> if (!www_authorize("", "subscriber"))<br> {<br> www_challenge("", "0");<br> exit;<br> }<br> <br> if (!db_check_to()) <br> {<br> sl_send_reply("403","Forbidden auth ID");<br> exit;<br> }<br><br> if ( proto==TCP || proto==TLS || 0 ) setflag(7);<br><br> if (!save("location"))<br> sl_reply_error();<br><br> exit;<br> }<br><br> if ($rU==NULL) {<br> # request with no Username in RURI<br> sl_send_reply("484","Address Incomplete");<br> exit;<br> }<br><br> <br><br> <br><br> <br><br> # do lookup with method filtering<br> if (!lookup("location","m")) {<br> if (!db_does_uri_exist()) {<br> send_reply("420","Bad Extension");<br> exit;<br> }<br> <br> t_newtran();<br> t_reply("404", "Not Found");<br> exit;<br> } <br><br> if (isbflagset(10)) setflag(10);<br><br> # when routing via usrloc, log the missed calls also<br> setflag(2);<br> route(1);<br>}<br><br><br>route[1] {<br> # for INVITEs enable some additional helper routes<br> if (is_method("INVITE")) {<br> <br> if (isflagset(10)) {<br> rtpproxy_offer("ro");<br> }<br><br> t_on_branch("2");<br> t_on_reply("2");<br> t_on_failure("1");<br> }<br><br> if (isflagset(10)) {<br> add_rr_param(";nat=yes");<br> }<br><br> if (!t_relay()) {<br> send_reply("500","Internal Error");<br> };<br> exit;<br>}<br><br><br><br><br>branch_route[2] {<br> xlog("new branch at $ru\n");<br>}<br><br><br>onreply_route[2] {<br> if (nat_uac_test("1"))<br> fix_nated_contact();<br> if ( isflagset(10) )<br> rtpproxy_answer("ro");<br> xlog("incoming reply\n");<br>}<br><br><br>failure_route[1] {<br> if (t_was_cancelled()) {<br> exit;<br> }<br><br> # uncomment the following lines if you want to block client <br> # redirect based on 3xx replies.<br> ##if (t_check_status("3[0-9][0-9]")) {<br> ##t_reply("404","Not found");<br> ## exit;<br> ##}<br><br> <br>}<br><br><br><br>local_route {<br> if (is_method("BYE") && $DLG_dir=="UPSTREAM") {<br> <br> acc_db_request("200 Dialog Timeout", "acc");<br> <br> }<br>}                                            </div></body>
</html>