Browse code

Added sample configuration files for presence. For more information see "presence handbook" (ftp://ftp.iptel.org/pub/ser/presence/presence-handbook/index.html)

Vaclav Kubart authored on 04/04/2006 15:37:54
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,412 @@
1
+debug=3         # debug level (cmd line: -dddddddddd)
2
+#fork=yes
3
+#log_stderror=no	# (cmd line: -E)
4
+#memlog=5 # memory debug log level
5
+#log_facility=LOG_LOCAL0 # sets the facility used for logging (see syslog(3))
6
+
7
+check_via=no	# (cmd. line: -v)
8
+dns=no           # (cmd. line: -r)
9
+rev_dns=no      # (cmd. line: -R)
10
+port=5060
11
+children=2
12
+alias="test-domain.com"
13
+
14
+#user=ser
15
+#group=ser
16
+#open_fd_limit=1024 # sets the open file descriptors limit
17
+mhomed=yes  # usefull for multihomed hosts, small performance penalty
18
+
19
+#disable_tcp=yes 
20
+tcp_accept_aliases=yes # accepts the tcp alias via option (see NEWS)
21
+tcp_poll_method="sigio_rt"
22
+
23
+# ------------------ module loading ----------------------------------
24
+
25
+# Uncomment this if you want to use SQL database
26
+loadmodule "/usr/lib/ser/modules/sl.so"
27
+loadmodule "/usr/lib/ser/modules/avp.so"
28
+loadmodule "/usr/lib/ser/modules/avpops.so"
29
+loadmodule "/usr/lib/ser/modules/tm.so"
30
+loadmodule "/usr/lib/ser/modules/rr.so"
31
+loadmodule "/usr/lib/ser/modules/maxfwd.so"
32
+loadmodule "/usr/lib/ser/modules/usrloc.so"
33
+loadmodule "/usr/lib/ser/modules/registrar.so"
34
+loadmodule "/usr/lib/ser/modules/textops.so"
35
+loadmodule "/usr/lib/ser/modules/mysql.so"
36
+loadmodule "/usr/lib/ser/modules/dialog.so"
37
+loadmodule "/usr/lib/ser/modules/rls.so"
38
+loadmodule "/usr/lib/ser/modules/pa.so"
39
+loadmodule "/usr/lib/ser/modules/presence_b2b.so"
40
+loadmodule "/usr/lib/ser/modules/uri.so"
41
+loadmodule "/usr/lib/ser/modules/uri_db.so"
42
+loadmodule "/usr/lib/ser/modules/domain.so"
43
+loadmodule "/usr/lib/ser/modules/fifo.so"
44
+loadmodule "/usr/lib/ser/modules/xmlrpc.so"
45
+loadmodule "/usr/lib/ser/modules/xlog.so"
46
+#loadmodule "/usr/lib/ser/modules/unixsock.so"
47
+
48
+# Uncomment this if you want digest authentication
49
+# mysql.so must be loaded !
50
+loadmodule "/usr/lib/ser/modules/auth.so"
51
+loadmodule "/usr/lib/ser/modules/auth_db.so"
52
+loadmodule "/usr/lib/ser/modules/msilo.so"
53
+
54
+# ----------------- setting module-specific parameters ---------------
55
+
56
+# modparam("msilo","registrar","sip:registrar@test-domain.com")
57
+modparam("msilo","use_contact",0)
58
+modparam("msilo","expire_time",7200)
59
+
60
+# -- usrloc params --
61
+
62
+# -- auth params --
63
+# Uncomment if you are using auth module
64
+#
65
+modparam("auth_db", "calculate_ha1", yes)
66
+#
67
+# If you set "calculate_ha1" parameter to yes (which true in this config), 
68
+# uncomment also the following parameter)
69
+#
70
+modparam("auth_db", "password_column", "password")
71
+
72
+# -- rr params --
73
+# add value to ;lr param to make some broken UAs happy
74
+modparam("rr", "enable_full_lr", 1)
75
+
76
+modparam("rls", "min_expiration", 200)
77
+modparam("rls", "max_expiration", 300)
78
+modparam("rls", "default_expiration", 300)
79
+modparam("rls", "auth", "none")
80
+modparam("rls", "xcap_root", "http://localhost/xcap")
81
+modparam("rls", "reduce_xcap_needs", 1)
82
+modparam("rls", "db_mode", 0)
83
+modparam("rls", "db_url", "mysql://ser:heslo@localhost:3306/ser")
84
+
85
+modparam("pa", "use_db", 0)
86
+# allow storing authorization requests for offline users into database
87
+modparam("pa", "use_offline_winfo", 1)
88
+# how often try to remove old stored authorization requests
89
+modparam("pa", "offline_winfo_timer", 600)
90
+# how long stored authorization requests live
91
+modparam("pa", "offline_winfo_expiration", 600)
92
+modparam("pa", "db_url", "mysql://ser:heslo@localhost:3306/ser")
93
+# mode of PA authorization: none, implicit or xcap
94
+modparam("pa", "auth", "xcap")
95
+modparam("pa", "auth_xcap_root", "http://localhost/xcap")
96
+# do not authorize watcherinfo subscriptions
97
+modparam("pa", "winfo_auth", "none")
98
+# use only published information if set to 0
99
+modparam("pa", "use_callbacks", 1)
100
+# don't accept internal subscriptions from RLS, ...
101
+modparam("pa", "accept_internal_subscriptions", 0)
102
+# maximum value of Expires for subscriptions
103
+modparam("pa", "max_subscription_expiration", 600)
104
+# maximum value of Expires for publications
105
+modparam("pa", "max_publish_expiration", 120)
106
+# how often test if something changes and send NOTIFY
107
+modparam("pa", "timer_interval", 10)
108
+
109
+# route for generated SUBSCRIBE requests for presence
110
+modparam("presence_b2b", "presence_route", "<sip:127.0.0.1;transport=tcp;lr>")
111
+# waiting time from error to new attepmt about SUBSCRIBE
112
+modparam("presence_b2b", "on_error_retry_time", 60)
113
+# how long wait for NOTIFY with Subscription-Status=terminated after unsubscribe
114
+modparam("presence_b2b", "wait_for_term_notify", 33)
115
+# how long before expiration send renewal SUBSCRIBE request
116
+modparam("presence_b2b", "resubscribe_delta", 30)
117
+# minimal time to send renewal SUBSCRIBE request from receiving previous response
118
+modparam("presence_b2b", "min_resubscribe_time", 60)
119
+# default expiration timeout
120
+modparam("presence_b2b", "default_expiration", 3600)
121
+# process internal subscriptions to presence events
122
+modparam("presence_b2b", "handle_presence_subscriptions", 1)
123
+
124
+modparam("usrloc", "db_mode", 0)
125
+modparam("domain", "db_mode", 1)
126
+modparam("domain|uri_db|acc|auth_db|usrloc|msilo", "db_url", "mysql://ser:heslo@localhost:3306/ser")
127
+
128
+modparam("fifo", "fifo_file", "/tmp/ser_fifo")
129
+
130
+# -------------------------  request routing logic -------------------
131
+
132
+# main routing logic
133
+
134
+route{
135
+	# XML RPC
136
+	if (method == "POST" ||  method == "GET") {
137
+		create_via();
138
+		dispatch_rpc();
139
+		break;
140
+	}
141
+
142
+	# initial sanity checks -- messages with
143
+	# max_forwards==0, or excessively long requests
144
+	if (!mf_process_maxfwd_header("10")) {
145
+		sl_send_reply("483","Too Many Hops");
146
+		break;
147
+	};
148
+	if (msg:len >=  max_len ) {
149
+		sl_send_reply("513", "Message too big");
150
+		break;
151
+	};
152
+	
153
+	# we record-route all messages -- to make sure that
154
+	# subsequent messages will go through our proxy; that's
155
+	# particularly good if upstream and downstream entities
156
+	# use different transport protocol
157
+	if (!method=="REGISTER") record_route();	
158
+
159
+	# subsequent messages withing a dialog should take the
160
+	# path determined by record-routing
161
+	if (loose_route()) {
162
+		# mark routing logic in request
163
+		append_hf("P-hint: rr-enforced\r\n"); 
164
+		route(1);
165
+		break;
166
+	};
167
+
168
+	# if the request is for other domain use UsrLoc
169
+	# (in case, it does not work, use the following command
170
+	# with proper names and addresses in it)
171
+	if (uri==myself) {
172
+	
173
+		if (!lookup_domain("To")) {
174
+			xlog("L_ERR", "Unknown domain to: %tu from: %fu\n");
175
+			route(1);
176
+			break;
177
+		}
178
+		
179
+		if (method=="SUBSCRIBE") {
180
+			if (!t_newtran()) {
181
+				sl_reply_error();
182
+				break;
183
+			};
184
+			
185
+			if (@to.tag=="") { 
186
+				# only for new subscriptions (with empty to tag)
187
+
188
+				if (lookup_user("To")) {
189
+					# existing user -> it is subscription to PA
190
+					if (handle_subscription("registrar")) {
191
+						if ((@msg.event=~"presence\.winfo")) {
192
+							# new watcher info subscription
193
+							# sends one watcher info NOTIFY message with all saved authorization requests
194
+							xlog("L_ERR", "dumping stored winfo to %fu\n");
195
+							dump_stored_winfo("registrar", "presence");
196
+						}
197
+						else {
198
+							# new presence subscription
199
+							if ((@msg.event=~"presence") && (%subscription_status=="pending")) {
200
+								# if offline user and new pending subscription 
201
+								if (!target_online("registrar")) {
202
+									#%subscription_status="waiting"; # store it as waiting subscription
203
+									xlog("L_ERR", "storing 'pending' winfo to: %tu, from: %fu\n");
204
+									store_winfo("registrar");
205
+								}
206
+							}
207
+						}
208
+					}
209
+					break;
210
+				}
211
+				
212
+				if ((@msg.supported=~"eventlist")) {
213
+					# such user doesn't exist and Supported header field
214
+					#    -> probably RLS subscription
215
+				
216
+					if (lookup_domain("From")) {
217
+						if (lookup_user("From")) {
218
+							if (is_simple_rls_target("$uid-list")) {
219
+								# log(1, "it is simple subscription!\n");
220
+								# takes From UID and makes XCAP query for user's 
221
+								# list named "default"
222
+								if (!query_resource_list("default")) {
223
+									t_reply("404", "No such user list");
224
+									break;
225
+								}
226
+							}
227
+						}
228
+					}
229
+				
230
+					if (!have_flat_list()) {
231
+						# query_resource_list failed or was not called
232
+						# do standard RLS query acording to To/AOR
233
+						if (!query_rls_services()) {
234
+							log(1, "XCAP query failed\n");
235
+							t_reply("404", "No such list URI");
236
+							break;
237
+						}
238
+					}
239
+				
240
+					# uncomment this if you want to authenticate first SUBSCRIBE request to resource list
241
+#					if (!proxy_authenticate("test-domain.com", "credentials")) {
242
+#						proxy_challenge( "test-domain.com", "0");
243
+#						break;
244
+#					};	
245
+					
246
+					handle_rls_subscription("1");
247
+				}
248
+				else {
249
+					# not resource list subscription -> invalid user
250
+					xlog("L_ERR", "subscription to invalid user %tu\n");
251
+					t_reply("404", "User not found");
252
+				}
253
+				
254
+				break;
255
+			}
256
+			else {
257
+				# renewal subscriptions - try to handle it as RLS and if failed, handle it as PA subscription
258
+				# FIXME: better will be test like existing_rls_subscription() 
259
+				#        and existing_subscription("registrar")
260
+				if (!handle_rls_subscription("0")) {
261
+					handle_subscription("registrar");
262
+				}
263
+				break;
264
+			}
265
+		};
266
+
267
+		# get user (common for all other messages than SUBSCRIBE)
268
+		if (!lookup_user("To")) {
269
+			# log(1, "Unknown user - message should be forwarded?");
270
+#			# break;
271
+			append_hf("P-hint: unknown user\r\n"); 
272
+			route(1);
273
+			break;
274
+		}
275
+		
276
+		if (method=="PUBLISH") {
277
+			if (!t_newtran()) {
278
+#			   log(1, "newtran error\n");
279
+			   sl_reply_error();
280
+			   break;
281
+			};
282
+			handle_publish("registrar");
283
+
284
+			# deliver messages to online user
285
+			# TODO: only if user goes from offline to online?
286
+			if (target_online("registrar")) {
287
+				# log(1, "Dumping stored messages\n");
288
+				# dump stored messages - route it through myself (otherwise routed via DNS!)
289
+				if (m_dump("sip:127.0.0.1")) {
290
+					xlog("L_ERR", "MSILO: offline messages for %fu dumped\n");
291
+				}
292
+			}
293
+
294
+			break;
295
+		};
296
+	
297
+ 		if (method=="NOTIFY") {
298
+ 			if (!t_newtran()) {
299
+ 			   log(1, "newtran error\n");
300
+ 			   sl_reply_error();
301
+			   break;
302
+ 			};
303
+			# handle notification sent in internal subscriptions (presence_b2b)
304
+ 			if (!handle_notify()) {
305
+ 				t_reply("481", "Unable to handle notification");
306
+ 			}
307
+ 			break;
308
+ 		};
309
+		
310
+		if (method=="MESSAGE") {
311
+
312
+			if (authorize_message("http://localhost/xcap")) {
313
+				
314
+				# use usrloc for delivery
315
+				if (lookup("location")) {
316
+				
317
+					log(1, "Delivering MESSAGE using usrloc\n");
318
+					t_on_failure("1");
319
+					if (!t_relay()) {
320
+						sl_reply_error();
321
+					}
322
+					
323
+					break;
324
+				}
325
+				else {
326
+					# store messages for offline user
327
+					xlog("L_ERR", "MSILO: storing MESSAGE for %tu\n");
328
+					
329
+					if (!t_newtran()) {
330
+					   log(1, "newtran error\n");
331
+					   sl_reply_error();
332
+					   break;
333
+					};
334
+
335
+					# store only text messages NOT isComposing... !
336
+					if (search("^(Content-Type|c):.*application/im-iscomposing\+xml.*")) {
337
+						log(1, "it is only isComposing message - ignored\n");
338
+						t_reply("202", "Ignored");
339
+						break;
340
+					}
341
+					
342
+					if (m_store("0", "sip:127.0.0.1")) {
343
+	#	                log(1, "MSILO: offline message stored\n");
344
+						if (!t_reply("202", "Accepted")) {
345
+							sl_reply_error();
346
+						};
347
+					} else {
348
+						log(1, "MSILO: error storing offline message\n");
349
+						if (!t_reply("503", "Service Unavailable")) {
350
+							sl_reply_error();
351
+						};
352
+					};
353
+					break;
354
+				}
355
+				break;
356
+			}
357
+			else {
358
+				# log(1, "unauthorized message\n");
359
+				sl_reply("403", "Forbidden");
360
+			}
361
+			break;
362
+		}
363
+		
364
+		if (method=="REGISTER") {
365
+			# uncomment this if you want to authenticate REGISTER request
366
+#			if (!www_authenticate("test-domain.com", "credentials")) {
367
+#				www_challenge( "test-domain.com", "0");
368
+#				break;
369
+#			};
370
+			
371
+			save("location");
372
+			
373
+			# dump stored messages - route it through myself (otherwise routed via DNS!)
374
+			if (m_dump("sip:127.0.0.1")) {
375
+                xlog("L_ERR", "MSILO: offline messages for %fu dumped\n");
376
+			}
377
+			break;
378
+		};
379
+
380
+		# native SIP destinations are handled using our USRLOC DB
381
+		if (!lookup("location")) {
382
+			sl_send_reply("404", "Not Found");
383
+			break;
384
+		};
385
+	};
386
+#	append_hf("P-hint: usrloc applied\r\n"); 
387
+	route(1);
388
+}
389
+
390
+route[1] 
391
+{
392
+	# send it out now; use stateful forwarding as it works reliably
393
+	# even for UDP2TCP
394
+	if (!t_relay()) {
395
+		sl_reply_error();
396
+	};
397
+}
398
+
399
+
400
+failure_route[1] {
401
+	# forwarding failed -- check if the request was a MESSAGE
402
+	if (!method=="MESSAGE") { break; };
403
+	log(1, "MSILO: MESSAGE forward failed - storing it\n");
404
+	
405
+    # we have changed the R-URI with the contact address, ignore it now
406
+	if (m_store("0", "")) {
407
+		t_reply("202", "Accepted");
408
+	} else {
409
+		log(1, "MSILO: offline message NOT stored\n");
410
+		t_reply("503", "Service Unavailable");
411
+	};
412
+}
0 413
new file mode 100644
... ...
@@ -0,0 +1,225 @@
1
+debug=3         # debug level (cmd line: -dddddddddd)
2
+
3
+check_via=no	# (cmd. line: -v)
4
+dns=no           # (cmd. line: -r)
5
+rev_dns=no      # (cmd. line: -R)
6
+port=5060
7
+children=2
8
+alias="test-domain.com"
9
+
10
+mhomed=yes  # usefull for multihomed hosts, small performance penalty
11
+
12
+tcp_accept_aliases=yes # accepts the tcp alias via option (see NEWS)
13
+tcp_poll_method="sigio_rt"
14
+
15
+# ------------------ module loading ----------------------------------
16
+
17
+# Uncomment this if you want to use SQL database
18
+loadmodule "/home/kubartv/SER/lib/ser/modules/sl.so"
19
+loadmodule "/home/kubartv/SER/lib/ser/modules/avp.so"
20
+loadmodule "/home/kubartv/SER/lib/ser/modules/avpops.so"
21
+loadmodule "/home/kubartv/SER/lib/ser/modules/tm.so"
22
+loadmodule "/home/kubartv/SER/lib/ser/modules/rr.so"
23
+loadmodule "/home/kubartv/SER/lib/ser/modules/maxfwd.so"
24
+loadmodule "/home/kubartv/SER/lib/ser/modules/usrloc.so"
25
+loadmodule "/home/kubartv/SER/lib/ser/modules/registrar.so"
26
+loadmodule "/home/kubartv/SER/lib/ser/modules/textops.so"
27
+loadmodule "/home/kubartv/SER/lib/ser/modules/dialog.so"
28
+loadmodule "/home/kubartv/SER/lib/ser/modules/rls.so"
29
+loadmodule "/home/kubartv/SER/lib/ser/modules/pa.so"
30
+loadmodule "/home/kubartv/SER/lib/ser/modules/presence_b2b.so"
31
+loadmodule "/home/kubartv/SER/lib/ser/modules/uri.so"
32
+loadmodule "/home/kubartv/SER/lib/ser/modules/fifo.so"
33
+loadmodule "/home/kubartv/SER/lib/ser/modules/xmlrpc.so"
34
+loadmodule "/home/kubartv/SER/lib/ser/modules/xlog.so"
35
+
36
+# ----------------- setting module-specific parameters ---------------
37
+
38
+# add value to ;lr param to make some broken UAs happy
39
+modparam("rr", "enable_full_lr", 1)
40
+
41
+modparam("rls", "min_expiration", 120)
42
+modparam("rls", "max_expiration", 120)
43
+modparam("rls", "default_expiration", 120)
44
+modparam("rls", "auth", "none")
45
+modparam("rls", "xcap_root", "http://localhost/xcap")
46
+modparam("rls", "reduce_xcap_needs", 1)
47
+modparam("rls", "db_mode", 0)
48
+# modparam("rls", "db_url", "mysql://ser:heslo@127.0.0.1:3306/ser")
49
+
50
+modparam("pa", "use_db", 0)
51
+modparam("pa", "offline_winfo_timer", 600)
52
+modparam("pa", "offline_winfo_expiration", 600)
53
+# modparam("pa", "db_url", "mysql://ser:heslo@127.0.0.1:3306/ser")
54
+# mode of PA authorization: none, implicit or xcap
55
+modparam("pa", "auth", "xcap")
56
+modparam("pa", "auth_xcap_root", "http://localhost/xcap")
57
+modparam("pa", "winfo_auth", "none")
58
+modparam("pa", "use_callbacks", 1)
59
+modparam("pa", "accept_internal_subscriptions", 0)
60
+modparam("pa", "max_subscription_expiration", 120)
61
+modparam("pa", "timer_interval", 1)
62
+
63
+modparam("presence_b2b", "presence_route", "<sip:127.0.0.1;lr>")
64
+# modparam("presence_b2b", "presence_route", "<sip:127.0.0.1;transport=tcp;lr>")
65
+modparam("presence_b2b", "on_error_retry_time", 60)
66
+modparam("presence_b2b", "wait_for_term_notify", 33)
67
+modparam("presence_b2b", "resubscribe_delta", 30)
68
+modparam("presence_b2b", "min_resubscribe_time", 60)
69
+modparam("presence_b2b", "default_expiration", 3600)
70
+modparam("presence_b2b", "handle_presence_subscriptions", 1)
71
+
72
+modparam("usrloc", "db_mode", 0)
73
+# modparam("domain|uri_db|acc|auth_db|usrloc|msilo", "db_url", "mysql://ser:heslo@127.0.0.1:3306/ser")
74
+
75
+modparam("fifo", "fifo_file", "/tmp/ser_fifo")
76
+
77
+# -------------------------  request routing logic -------------------
78
+
79
+# main routing logic
80
+
81
+route{
82
+	# XML RPC
83
+	if (method == "POST" ||  method == "GET") {
84
+		create_via();
85
+		dispatch_rpc();
86
+		break;
87
+	}
88
+
89
+	# initial sanity checks -- messages with
90
+	# max_forwards==0, or excessively long requests
91
+	if (!mf_process_maxfwd_header("10")) {
92
+		sl_send_reply("483","Too Many Hops");
93
+		break;
94
+	};
95
+	if (msg:len >=  max_len ) {
96
+		sl_send_reply("513", "Message too big");
97
+		break;
98
+	};
99
+	
100
+	# we record-route all messages -- to make sure that
101
+	# subsequent messages will go through our proxy; that's
102
+	# particularly good if upstream and downstream entities
103
+	# use different transport protocol
104
+	if (!method=="REGISTER") record_route();	
105
+
106
+	# subsequent messages withing a dialog should take the
107
+	# path determined by record-routing
108
+	if (loose_route()) {
109
+		# mark routing logic in request
110
+		append_hf("P-hint: rr-enforced\r\n"); 
111
+		route(1);
112
+		break;
113
+	};
114
+
115
+	if (uri==myself) {
116
+	
117
+		if (method=="SUBSCRIBE") {
118
+			if (!t_newtran()) {
119
+				sl_reply_error();
120
+				break;
121
+			};
122
+			
123
+			# new subscription
124
+			if (@to.tag=="") { 
125
+				if ((@msg.supported=~"eventlist")) {
126
+					# Supported header field
127
+					#    -> may be RLS subscription
128
+
129
+					if (is_simple_rls_target("$uid-list")) {
130
+						# log(1, "it is simple subscription!\n");
131
+						# handle_rls_subscription("1");
132
+						# takes From UID and makes XCAP query
133
+						# for user's list named "default"
134
+						if (@to.tag=="") { 
135
+							# only for new subscriptions (with empty to tag
136
+							if (!query_resource_list("default")) {
137
+								t_reply("500", "XCAP query error");
138
+								break;
139
+							}
140
+						}
141
+					}
142
+					
143
+					if (!have_flat_list()) {
144
+						# query_resource_list failed or was not called
145
+						# do standard RLS query acording to To/AOR
146
+						query_rls_services();
147
+					}
148
+					
149
+					if (have_flat_list()) {
150
+						handle_rls_subscription("1");
151
+						break;
152
+					}
153
+				}
154
+					
155
+				# SUBSCRIBE to existing user
156
+				# xlog("L_ERR", "PA: handling subscription: %tu from: %fu\n");
157
+				handle_subscription("registrar");
158
+				
159
+				break;
160
+			}
161
+			else { # renewal subscription
162
+				if (!handle_rls_subscription("0")) {
163
+					handle_subscription("registrar");
164
+				}
165
+				break;
166
+			}
167
+			
168
+		}
169
+
170
+		if (method=="REGISTER") {
171
+			save("location");
172
+			break;
173
+		};
174
+		
175
+			
176
+		if (method=="PUBLISH") {
177
+			if (!t_newtran()) {
178
+			   sl_reply_error();
179
+			   break;
180
+			};
181
+			handle_publish("registrar");
182
+			break;
183
+		};
184
+		
185
+ 		if (method=="NOTIFY") {
186
+ 			if (!t_newtran()) {
187
+ 			   log(1, "newtran error\n");
188
+ 			   sl_reply_error();
189
+			   break;
190
+ 			};
191
+ 			if (!handle_notify()) {
192
+ 				t_reply("481", "Unable to handle notification");
193
+ 			}
194
+ 			break;
195
+ 		};
196
+	
197
+		# message authorization
198
+		if (method=="MESSAGE") {
199
+			log(1, "MESSAGE authorization\n");
200
+			if (!authorize_message("http://localhost/xcap")) {
201
+				sl_reply("403", "Forbidden");
202
+				break;
203
+			}
204
+		}
205
+	
206
+		# native SIP destinations are handled using our USRLOC DB
207
+		if (!lookup("location")) {
208
+			sl_send_reply("404", "Not Found");
209
+			break;
210
+		};
211
+	};
212
+#	append_hf("P-hint: usrloc applied\r\n"); 
213
+	route(1);
214
+}
215
+
216
+route[1] 
217
+{
218
+	# send it out now; use stateful forwarding as it works reliably
219
+	# even for UDP2TCP
220
+	if (!t_relay()) {
221
+		sl_reply_error();
222
+	};
223
+}
224
+
225
+