|
I have phones (some behind NAT) connecting to Opensips server an
Asterisk and an rtpproxy as seen below: rtpproxy started with ps -aux | grep rtpproxy root 15666 0.0 0.0 14472 920 ? Ssl Mar23 0:05 ./rtpproxy -F -l 189.254.2.19 -s udp:* 7890 -d DBUG LOG_LOCAL3 UAC1 username = 100------------Firewall/router--------------------Opensips 1.7---------- RTP PROXY------------Asterisk 1.6 192.168.1.10 192.168.1.1 65.254.63.212 189.254.2.19 190.61.201.89 external ip dinamic 169.254.2.2 - Calls between UAC are OK (both SIP and RTP). - Calls UAC for PSTN is OK. - Did numbers is received in Asterisk, and destination for UAC registered in opensips, but no work audio . (EX User call cellphone for DID 54115368566, call is received in asterisk, and destination for user 100, registered in opensips) loadmodule "db_mysql.so" loadmodule "signaling.so" loadmodule "sl.so" loadmodule "tm.so" loadmodule "rr.so" loadmodule "maxfwd.so" loadmodule "usrloc.so" loadmodule "registrar.so" loadmodule "textops.so" loadmodule "mi_fifo.so" loadmodule "uri.so" loadmodule "acc.so" loadmodule "dialog.so" loadmodule "load_balancer.so" loadmodule "nathelper.so" loadmodule "siptrace.so" loadmodule "rtpproxy.so" loadmodule "auth.so" loadmodule "auth_db.so" loadmodule "domain.so" modparam("load_balancer", "db_url", "mysql://opensips:opensips@localhost/opensips") modparam("siptrace", "db_url", "mysql://opensips:opensips@localhost/opensips") modparam("siptrace", "trace_flag", 22) modparam("siptrace", "trace_on", 1) modparam("siptrace", "enable_ack_trace", 1) modparam("rtpproxy", "rtpproxy_sock","udp:189.254.2.19:7890") modparam("dialog", "db_mode", 1) modparam("dialog", "db_url", "mysql://opensips:opensips@localhost/opensips") modparam("nathelper", "natping_interval", 10) modparam("nathelper", "natping_processes", 3) modparam("nathelper", "natping_socket", "189.254.2.19:5006") modparam("nathelper", "received_avp", "$avp(42)") modparam("nathelper", "force_socket", "189.254.2.19:33333") modparam("nathelper", "sipping_from", "sip:[email protected]") modparam("nathelper", "sipping_method", "INFO") modparam("nathelper", "sipping_bflag", 7) modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo") modparam("rr","enable_double_rr",1) modparam("rr","append_fromtag",1) modparam("registrar", "max_contacts", 10) modparam("usrloc", "db_mode", 2) modparam("usrloc", "db_url","mysql://opensips:opensips@localhost/opensips") modparam("acc", "early_media", 1) modparam("acc", "report_cancels", 1) modparam("acc", "detect_direction", 0) modparam("acc", "failed_transaction_flag", 3) modparam("acc", "log_flag", 1) modparam("acc", "log_missed_flag", 2) modparam("acc", "db_flag", 1) modparam("acc", "db_missed_flag", 2) modparam("auth_db", "password_column", "password") modparam("auth_db", "password_column_2", "ha1b") modparam("auth_db", "calculate_ha1", 1) modparam("auth_db", "db_url","mysql://opensips:opensips@localhost/opensips") modparam("auth_db", "load_credentials", "") modparam("auth_db", "skip_version_check", 1) modparam("domain", "db_url","mysql://opensips:opensips@localhost/opensips") modparam("domain", "db_mode", 1) # Use caching modparam("auth_db|usrloc|uri", "use_domain", 0) route { if (!mf_process_maxfwd_header("256")) { if (method != "ACK") { sl_send_reply("483", "Too Many Hops"); } return; } if (msg:len > max_len) { if (method != "ACK") { sl_send_reply("513", "Message Overflow"); } return; } if (status == "482") { #loop detection xlog("L_INFO", "Webur: $mi $rm $fu -> $ru status 482 Loop Detected\n"); return; } if (!mf_process_maxfwd_header("3")) { sl_send_reply("483", "looping"); exit; } if (has_totag()) { loose_route(); t_relay(); exit; } if (method == "INVITE") { route(3); return; } else if (method == "ACK") { route(9); return; } else if (method == "BYE" || method == "CANCEL") { route(5); return; } else if (method == "REGISTER" || method == "MESSAGE") { route(1); return; } else if (method == "PUBLISH" || method == "SUBSCRIBE") { sl_send_reply("200", "Understood"); #route(2); return; } else if (method == "NOTIFY") { sl_send_reply("200", "Understood"); return; } else if (method == "OPTIONS") { sl_send_reply("200", "Got it"); return; } } route[1] { if (is_method("REGISTER")) { route(4); if (isflagset(5)) { record_route(";nat=yes"); } else { record_route(); } ; if (!www_authorize("", "a2billing")) { www_challenge("", "0"); } consume_credentials(); $du = "sip:190.61.201.89:5060"; save("location"); t_relay(); exit; } } route[3] { xlog("L_INFO", "Place Holder"); if (!has_totag()) { if (is_method("INVITE")) { trace_dialog(); } else { #sip_trace(); } } 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 (is_method("INVITE")) { route(5); } append_hf("P-hint: rr-enforced\r\n"); route(6); } # NAT detection route(4); record_route(); if ($rU = ~ "^[0-9]{5}$" || $rU = ~ "^[0-9]{3}$") { lookup("location"); route(8); t_on_failure("1"); exit; } route(10); return; } route[4] { if (is_method("INVITE") && has_totag()) { engage_rtp_proxy(); } ; force_rport(); if (1) { if (nat_uac_test("19")) { xlog("L_DBG", "NAT detected1"); if (method == "REGISTER") { fix_nated_register(); } else { fix_nated_contact(); fix_nated_sdp("1"); xlog("L_INFO", "NAT detected2"); } setflag(5); return; } } } route[5] { if (is_method("BYE|CANCEL")) { unforce_rtp_proxy(); t_relay(); exit; } else if (is_method("INVITE")) { if (has_body("application/sdp")) rtpproxy_offer("foc"); t_on_failure("3"); } else if (is_method("ASK")) { if (has_body("application/sdp")) rtpproxy_answer("foc"); t_on_failure("3"); } t_on_reply("3"); } route[6] { if (subst_uri('/(sip:.*);nat=yes/\1/')) { setbflag(0); } ; xlog("L_INFO", "NAT detected"); if (isflagset(5) || isbflagset(0)) { route(5); if (!t_relay()) { sl_reply_error(); } ; } } route[7] { if (is_method("BYE|CANCEL")) { unforce_rtp_proxy(); drop(); } else if (is_method("INVITE")) { if (has_body("application/sdp")) rtpproxy_offer("foc"); t_on_failure("3"); } else if (is_method("ASK")) { if (has_body("application/sdp")) rtpproxy_answer("foc"); t_on_failure("3"); } t_on_reply("3"); exit; } route[8] { force_rport(); if (has_body("application/sdp")) { rtpproxy_offer("foc"); xlog("L_INFO", "NAT detected"); t_on_failure("3"); } else if (is_method("ASK")) { if (has_body("application/sdp")) fix_nated_sdp("1"); # Add direction=active to SDP rtpproxy_answer("foc"); xlog("L_INFO", "NAT detected"); } t_on_reply("3"); if (!t_relay()) { sl_reply_error(); route(13); exit; } } route[9] { setflag(4); force_rport(); force_tcp_alias(); rtpproxy_answer(); return; } route[10] { load_balance("1", "pstn"); route(11); return; } route[11] { if ($retcode < 0) { sl_send_reply("500", "Service full"); exit; } xlog("Selected Load Balance destination is: $rU@$du\n"); route(4); if (!t_relay()) { sl_reply_error(); route(13); } return; } branch_route[2] { xlog("L_INFO: new branch at $ru\n"); } onreply_route[2] { xlog("L_INFO: incoming reply\n"); force_rport(); if (status = ~ "(183)|(2[0-9][0-9][0-9])" && has_body("application/sdp")) { if (nat_uac_test("19")) { log("L_INFO: Hem detectat NAT"); setbflag(2); # flag for NAT # fix_nated_contact(); fix_nated_sdp("11"); rtpproxy_answer(); } } } onreply_route[3] { if ((isflagset(5) || isbflagset(0)) && status = ~ "(183)|(2[0-9][0-9])" && has_body("application/sdp")) { if (rtpproxy_answer()) { log("L_INFO: rtpproxy_answer NAT"); } } if (!subst_uri('/(sip:.*);nat=yes/\1/')) { search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes'); } if (isbflagset(0)) { #fix_nated_contact(); } exit; } failure_route[1] { if (t_was_cancelled()) { exit; } } failure_route[3] { if (isbflagset(0) || isflagset(5)) { unforce_rtp_proxy(); } } Thanks, Magnus |
_______________________________________________ Users mailing list [email protected] http://lists.opensips.org/cgi-bin/mailman/listinfo/users
