# # ----------- global configuration parameters ------------------------ debug=4 # debug level (cmd line: -dddddddddd) fork=yes log_stderror=no # (cmd line: -E) log_facility=LOG_LOCAL6 /* Uncomment these lines to enter debugging mode fork=no log_stderror=yes */ check_via=no # (cmd. line: -v) dns=no # (cmd. line: -r) rev_dns=no # (cmd. line: -R) port=5060 listen=udp:89.XXX.XXX.16:5060 fifo="/tmp/openser_fifo" fifo_db_url="mysql://openser:SuEUbQ@localhost/openser" # ------------------ module loading ---------------------------------- loadmodule "/usr/local/lib64/openser/modules/mysql.so" loadmodule "/usr/local/lib64/openser/modules/domain.so" loadmodule "/usr/local/lib64/openser/modules/mediaproxy.so" loadmodule "/usr/local/lib64/openser/modules/sl.so" loadmodule "/usr/local/lib64/openser/modules/tm.so" loadmodule "/usr/local/lib64/openser/modules/acc.so" loadmodule "/usr/local/lib64/openser/modules/rr.so" loadmodule "/usr/local/lib64/openser/modules/maxfwd.so" loadmodule "/usr/local/lib64/openser/modules/usrloc.so" loadmodule "/usr/local/lib64/openser/modules/registrar.so" loadmodule "/usr/local/lib64/openser/modules/textops.so" loadmodule "/usr/local/lib64/openser/modules/xlog.so" loadmodule "/usr/local/lib64/openser/modules/uri.so" loadmodule "/usr/local/lib64/openser/modules/group.so" loadmodule "/usr/local/lib64/openser/modules/nathelper.so" # Uncomment this if you want digest authentication # mysql.so must be loaded ! loadmodule "/usr/local/lib64/openser/modules/auth.so" loadmodule "/usr/local/lib64/openser/modules/auth_db.so" # ----------------- setting module-specific parameters --------------- # -- usrloc params -- modparam("group|domain|auth_db|usrloc|acc","db_url","mysql://openser:XXXX@localhost/openser") # -- auth params -- # Uncomment if you are using auth module # modparam("auth_db", "calculate_ha1", yes) # # If you set "calculate_ha1" parameter to yes (which true in this config), # uncomment also the following parameter) # modparam("auth_db", "password_column", "password") #modparam("domain", "db_mode", 1) # Use caching modparam("domain", "domain_table", "domain") modparam("domain", "domain_col", "domain") # -- acc params -- modparam("acc", "log_level", 3) # modparam("acc", "radius_flag", 1) # modparam("acc", "radius_missed_flag", 2) modparam("acc", "log_flag", 1) modparam("acc", "log_missed_flag", 1) modparam("acc", "service_type", 15) modparam("acc|group_radius|avp_radius", "radius_config", "/usr/local/etc/radiusclient-ng/radiusclient.conf") modparam("acc", "db_flag", 3) modparam("acc", "db_missed_flag", 4) # -- rr params -- # add value to ;lr param to make some broken UAs happy modparam("rr", "enable_full_lr", 1) modparam("mediaproxy", "sip_asymmetrics", "/usr/local/etc/openser/sip-asymmetrics-clients") modparam("mediaproxy", "rtp_asymmetrics", "/usr/local/etc/openser/rtp-asymmetrics-clients") modparam("registrar", "nat_flag", 5) modparam("mediaproxy", "natping_interval", 0) modparam("nathelper", "rtpproxy_disable", 1) modparam("nathelper", "natping_interval", 10) modparam("nathelper", "sipping_from", "sip:ping@mobilia.it") modparam("registrar", "sip_natping_flag", 4) # ------------------------- request routing logic ------------------- # main routing logic route{ # initial sanity checks -- messages with # max_forwards==0, or excessively long requests 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; }; # we record-route all messages -- to make sure that # subsequent messages will go through our proxy; that's # particularly good if upstream and downstream entities # use different transport protocol if (!method=="REGISTER") setflag(1); record_route(); # subsequent messages withing a dialog should take the # path determined by record-routing if (loose_route()) { # mark routing logic in request append_hf("P-hint: rr-enforced\r\n"); route(1); exit; }; # check for PSTN calls if(uri=~"sip:\+?[0-9]{8,24}+@.*") { append_hf("P-hint: outbound\r\n"); route(2); exit; }; if (!is_uri_host_local()) { # mark routing logic in request append_hf("P-hint: outbound\r\n"); route(1); exit; }; # if the request is for other domain use UsrLoc # (in case, it does not work, use the following command # with proper names and addresses in it) if (is_uri_host_local()) { if (method=="REGISTER") { # Uncomment this if you want to use digest authentication if (!www_authorize("sipserver.mobilia.it", "subscriber")) { www_challenge("sipserver.mobilia.it", "0"); exit; }; if (client_nat_test("3")) { setflag(5); setflag(4); force_rport(); fix_contact(); }; save("location"); exit; }; lookup("aliases"); if (!is_uri_host_local()) { append_hf("P-hint: outbound alias\r\n"); route(1); exit; }; # native SIP destinations are handled using our USRLOC DB if (!lookup("location")) { sl_send_reply("404", "Not Found"); exit; }; }; if (method=="INVITE") { if (nat_uac_test("8")) { fix_nated_sdp("10"); }; t_on_failure("1"); } else if (method == "BYE" || method == "CANCEL") { end_media_session(); }; if (loose_route()) { if (method=="INVITE" || method=="ACK") { use_media_proxy(); }; t_relay(); exit; }; if (client_nat_test("3") && !search("^Record-Route:")) { # Mark as NAT'ed force_rport(); fix_contact(); }; if (method=="INVITE") { t_on_reply("1"); }; if (method=="INVITE" || method=="ACK") { use_media_proxy(); }; if (!t_relay()) { if (method=="INVITE" || method=="ACK") { end_media_session(); }; sl_reply_error(); }; append_hf("P-hint: usrloc applied\r\n"); route(1); } route[1] { # send it out now; use stateful forwarding as it works reliably # even for UDP2TCP if (!t_relay()) { sl_reply_error(); }; } route[2] { # calls to pstn if(is_method("INVITE") && !has_totag()) { if (!is_user_in("From", "PSTN")) { sl_send_reply("403", "Forbidden PSTN"); exit; }; # set gateway address rewritehostport("84.XXX.XXX.XXX:5060"); route(1); }; } failure_route[1] { end_media_session(); } onreply_route[1] { if (status=~"(183)|(2[0-9][0-9])") { if (client_nat_test("1")) { fix_contact(); }; if (nat_uac_test("8")) { fix_nated_sdp("10"); }; use_media_proxy(); }; }