From 62774a5d9ede8c9c23dc4208022508c2308404f2 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 5 Dec 2009 13:37:34 +0000 Subject: added all common stuff from anytun repo --- openser-config/openser.cfg | 175 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 openser-config/openser.cfg (limited to 'openser-config/openser.cfg') diff --git a/openser-config/openser.cfg b/openser-config/openser.cfg new file mode 100644 index 0000000..a4ed43f --- /dev/null +++ b/openser-config/openser.cfg @@ -0,0 +1,175 @@ +# ----------- global configuration parameters ------------------------ + +fork=yes +port=5060 +log_stderror=no +debug=3 +alias=voip.anytun.org:5060 + +check_via=no # (cmd. line: -v) +dns=yes # (cmd. line: -r) +rev_dns=yes # (cmd. line: -R) +children=4 +fifo="/tmp/openser_fifo" +fifo_db_url="mysql://anytunro:woasinidro@localhost/anytun" + +# ------------------ module loading ---------------------------------- + +loadmodule "/usr/lib/openser/modules/mysql.so" +loadmodule "/usr/lib/openser/modules/sl.so" +loadmodule "/usr/lib/openser/modules/tm.so" +loadmodule "/usr/lib/openser/modules/rr.so" +loadmodule "/usr/lib/openser/modules/textops.so" +loadmodule "/usr/lib/openser/modules/maxfwd.so" +loadmodule "/usr/lib/openser/modules/usrloc.so" +loadmodule "/usr/lib/openser/modules/registrar.so" +loadmodule "/usr/lib/openser/modules/auth.so" +loadmodule "/usr/lib/openser/modules/auth_db.so" +loadmodule "/usr/lib/openser/modules/uri_db.so" +loadmodule "/usr/lib/openser/modules/nathelper.so" + + +## ----------------- setting module-specific parameters --------------- + +modparam("auth_db|uri_db", "db_url", "mysql://anytunro:woasinidro@localhost/anytun") +modparam("auth_db", "calculate_ha1", 1) +modparam("auth_db", "password_column", "password") + +modparam("usrloc", "db_url", "mysql://anytun:woasinid@localhost/anytun") +modparam("usrloc", "db_mode", 2) + +modparam("rr", "enable_full_lr", 1) + +modparam("nathelper", "rtpproxy_sock", "udp:193.238.157.58:22222") + +# ------------------------- request 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") + record_route(); + + + if (method=="BYE" || method=="CANCEL") { + unforce_rtp_proxy(); + }; + + # subsequent messages withing a dialog should take the + # path determined by record-routing + if (loose_route()) { + route(4); + route(1); + }; + + if (!uri==myself) { + route(4); + route(1); + }; + + if (method=="ACK") { + route(1); + } if (method=="INVITE") { + route(3); + } else if (method=="REGISTER") { + route(2); + }; + + lookup("aliases"); + if (uri!=myself) { + route(4); + route(1); + }; + + # native SIP destinations are handled using our USRLOC DB + if (!lookup("location")) { + sl_send_reply("404", "Not Found"); + exit; + }; + + route(4); + route(1); +} + + +route[1] { + # send it out now; use stateful forwarding as it works reliably + # even for UDP2TCP + if (!t_relay()) { + sl_reply_error(); + }; + exit; +} + +route[2] { + sl_send_reply("100", "Trying"); + + if (!www_authorize("","subscriber")) { + www_challenge("","0"); + exit; + }; + + if (!check_to()) { + sl_send_reply("401", "Unauthorized"); + exit; + }; + + consume_credentials(); + + if (!save("location")) { + sl_reply_error(); + }; + exit; +} + +route[3] { + if (!proxy_authorize("","subscriber")) { + proxy_challenge("","0"); + exit; + } else if (!check_from()) { + sl_send_reply("403", "Use From=ID"); + exit; + }; + + consume_credentials(); + + lookup("aliases"); + if (uri!=myself) { + route(4); + route(1); + }; + + if (!lookup("location")) { + sl_send_reply("404", "User Not Found"); + exit; + }; + + route(4); + route(1); +} + +route[4] { + if (method=="INVITE") { + force_rtp_proxy("","193.238.157.58"); + }; +} + +onreply_route { + if (!search("^Content-Length:[ ]*0")) { + force_rtp_proxy("","193.238.157.58"); + }; +} -- cgit v1.2.3