فهرست منبع

t_relay_cancel() is added to the sample configuration

Miklos Tirpak 18 سال پیش
والد
کامیت
a0a27c73e3
1فایلهای تغییر یافته به همراه19 افزوده شده و 0 حذف شده
  1. 19 0
      etc/ser.cfg

+ 19 - 0
etc/ser.cfg

@@ -154,6 +154,9 @@ route{
 	# first do some initial sanity checks
 	route(INIT);
 
+	# bypass the rest of the script for CANCELs if possible
+	route(CATCH_CANCEL);
+
 	# check if the request is routed via Route header or
 	# needs a Record-Route header
 	route(RR);
@@ -497,6 +500,22 @@ route[PSTN]
 	}
 }
 
+route[CATCH_CANCEL] {
+	# check whether there is a corresponding INVITE to the CANCEL,
+	# and bypass the rest of the script if possible
+
+	if (method == CANCEL) {
+		if (!t_relay_cancel()) { # implicit drop if the INVITE was found
+
+			# INVITE was found but some error occurred
+			sl_reply("500", "Internal Server Error");
+			drop;
+		}
+		# bad luck, no corresponding INVITE was found,
+		# we have to continue with the script
+	}
+}
+
 failure_route[FAILURE_ROUTE]
 {
 	# mark for the other routes that we are operating from here on from a