Bläddra i källkod

- fix and extend carrierroute loading tests

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@3807 689a6050-402a-0410-94f2-e92a70836424
Henning Westerholt 17 år sedan
förälder
incheckning
b1bdf4a2d5
4 ändrade filer med 75 tillägg och 4 borttagningar
  1. 67 0
      test/unit/13.cfg
  2. 1 1
      test/unit/13.sh
  3. 6 2
      test/unit/14.cfg
  4. 1 1
      test/unit/23.sh

+ 67 - 0
test/unit/13.cfg

@@ -0,0 +1,67 @@
+mpath="../modules"
+loadmodule "sl/sl.so"
+loadmodule "tm/tm.so"
+loadmodule "xlog/xlog.so"
+loadmodule "maxfwd/maxfwd.so"
+loadmodule "carrierroute/carrierroute.so"
+loadmodule "mi_fifo/mi_fifo.so"
+
+modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")
+
+avp_aliases="domain=s:10"
+avp_aliases="carrier=s:11"
+avp_aliases="host=s:12"
+
+route{
+	# initial sanity checks
+	if (!mf_process_maxfwd_header("10")) {
+		sl_send_reply("483","Too Many Hops");
+		return;
+	};
+	if (msg:len >  max_len) {
+		sl_send_reply("513", "Message too big");
+		return;
+	};
+	if (method == "REGISTER") {
+		if(!cr_route("default", "register", "$rU", "$rU", "call_id", "$avp(s:30)")) {
+			sl_send_reply("403", "Not allowed");
+		}
+		sl_send_reply("200", "OK");
+		return;
+	}
+	if (method == "INVITE") {
+		if(!cr_route("default", "proxy", "$rU", "$rU", "call_id")) {
+			sl_send_reply("403", "Not allowed");
+		}
+		sl_send_reply("100", "Trying");
+		return;
+	}
+	cr_user_carrier("$fU", "$fd", "$avp(carrier)");
+	$avp(domain)="start";
+	if (!cr_route("$avp(carrier)", "$avp(domain)", "$rU", "$rU", "call_id", "$avp(host)")) {
+		xlog("L_ERR", "cr_route failed\n");
+		exit;
+	}
+	t_on_failure("1");
+		if (!t_relay()) {
+		sl_reply_error();
+	};
+}
+
+failure_route[1] {
+	revert_uri();
+		if (!cr_next_domain("$avp(carrier)", "$avp(domain)", "$rU", "$avp(host)", "$T_reply_code", "$avp(domain)")) {
+			xlog("L_ERR", "cr_next_domain failed\n");
+			exit;
+		}
+	if (!cr_route("$avp(carrier)", "$avp(domain)", "$rU", "$rU", "call_id", "$avp(host)")) {
+		xlog("L_ERR", "cr_route failed\n");
+		exit;
+	}
+	t_on_failure("1");
+	append_branch();
+	if (!t_relay()) {
+		xlog("L_ERR", "t_relay failed\n");
+		exit;
+	};
+}

+ 1 - 1
test/unit/13.sh

@@ -19,7 +19,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
-CFG=14.cfg
+CFG=13.cfg
 
 if [ ! -e ../modules/carrierroute/carrierroute.so ] ; then
 	echo "carrierroute not found, not run"

+ 6 - 2
test/unit/14.cfg

@@ -7,6 +7,10 @@ loadmodule "mi_fifo/mi_fifo.so"
 
 modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")
 
+avp_aliases="domain=s:10"
+avp_aliases="carrier=s:11"
+avp_aliases="host=s:12"
+
 route{
 	# initial sanity checks
 	if (!mf_process_maxfwd_header("10")) {
@@ -18,14 +22,14 @@ route{
 		return;
 	};
 	if (method == "REGISTER") {
-		if(!cr_route("default", "register", "$rU", "$rU", "call_id", "crc32")) {
+		if(!cr_route("default", "register", "$rU", "$rU", "call_id", "$avp(s:30)")) {
 			sl_send_reply("403", "Not allowed");
 		}
 		sl_send_reply("200", "OK");
 		return;
 	}
 	if (method == "INVITE") {
-		if(!cr_route("default", "proxy", "$rU", "$rU", "call_id", "crc32")) {
+		if(!cr_route("default", "proxy", "$rU", "$rU", "call_id")) {
 			sl_send_reply("403", "Not allowed");
 		}
 		sl_send_reply("100", "Trying");

+ 1 - 1
test/unit/23.sh

@@ -19,7 +19,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
-CFG=14.cfg
+CFG=13.cfg
 
 if [ ! -e ../modules/carrierroute/carrierroute.so ] ; then
 	echo "carrierroute not found, not run"