Browse Source

- change functionality in cr_route, cr_prime_route to not store information
about the destination host in the given AVP, instead the content of the
routing description is stored
- no existing functionality is lost, $rt, or $rd + $rp can be used instead
- fix tests to work after modification


git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@5497 689a6050-402a-0410-94f2-e92a70836424

Henning Westerholt 16 năm trước cách đây
mục cha
commit
c0f19179fa
2 tập tin đã thay đổi với 8 bổ sung4 xóa
  1. 6 2
      test/unit/26.cfg
  2. 2 2
      test/unit/26.sh

+ 6 - 2
test/unit/26.cfg

@@ -13,6 +13,7 @@ modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
 avp_aliases="domain=s:10"
 avp_aliases="carrier=s:11"
 avp_aliases="host=s:12"
+avp_aliases="comment=s:13"
 
 route{
 	# initial sanity checks
@@ -32,11 +33,13 @@ route{
 	# user route
 	if(cr_user_carrier("$rU", "$rd", "$avp(carrier)")) {
 		$avp(domain)="domain0";
-		if (!cr_route("$avp(carrier)", "$avp(domain)", "$rU", "$rU", "call_id", "$avp(host)")) {
+		if (!cr_route("$avp(carrier)", "$avp(domain)", "$rU", "$rU", "call_id", "$avp(comment)")) {
 			xlog("L_ERR", "cr_route failed\n");
 			exit;
 		}
 		t_on_failure("1");
+		$avp(host) = $rd+":"+$rp;
+		#xlog("host: $avp(host), comment: $avp(comment)");
 	} else {
 	# default route
 		if (!cr_route("default", "domain0", "$rU", "$rU", "call_id")) {
@@ -55,10 +58,11 @@ failure_route[1] {
 		xlog("L_ERR", "cr_next_domain failed\n");
 		exit;
 	}
-	if (!cr_route("$avp(carrier)", "$avp(domain)", "$rU", "$rU", "call_id", "$avp(host)")) {
+	if (!cr_route("$avp(carrier)", "$avp(domain)", "$rU", "$rU", "call_id")) {
 		xlog("L_ERR", "cr_route failed\n");
 		exit;
 	}
+	$avp(host) = $rd+":"+$rp;
 	t_on_failure("1");
 	append_branch();
 	if (!t_relay()) {

+ 2 - 2
test/unit/26.sh

@@ -46,8 +46,8 @@ $MYSQL "insert into domain_name (id, domain) values ('2', 'domain2');"
 
 $MYSQL "insert into carrierroute (id, carrier, domain, scan_prefix, flags, mask, prob, strip, rewrite_host)
 values ('1','1','10','49','0','0','0.5','0','127.0.0.1:7000');"
-$MYSQL "insert into carrierroute (id, carrier, domain, scan_prefix, flags, mask, prob, strip, rewrite_host)
-values ('2','1','10','49','0','0','0.5','0','127.0.0.1:8000');"
+$MYSQL "insert into carrierroute (id, carrier, domain, scan_prefix, flags, mask, prob, strip, rewrite_host, description)
+values ('2','1','10','49','0','0','0.5','0','127.0.0.1:8000', 'foobar');"
 $MYSQL "insert into carrierroute (id, carrier, domain, scan_prefix, flags, mask, prob, strip, rewrite_host)
 values ('3','2','10','49','0','0','1','0','127.0.0.1:9000');"
 $MYSQL "insert into carrierroute (id, carrier, domain, scan_prefix, flags, mask, prob, strip, rewrite_host)