[OpenSIPS-Users] too many hops error in opensips.cfg

bay2x1 rod at racequeen.ph
Fri Mar 20 04:09:10 CET 2009


I am trying to create my own opensips.cfg configuration.  My registration is
working perfectly but my I am having problems in handling invite
transactions.  Can anyone point out and/or explain what is wrong with my
code?

# main request routing logic

route{




	if(!mf_process_maxfwd_header("10")){
		sl_send_reply("483", "Too Many Hops");
		exit;
	};

        #sequential request goes here 
	if(has_totag()){
		if(loose_route()){
			if(is_method("BYE")){
				setflag(1);
				setflag(3);
			}
			route(2);
		} else {

			if(is_method("ACK")){
				if(t_check_trans()){
					t_relay();
					exit;
				}else{
					exit;
				};
			}
			sl_send_reply("404", "Not here");

		};
		exit;
	};

	#initial request goes here

	if(is_method("CANCEL")){
		if(t_check_trans()){
			t_relay();
		}
		exit;
	}


	t_check_trans();
	
	if(method=='REGISTER'){
		route(1);
	}else if (!is_method("REGISTER|MESSAGE")) {
		record_route();
		if((method=="INVITE" && !has_totag())){
			route(2);
		};
		
	};
}

route[1] {   




	if(is_uri_host_local()) {
		if (!www_authorize("", "subscriber"))
		{
			xlog("RQINC-INFO: WWW Registration Challenge by: $fu\n");
			www_challenge("", "0");
			exit;
			
		}
		
		if (!check_to()) 
		{
			sl_send_reply("403","Forbidden auth ID");
			exit;
		}

		
		if (!save("location"))
			sl_reply_error();

		exit;
	} else if {
		sl_send_reply("403", "Forbidden");
	};
}

route[2] {



	
	xlog("RQINC INFO:  Processing Outbound Request! \n");
	xlog("RQINC INFO:  Request Method=$rm! CSEQ=$cs \n");
	t_on_branch("2");
	t_on_reply("2");
	t_on_failure("1");		
	

	if(!t_relay()){
		sl_reply_error();
		exit;
	};
	
	exit;
}




branch_route[2] {
	xlog("RQINC INFO: New Branch at $ru \n");
	xlog("RQINC INFO: $bR = branch CSEQ=$cs\n");
}

onreply_route[2] {
	xlog("RQINC INFO: Incoming Reply \n");
	xlog("RQINC INFO: Reply = $rr and Reply status = $rs  CSEQ=$cs\n");
}

failure_route[1] {

	xlog("RQINC INFO: Request Failure \n");
	if (t_was_cancelled()) {
		xlog("Transaction Cancelled --rqinc CSEQ=$cs\n");
		exit;
	}
	exit;
}

-- 
View this message in context: http://n2.nabble.com/too-many-hops-error-in-opensips.cfg-tp2506888p2506888.html
Sent from the OpenSIPS - Users mailing list archive at Nabble.com.




More information about the Users mailing list