... | ... |
@@ -19,7 +19,7 @@ loadmodule "modules/rr/rr.so" |
19 | 19 |
modparam("acc", "log_level", 1) |
20 | 20 |
# number of flag, which will be used for accounting; if a message is |
21 | 21 |
# labeled with this flag, its completion status will be reported |
22 |
-modparam("acc", "acc_flag", 1 ) |
|
22 |
+modparam("acc", "log_flag", 1 ) |
|
23 | 23 |
|
24 | 24 |
# ------------------------- request routing logic ------------------- |
25 | 25 |
|
... | ... |
@@ -40,15 +40,15 @@ route{ |
40 | 40 |
break; |
41 | 41 |
}; |
42 | 42 |
|
43 |
- # Do strict routing if pre-loaded route headers present due to |
|
44 |
- # previous use of record-routing |
|
45 |
- rewriteFromRoute(); |
|
43 |
+ # Process record-routing |
|
44 |
+ if (loose_route()) { t_relay(); break; }; |
|
45 |
+ |
|
46 | 46 |
|
47 | 47 |
# labeled all transaction for accounting |
48 | 48 |
setflag(1); |
49 | 49 |
|
50 | 50 |
# record-route INVITES to make sure BYEs will visit our server too |
51 |
- if (method=="INVITE") addRecordRoute(); |
|
51 |
+ if (method=="INVITE") record_route(); |
|
52 | 52 |
|
53 | 53 |
# forward the request statefuly now; (we need *stateful* forwarding, |
54 | 54 |
# because the stateful mode correlates requests with replies and |
... | ... |
@@ -10,12 +10,12 @@ loadmodule "modules/tm/tm.so" |
10 | 10 |
|
11 | 11 |
route{ |
12 | 12 |
# if we do not get a positive reply, continue at reply_route[2] |
13 |
- t_on_negative("2"); |
|
13 |
+ t_on_failure("2"); |
|
14 | 14 |
# forward the request to all destinations in destination set now |
15 | 15 |
t_relay(); |
16 | 16 |
} |
17 | 17 |
|
18 |
-reply_route[2] { |
|
18 |
+failure_route[2] { |
|
19 | 19 |
# request failed (no reply, busy, whatever) ... forward it again |
20 | 20 |
# to pbx's voicemail at phone number 6000 via Cisco gateway at |
21 | 21 |
# 192.168.10.10; append proprietary CC-Diversion header field with |
... | ... |
@@ -23,5 +23,6 @@ reply_route[2] { |
23 | 23 |
# know, whom the request was originally intended for |
24 | 24 |
append_branch("sip:6000@192.168.10.10"); |
25 | 25 |
append_urihf("CC-Diversion: ", "\r\n"); |
26 |
+ t_relay(); |
|
26 | 27 |
} |
27 | 28 |
|
... | ... |
@@ -26,7 +26,7 @@ route{ |
26 | 26 |
exec_msg("printenv SRCIP > /tmp/exectest.txt; cat >> /tmp/exectest.txt"); |
27 | 27 |
# and then rewrite URI using external utility |
28 | 28 |
# note that the last echo command trashes input parameter |
29 |
- if (exec_dst("echo sip:mra@iptel.org;echo sip:mrb@iptel.org;echo>/dev/null")) { |
|
29 |
+ if (exec_dset("echo sip:mra@iptel.org;echo sip:mrb@iptel.org;echo>/dev/null")) { |
|
30 | 30 |
sl_send_reply("300", "Redirect"); |
31 | 31 |
} else { |
32 | 32 |
sl_reply_error(); |
... | ... |
@@ -69,11 +69,12 @@ route[1] { |
69 | 69 |
|
70 | 70 |
reply_route[1] { |
71 | 71 |
# just call exec, that's it |
72 |
- exec_msg(' |
|
72 |
+ exec_msg(' |
|
73 | 73 |
QUERY="select email_address from subscriber |
74 | 74 |
where user=\"$SIP_OUSER\""; |
75 | 75 |
EMAIL=`mysql -Bsuser -pheslo -e "$QUERY" ser`; |
76 | 76 |
if [ -z "$EMAIL" ] ; then exit 1; fi ; |
77 | 77 |
echo "SIP request received from $SIP_HF_FROM for $SIP_OUSER" | |
78 | 78 |
mail -s "request for you" $EMAIL ') ; |
79 |
+ t_relay(); |
|
79 | 80 |
} |
... | ... |
@@ -5,18 +5,12 @@ |
5 | 5 |
# |
6 | 6 |
|
7 | 7 |
|
8 |
-debug=9 # debug level (cmd line: -dddddddddd) |
|
9 |
-fork=no |
|
10 |
-log_stderror=yes # (cmd line: -E) |
|
11 |
- |
|
12 | 8 |
|
13 | 9 |
children=2 |
14 | 10 |
check_via=no # (cmd. line: -v) |
15 | 11 |
dns=off # (cmd. line: -r) |
16 | 12 |
rev_dns=off # (cmd. line: -R) |
17 |
-port=5060 |
|
18 | 13 |
|
19 |
-listen=10.0.0.2 |
|
20 | 14 |
|
21 | 15 |
# ------------------ module loading ---------------------------------- |
22 | 16 |
|
... | ... |
@@ -62,7 +56,6 @@ route{ |
62 | 56 |
|
63 | 57 |
|
64 | 58 |
if (uri==myself) { |
65 |
- { |
|
66 | 59 |
# for testing purposes, simply okay all REGISTERs |
67 | 60 |
if (method=="REGISTER") |
68 | 61 |
{ |
... | ... |
@@ -50,6 +50,7 @@ failure_route[1] { |
50 | 50 |
log(1,"first redirection\n"); |
51 | 51 |
# if this alternative destination fails too, proceed to reply_route[2] |
52 | 52 |
t_on_failure("2"); |
53 |
+ t_relay(); |
|
53 | 54 |
} |
54 | 55 |
|
55 | 56 |
failure_route[2] { |
... | ... |
@@ -58,4 +59,5 @@ failure_route[2] { |
58 | 59 |
log(1, "second redirection\n"); |
59 | 60 |
# we no more call t_on_negative here; if this destination |
60 | 61 |
# fails too, transaction will complete |
62 |
+ t_relay(); |
|
61 | 63 |
} |
... | ... |
@@ -14,18 +14,21 @@ loadmodule "modules/rr/rr.so" |
14 | 14 |
loadmodule "modules/maxfwd/maxfwd.so" |
15 | 15 |
loadmodule "modules/mysql/mysql.so" |
16 | 16 |
loadmodule "modules/auth/auth.so" |
17 |
+loadmodule "modules/auth_db/auth_db.so" |
|
18 |
+loadmodule "modules/group/group.so" |
|
19 |
+loadmodule "modules/uri/uri.so" |
|
17 | 20 |
|
18 | 21 |
# ----------------- setting module-specific parameters --------------- |
19 | 22 |
|
20 |
-modparam("auth", "db_url","sql://ser:heslo@localhost/ser") |
|
21 |
-modparam("auth", "calculate_ha1", yes) |
|
22 |
-modparam("auth", "password_column", "password") |
|
23 |
+modparam("auth_db", "db_url","sql://ser:heslo@localhost/ser") |
|
24 |
+modparam("auth_db", "calculate_ha1", yes) |
|
25 |
+modparam("auth_db", "password_column", "password") |
|
23 | 26 |
|
24 | 27 |
# -- acc params -- |
25 | 28 |
modparam("acc", "log_level", 1) |
26 | 29 |
# that is the flag for which we will account -- don't forget to |
27 | 30 |
# set the same one :-) |
28 |
-modparam("acc", "acc_flag", 1 ) |
|
31 |
+modparam("acc", "log_flag", 1 ) |
|
29 | 32 |
|
30 | 33 |
# ------------------------- request routing logic ------------------- |
31 | 34 |
|
... | ... |
@@ -48,11 +51,12 @@ route{ |
48 | 51 |
|
49 | 52 |
/* ********* RR ********************************** */ |
50 | 53 |
|
51 |
- /* Do strict routing if route headers present */ |
|
52 |
- rewriteFromRoute(); |
|
54 |
+ /* grant Route routing if route headers present */ |
|
55 |
+ if (loose_route()) { t_relay(); break; }; |
|
56 |
+ |
|
53 | 57 |
/* record-route INVITEs -- all subsequent requests must visit us */ |
54 | 58 |
if (method=="INVITE") { |
55 |
- addRecordRoute(); |
|
59 |
+ record_route(); |
|
56 | 60 |
}; |
57 | 61 |
|
58 | 62 |
# now check if it really is a PSTN destination which should be handled |
... | ... |
@@ -102,19 +106,19 @@ route{ |
102 | 106 |
# calls (destinations beginning with a single zero)? |
103 | 107 |
# (i.e., is he in the "local" group?) |
104 | 108 |
if (uri=~"sip:0[1-9][0-9]+@.*") { |
105 |
- if (!is_in_group("local")) { |
|
109 |
+ if (!is_user_in("credentials", "local")) { |
|
106 | 110 |
sl_send_reply("403", "No permission for local calls"); |
107 | 111 |
break; |
108 | 112 |
}; |
109 | 113 |
# the same for long-distance (destinations begin with two zeros") |
110 | 114 |
} else if (uri=~"sip:00[1-9][0-9]+@.*") { |
111 |
- if (!is_in_group("ld")) { |
|
115 |
+ if (!is_user_in("credentials", "ld")) { |
|
112 | 116 |
sl_send_reply("403", " no permission for LD "); |
113 | 117 |
break; |
114 | 118 |
}; |
115 | 119 |
# the same for international calls (three zeros) |
116 | 120 |
} else if (uri=~"sip:000[1-9][0-9]+@.*") { |
117 |
- if (!is_in_group("int")) { |
|
121 |
+ if (!is_user_in("credentials", "int")) { |
|
118 | 122 |
sl_send_reply("403", "International permissions needed"); |
119 | 123 |
break; |
120 | 124 |
}; |
... | ... |
@@ -19,6 +19,7 @@ loadmodule "modules/maxfwd/maxfwd.so" |
19 | 19 |
loadmodule "modules/usrloc/usrloc.so" |
20 | 20 |
loadmodule "modules/registrar/registrar.so" |
21 | 21 |
loadmodule "modules/auth/auth.so" |
22 |
+loadmodule "modules/auth_db/auth_db.so" |
|
22 | 23 |
|
23 | 24 |
# ----------------- setting module-specific parameters --------------- |
24 | 25 |
|