Browse code

- added msilo sample config script

Daniel-Constantin Mierla authored on 07/04/2003 16:50:57
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,148 @@
1
+#
2
+# MSILO usage example
3
+#
4
+# $ID: daniel $
5
+#
6
+
7
+
8
+debug=9          # debug level (cmd line: -dddddddddd)
9
+fork=no
10
+log_stderror=yes  # (cmd line: -E)
11
+
12
+
13
+children=2
14
+check_via=no      # (cmd. line: -v)
15
+dns=off           # (cmd. line: -r)
16
+rev_dns=off       # (cmd. line: -R)
17
+port=5060
18
+
19
+listen=10.0.0.2
20
+
21
+# ------------------ module loading ----------------------------------
22
+
23
+loadmodule "../sip_router/modules/print/print.so"
24
+loadmodule "../sip_router/modules/textops/textops.so"
25
+
26
+loadmodule "../sip_router/modules/sl/sl.so"
27
+loadmodule "../sip_router/modules/mysql/mysql.so"
28
+loadmodule "../sip_router/modules/maxfwd/maxfwd.so"
29
+loadmodule "../sip_router/modules/msilo/msilo.so"
30
+loadmodule "../sip_router/modules/tm/tm.so"
31
+loadmodule "../sip_router/modules/registrar/registrar.so"
32
+loadmodule "../sip_router/modules/usrloc/usrloc.so"
33
+
34
+# ----------------- setting module-specific parameters ---------------
35
+
36
+# -- registrar params --
37
+
38
+modparam("registrar", "default_expires", 120)
39
+
40
+# -- registrar params --
41
+
42
+modparam("usrloc", "db_mode", 0)
43
+
44
+# -- msilo params --
45
+
46
+modparam("msilo","db_url","sql://user:xxx@127.0.0.1/msilo")
47
+modparam("msilo","registrar","sip:registrar@mydomain.com")
48
+
49
+# -- tm params --
50
+
51
+modparam("tm", "fr_timer", 10 )
52
+modparam("tm", "fr_inv_timer", 15 )
53
+modparam("tm", "wt_timer", 10 )
54
+
55
+
56
+route{
57
+	if ( !mf_process_maxfwd_header("10") )
58
+	{
59
+		sl_send_reply("483","To Many Hops");
60
+		drop();
61
+	};
62
+
63
+
64
+	if (uri==myself) {
65
+	{
66
+		# for testing purposes, simply okay all REGISTERs
67
+		if (method=="REGISTER")
68
+		{
69
+			save("location");
70
+			log("REGISTER received -> dumping messages with MSILO\n");
71
+
72
+			# MSILO - dumping user's offline messages
73
+			if (m_dump())
74
+			{
75
+				log("MSILO: offline messages dumped - if they were\n");
76
+			}else{
77
+				log("MSILO: no offline messages dumped\n");
78
+			};
79
+			break;
80
+		};
81
+
82
+		# domestic SIP destinations are handled using our USRLOC DB
83
+		
84
+		if(!lookup("location")) 
85
+		{
86
+			if (! t_newtran())
87
+   			{
88
+				sl_reply_error();
89
+				break;
90
+   			};
91
+			# we do not care about anything else but MESSAGEs
92
+			if (!method=="MESSAGE")
93
+			{
94
+				if (!t_reply("404", "Not found")) 
95
+				{
96
+					sl_reply_error();
97
+				};
98
+    			break;
99
+			};
100
+			log("MESSAGE received -> storing using MSILO\n");
101
+			# MSILO - storing as offline message
102
+			if (m_store("0"))
103
+			{
104
+				log("MSILO: offline message stored\n");
105
+				if (!t_reply("202", "Accepted")) 
106
+				{
107
+					sl_reply_error();
108
+				};
109
+			}else{
110
+				log("MSILO: offline message NOT stored\n");
111
+				if (!t_reply("503", "Service Unavailable")) 
112
+				{
113
+					sl_reply_error();
114
+				};
115
+			};
116
+			break;
117
+		};
118
+		# if the downstream UA does not support MESSAGE requests
119
+		# go to failure_route[1]
120
+		t_on_failure("1");
121
+		t_relay();
122
+		break;
123
+	};
124
+
125
+	# forward anything else
126
+	t_relay();
127
+}
128
+
129
+failure_route[1] {
130
+	# forwarding failed -- check if the request was a MESSAGE 
131
+	if (!method=="MESSAGE")
132
+	{
133
+    	break;
134
+	};
135
+	
136
+	log(1,"MSILO: the downstream UA does not support MESSAGE requests ...\n");
137
+	# we have changed the R-URI with the contact address -- ignore it now
138
+	if (m_store("1"))
139
+	{
140
+		log("MSILO: offline message stored\n");
141
+		t_reply("202", "Accepted"); 
142
+	}else{
143
+		log("MSILO: offline message NOT stored\n");
144
+		t_reply("503", "Service Unavailable");
145
+	};
146
+}
147
+
148
+