####### Global Parameters ######### debug=3 log_stderror=no log_facility=LOG_LOCAL0 fork=yes children=4 auto_aliases=no listen=10.0.1.248:8060 AS rtpproxy.xyz.com:8060 # CUSTOMIZE ME alias="rtpproxy.xyz.com" alias="rtpproxy.xyz.com:8060" #disable_tcp=yes #disable_tls=yes tcp_children=32 tcp_send_timeout=1 tcp_connect_timeout=1 ####### Modules Section ######## #set module path mpath="/usr/lib64/opensips/modules" #### SIGNALING module loadmodule "signaling.so" #### StateLess module loadmodule "sl.so" #### Transaction Module loadmodule "tm.so" modparam("tm", "fr_timeout", 5) modparam("tm", "fr_inv_timeout", 120) modparam("tm", "restart_fr_on_each_reply", 0) modparam("tm", "onreply_avp_mode", 1) #loadmodule "nat_traversal.so" loadmodule "dialog.so" loadmodule "rtpproxy.so" #modparam("rtpproxy", "rtpproxy_autobridge", 1) modparam("rtpproxy", "rtpproxy_sock", "udp:1.2.3.4:12000=3") modparam("rtpproxy", "rtpproxy_sock", "udp:1.3.4.5:12000=0") modparam("rtpproxy", "rtpproxy_timeout", "0.2") modparam("rtpproxy", "nortpproxy_str", "") loadmodule "path.so" modparam("path", "enable_double_path", 0) #### Record Route Module loadmodule "rr.so" /* do not append from tag to the RR (no need for this script) */ modparam("rr", "append_fromtag", 0) #### MAX ForWarD module loadmodule "maxfwd.so" #### SIP MSG OPerationS module loadmodule "sipmsgops.so" #### FIFO Management Interface loadmodule "mi_fifo.so" modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo") #### URI module loadmodule "uri.so" modparam("uri", "use_uri_table", 0) #### USeR LOCation module loadmodule "usrloc.so" modparam("usrloc", "nat_bflag", 10) modparam("usrloc", "db_mode", 0) #### REGISTRAR module loadmodule "registrar.so" modparam("registrar", "tcp_persistent_flag", 7) /* uncomment the next line not to allow more than 10 contacts per AOR */ #modparam("registrar", "max_contacts", 10) ### sip trace module #loadmodule "siptrace.so" #modparam("siptrace","db_url","cachedb://mongodb:instance1") #modparam("siptrace", "trace_on", 1) #modparam("siptrace", "trace_flag", 22) #modparam("siptrace", "traced_user_avp", "$avp(123)") ################################### route { if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); exit; }; if (msg:len >= 4096 ) { sl_send_reply("513", "Message too big"); exit; }; # if (client_nat_test("8")) { # xlog("L_NOTICE", "Contact changed \n"); # fix_contact(); # }; if (!method=="REGISTER") { loose_route(); record_route(); if (method=="UPDATE") { route(2); exit; } if (method=="INVITE") { xlog("L_NOTICE","engage RTP proxy in Offer AND ADDING PROXY YES"); xlog("L_NOTICE", " SER Source IP ($si) Method ($rm) :callID $ci \n"); rtpproxy_offer_smart(); } # End of INVITE block if (method=="ACK") { xlog("L_NOTICE", " SER Source IP ($si) Method ($rm) :callID $ci \n"); } if (method=="BYE") { xlog("L_NOTICE", " SER Source IP ($si) Method ($rm) :callID $ci \n"); rtpproxy_unforce(); } } else { if (!add_path()) { sl_send_reply("503", "Internal Path Error"); exit; }; setflag(7); save("location","mr"); if (loose_route()) { append_hf("P-hint: rr-enforced\r\n"); route(1); exit; }; } if ( is_method("CANCEL") ) { if ( t_check_trans() ) route(1); exit; } if (!uri==myself) { # mark routing logic in request route(1); }; } route[1] { t_on_reply("1"); if (!t_relay()) { sl_reply_error(); } exit; } route[2] { t_on_reply("2"); if (!t_relay()) { sl_reply_error(); } exit; } onreply_route[1] { # if (client_nat_test("8")) { # xlog("L_NOTICE", "Contact changed \n"); # fix_contact(); # }; # xlog("OnReply Route"); if (has_body()){ rtpproxy_answer_smart(); } xlog("L_NOTICE", " SER Source IP ($si) Method ($rm) Reply ($rs) :callID $ci \n"); # setflag(22); # start_recording(); } onreply_route[2] { xlog("Do Nothing"); } ####### Routing Logic ######## # main request routing logic