Browse code

examples aligned to 8.11

Jiri Kuthan authored on 03/06/2003 03:18:12
Showing 9 changed files
... ...
@@ -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 62
 
63 63
 
64 64
 	if (uri==myself) {
65
-	{
66 65
 		# for testing purposes, simply okay all REGISTERs
67 66
 		if (method=="REGISTER")
68 67
 		{
... ...
@@ -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 58
 	log(1, "second redirection\n");
59 59
 	# we no more call t_on_negative here; if this destination
60 60
 	# fails too, transaction will complete
61
+	t_relay();
61 62
 }
... ...
@@ -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 48
 
49 49
 	/* ********* RR ********************************** */
50 50
 
51
-	/* Do strict routing if route headers present */
52
-	rewriteFromRoute();
51
+	/* grant Route routing if route headers present */
52
+	if (loose_route()) { t_relay(); break; };
53
+	
53 54
 	/* record-route INVITEs -- all subsequent requests must visit us */
54 55
 	if (method=="INVITE") {
55
-		addRecordRoute();
56
+		record_route();
56 57
 	};
57 58
 
58 59
 	# now check if it really is a PSTN destination which should be handled
... ...
@@ -102,19 +106,19 @@ route{
102 102
 			# calls (destinations beginning with a single zero)? 
103 103
 			# (i.e., is he in the "local" group?)
104 104
 			if (uri=~"sip:0[1-9][0-9]+@.*") {
105
-				if (!is_in_group("local")) {
105
+				if (!is_user_in("credentials", "local")) {
106 106
 					sl_send_reply("403", "No permission for local calls"); 
107 107
 					break;
108 108
 				};
109 109
 			# the same for long-distance (destinations begin with two zeros")
110 110
 			} else if (uri=~"sip:00[1-9][0-9]+@.*") {
111
-				if (!is_in_group("ld")) {
111
+				if (!is_user_in("credentials", "ld")) {
112 112
 					sl_send_reply("403", " no permission for LD ");
113 113
 					break;
114 114
 				};
115 115
 			# the same for international calls (three zeros)
116 116
 			} else if (uri=~"sip:000[1-9][0-9]+@.*") {
117
-				if (!is_in_group("int")) {
117
+				if (!is_user_in("credentials", "int")) {
118 118
 					sl_send_reply("403", "International permissions needed");
119 119
 					break;
120 120
 				};
... ...
@@ -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
 
... ...
@@ -44,6 +44,6 @@ route{
44 44
 		if (!t_reply("699", "I don't want to chat with you")) {
45 45
 			sl_reply_error();
46 46
 		};
47
-    	};
47
+   	};
48 48
 }
49 49