Browse code

Adding the accounting cfg file used for testing...

ssi authored on 29/08/2002 15:14:54
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,172 @@
1
+#
2
+# $Id$
3
+#
4
+# iptel.org real world configuration
5
+#
6
+
7
+# ----------- global configuration parameters ------------------------
8
+
9
+# we're debugging now
10
+
11
+debug=9          # debug level (cmd line: -dddddddddd)
12
+fork=no
13
+log_stderror=yes	# (cmd line: -E)
14
+
15
+#fork=yes
16
+#children=16
17
+#log_stderror=no	# (cmd line: -E)
18
+
19
+check_via=yes     # (cmd. line: -v)
20
+dns=on           # (cmd. line: -r)
21
+rev_dns=yes      # (cmd. line: -R)
22
+
23
+# experimental usage at port 5060
24
+#port=9060
25
+#port=8060
26
+port=5060
27
+# advertise IP address in Via (as opposed to advertising DNS name
28
+# which is annoying for downstream servers and some phones can
29
+# not handle DNS at all)
30
+#listen=195.37.77.101
31
+#listen=193.175.135.170
32
+# ------------------ module loading ----------------------------------
33
+
34
+loadmodule "../sip_router/modules/sl/sl.so"
35
+loadmodule "../sip_router/modules/print/print.so"
36
+loadmodule "../sip_router/modules/tm/tm_mod.so"
37
+#loadmodule "../sip_router/modules/acc/acc.so"
38
+loadmodule "../sip_router/modules/rr/rr.so"
39
+loadmodule "../sip_router/modules/maxfwd/maxfwd.so"
40
+#loadmodule "../sip_router/modules/mysql/mysql.so"
41
+loadmodule "../sip_router/modules/usrloc/usrloc.so"
42
+#loadmodule "../sip_router/modules/auth/auth.so"
43
+#loadmodule "../sip_router/modules/cpl/cpl.so"
44
+loadmodule "../sip_router/modules/radius_acc/radius_acc.so"
45
+loadmodule "../sip_router/modules/registrar/registrar.so"
46
+
47
+
48
+# ----------------- setting module-specific parameters ---------------
49
+
50
+# -- usrloc params --
51
+
52
+# use in-RAM usrloc
53
+#modparam("usrloc", "use_db", 0)
54
+
55
+# -- acc params --
56
+# report ACKs too for sake of completeness -- as we account PSTN
57
+# destinations which are RR, ACKs should show up
58
+#modparam("acc", "report_ack", 1)
59
+# don't bother me with early media reports (I don't like 183 
60
+# too much anyway...ever thought of timer C hitting after
61
+# listening to music-on-hold for five minutes?)
62
+#modparam("acc", "early_media", 0)
63
+#modparam("acc", "log_level", 1)
64
+# that is the flag for which we will account -- don't forget to
65
+# set the same one :-)
66
+#modparam("acc", "acc_flag", 1 )
67
+# we are interested only in succesful transactions
68
+#modparam("acc", "failed_transactions", 0 )
69
+
70
+
71
+# -- acc params --
72
+# report ACKs too for sake of completeness -- as we account PSTN
73
+# destinations which are RR, ACKs should show up
74
+modparam("radius_acc", "report_ack", 1)
75
+# don't bother me with early media reports (I don't like 183
76
+# too much anyway...ever thought of timer C hitting after
77
+# listening to music-on-hold for five minutes?)
78
+modparam("radius_acc", "early_media", 0)
79
+modparam("radius_acc", "log_level", 1)
80
+# that is the flag for which we will account -- don't forget to
81
+# set the same one :-)
82
+modparam("radius_acc", "acc_flag", 1 )
83
+# we are interested only in succesful transactions
84
+modparam("radius_acc", "failed_transactions", 0 )
85
+
86
+# -- tm params --
87
+modparam("tm", "fr_timer", 30 )
88
+modparam("tm", "fr_inv_timer", 60 )
89
+
90
+# -------------------------  request routing logic -------------------
91
+
92
+# main routing logic
93
+
94
+route{
95
+
96
+	# filter local stateless ACK generated by authentication of mf replies
97
+	sl_filter_ACK();
98
+
99
+	# filter too old messages
100
+	log("LOG: Checking maxfwd\n");
101
+	if (!mf_process_maxfwd_header("10")) {
102
+		log("LOG: Too many hops\n");
103
+		sl_send_reply("483","Too Many Hops");
104
+		break;
105
+	};
106
+
107
+	# len_gt *after* max_fwd, otherwise an "INVITE sip:sos@0.0.0.0"
108
+	# will cause "message too big" for a short message
109
+
110
+	if (len_gt( max_len )) {
111
+		sl_send_reply("513", "Riesengross -- Message too large");
112
+		break;
113
+	};
114
+
115
+	# Do strict routing if route headers present
116
+	if (method=="INVITE") {
117
+		addRecordRoute();
118
+	} else {
119
+		rewriteFromRoute();
120
+	};
121
+
122
+
123
+	# that is outbound request...
124
+
125
+	if (!(uri=~"fox\.iptel\.org([;:].*)*" 
126
+		| uri=~"[@:\.]195\.37\.77\.101([;:].*)*"  )) {
127
+		route(2);
128
+		# break from route (2) return -- stop then !
129
+		break;
130
+	};
131
+	# here we continue with requests for our domain...
132
+
133
+	if (method=="REGISTER") {
134
+		# update Contact database
135
+       	log("LOG: REGISTER is authorized, saving location\n");
136
+		save("location");
137
+		break;
138
+	};
139
+
140
+	# native SIP destinations are handled using our USRLOC DB
141
+	if (!lookup("location")) {
142
+		if (method=="ACK") {
143
+			log("Ooops -- an ACK made it here -- probably UAC screwed up to-tags\n");
144
+			break;
145
+		};
146
+		log("LOG: Unable to lookup contact, sending 404\n");
147
+		sl_send_reply("404", "Not Found");
148
+		break;
149
+	};
150
+
151
+	# label for accounting
152
+	setflag(1);
153
+	# we now know we may, we know where, let it go out now!
154
+	if (!t_relay()) {
155
+		sl_reply_error();
156
+		break;
157
+	};
158
+}
159
+#---------------------------------------------------------------------
160
+
161
+# routing logic for outbound requests targeted out of our domain
162
+# -- use outbound proxy iptel.org (note that except to FOKUS/PBX,
163
+# or itpel.org users, requests will be challenged)
164
+route[2] {
165
+		log("LOG: that's a request to outside");
166
+		# label for accounting
167
+		setflag(1);
168
+		if (!t_relay_to("fox.iptel.org", "5060")) {
169
+			sl_reply_error();
170
+			break;
171
+		};
172
+}