Browse code

t_relay_cancel() is added to the sample configuration

Miklos Tirpak authored on 30/05/2007 12:28:17
Showing 1 changed files
... ...
@@ -154,6 +154,9 @@ route{
154 154
 	# first do some initial sanity checks
155 155
 	route(INIT);
156 156
 
157
+	# bypass the rest of the script for CANCELs if possible
158
+	route(CATCH_CANCEL);
159
+
157 160
 	# check if the request is routed via Route header or
158 161
 	# needs a Record-Route header
159 162
 	route(RR);
... ...
@@ -497,6 +500,22 @@ route[PSTN]
497 500
 	}
498 501
 }
499 502
 
503
+route[CATCH_CANCEL] {
504
+	# check whether there is a corresponding INVITE to the CANCEL,
505
+	# and bypass the rest of the script if possible
506
+
507
+	if (method == CANCEL) {
508
+		if (!t_relay_cancel()) { # implicit drop if the INVITE was found
509
+
510
+			# INVITE was found but some error occurred
511
+			sl_reply("500", "Internal Server Error");
512
+			drop;
513
+		}
514
+		# bad luck, no corresponding INVITE was found,
515
+		# we have to continue with the script
516
+	}
517
+}
518
+
500 519
 failure_route[FAILURE_ROUTE]
501 520
 {
502 521
 	# mark for the other routes that we are operating from here on from a