summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--openser-config/openser.cfg91
1 files changed, 65 insertions, 26 deletions
diff --git a/openser-config/openser.cfg b/openser-config/openser.cfg
index 193acd0..a4ed43f 100644
--- a/openser-config/openser.cfg
+++ b/openser-config/openser.cfg
@@ -1,20 +1,21 @@
-#
# ----------- global configuration parameters ------------------------
fork=yes
-#listen=83.64.208.28
port=5060
log_stderror=no
debug=3
+alias=voip.anytun.org:5060
check_via=no # (cmd. line: -v)
-dns=no # (cmd. line: -r)
-rev_dns=no # (cmd. line: -R)
+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"
@@ -22,25 +23,28 @@ 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"
-loadmodule "/usr/lib/openser/modules/xlog.so"
-
## ----------------- setting module-specific parameters ---------------
-modparam("usrloc", "db_mode", 0)
+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:localhost:22222")
+modparam("nathelper", "rtpproxy_sock", "udp:193.238.157.58:22222")
# ------------------------- request routing logic -------------------
route{
- xlog("L_ERR", "@route: method <$rm> r-uri <$ru>\n");
-
# initial sanity checks -- messages with
# max_forwards==0, or excessively long requests
if (!mf_process_maxfwd_header("10")) {
@@ -68,30 +72,26 @@ route{
# subsequent messages withing a dialog should take the
# path determined by record-routing
if (loose_route()) {
- if (method=="INVITE") {
- route(3);
- };
+ route(4);
route(1);
};
if (!uri==myself) {
- if (method=="INVITE") {
- route(3);
- };
+ 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) {
- if (method=="INVITE") {
- route(3);
- };
+ route(4);
route(1);
};
@@ -101,10 +101,7 @@ route{
exit;
};
- if (method=="INVITE") {
- route(3);
- };
-
+ route(4);
route(1);
}
@@ -119,6 +116,20 @@ route[1] {
}
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();
};
@@ -126,11 +137,39 @@ route[2] {
}
route[3] {
- force_rtp_proxy("","83.64.208.28");
+ 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")) {
- route(3);
+ force_rtp_proxy("","193.238.157.58");
};
}