All pastes #493807 Raw Edit

openser ACK loop

public text v1 · immutable
#493807 ·published 2007-05-17 23:03 UTC
rendered paste body
U 2007/05/17 18:09:23.135336 10.14.18.224:5061 -> 10.14.18.22:5060
INVITE sip:8989@10.14.18.22:5060 SIP/2.0.
Via: SIP/2.0/UDP 127.0.0.1:5061;branch=z9hG4bK-2008-1-0.
From: sipp <sip:sipp@127.0.0.1:5061>;tag=2008SIPpTag001.
To: sut <sip:8989@10.14.18.22:5060>.
Call-ID: 1-2008@127.0.0.1.
CSeq: 1 INVITE.
Contact: sip:sipp@127.0.0.1:5061.
Max-Forwards: 70.
Subject: Performance Test.
Content-Type: application/sdp.
Content-Length:  129.
.
v=0.
o=user1 53655765 2353687637 IN IP4 127.0.0.1.
s=-.
c=IN IP4 127.0.0.1.
t=0 0.
m=audio 6000 RTP/AVP 0.
a=rtpmap:0 PCMU/8000.


U 2007/05/17 18:09:23.138264 10.14.18.22:5060 -> 10.14.18.224:5061
SIP/2.0 100 trying -- your call is important to us.
Via: SIP/2.0/UDP 127.0.0.1:5061;branch=z9hG4bK-2008-1-0;rport=5061;received=10.14.18.224.
From: sipp <sip:sipp@127.0.0.1:5061>;tag=2008SIPpTag001.
To: sut <sip:8989@10.14.18.22:5060>.
Call-ID: 1-2008@127.0.0.1.
CSeq: 1 INVITE.
Server: OpenSer (1.1.1-notls (i386/linux)).
Content-Length: 0.
Warning: 392 10.14.18.22:5060 "Noisy feedback tells:  pid=28258 req_src_ip=10.14.18.224 req_src_port=5061 in_uri=sip:8989@10.14.18.22:5060 out_uri=sip:8989@aoeu.homeip.net:5060 via_cnt==1".
.


------------------------
------------------------

OpenSER tries to send this out to another GW that sends back a 404

------------------------
------------------------


U 2007/05/17 18:09:23.173589 10.14.18.22:5060 -> 10.14.18.224:5061
SIP/2.0 404 Not Found.
Via: SIP/2.0/UDP 127.0.0.1:5061;received=10.14.18.224;branch=z9hG4bK-2008-1-0.
From: sipp <sip:sipp@127.0.0.1:5061>;tag=2008SIPpTag001.
To: sut <sip:8989@10.14.18.22:5060>;tag=as48d10a28.
Call-ID: 1-2008@127.0.0.1.
CSeq: 1 INVITE.
User-Agent: Asterisk PBX.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER.
Contact: <sip:8989@70.112.123.132:5060>.
Content-Length: 0.
.


U 2007/05/17 18:09:23.173907 10.14.18.224:5061 -> 10.14.18.22:5060
ACK sip:8989@10.14.18.22:5060 SIP/2.0.
Via: SIP/2.0/UDP 127.0.0.1:5061;branch=z9hG4bK-2008-1-0.
From: sipp <sip:sipp@127.0.0.1:5061>;tag=1.
To: sut <sip:8989@10.14.18.22:5060>;tag=as48d10a28.
Call-ID: 1-2008@127.0.0.1.
CSeq: 0 ACK.
Contact: <sip:sipp@127.0.0.1:5061;transport=UDP>.
Max-Forwards: 70.
Subject: Performance Test.
Content-Length: 0.
.

U 2007/05/17 18:09:23.174773 10.14.18.22:5060 -> 10.14.18.22:5060
ACK sip:8989@10.14.18.22:5060 SIP/2.0.
Record-Route: <sip:10.14.18.22;lr=on;ftag=1>.
Via: SIP/2.0/UDP 10.14.18.22;branch=0.
Via: SIP/2.0/UDP 127.0.0.1:5061;received=10.14.18.224;branch=z9hG4bK-2008-1-0.
From: sipp <sip:sipp@127.0.0.1:5061>;tag=1.
To: sut <sip:8989@10.14.18.22:5060>;tag=as48d10a28.
Call-ID: 1-2008@127.0.0.1.
CSeq: 0 ACK.
Contact: <sip:sipp@127.0.0.1:5061;transport=UDP>.
Max-Forwards: 69.
Subject: Performance Test.
Content-Length: 0.
.


U 2007/05/17 18:09:23.174935 10.14.18.22:5060 -> 10.14.18.22:5060
ACK sip:8989@10.14.18.22:5060 SIP/2.0.
Record-Route: <sip:10.14.18.22;lr=on;ftag=1>.
Record-Route: <sip:10.14.18.22;lr=on;ftag=1>.
Via: SIP/2.0/UDP 10.14.18.22;branch=0.
Via: SIP/2.0/UDP 10.14.18.22;branch=0.
Via: SIP/2.0/UDP 127.0.0.1:5061;received=10.14.18.224;branch=z9hG4bK-2008-1-0.
From: sipp <sip:sipp@127.0.0.1:5061>;tag=1.
To: sut <sip:8989@10.14.18.22:5060>;tag=as48d10a28.
Call-ID: 1-2008@127.0.0.1.
CSeq: 0 ACK.
Contact: <sip:sipp@127.0.0.1:5061;transport=UDP>.
Max-Forwards: 68.
Subject: Performance Test.
Content-Length: 0.
.


U 2007/05/17 18:09:23.175014 10.14.18.22:5060 -> 10.14.18.22:5060
ACK sip:8989@10.14.18.22:5060 SIP/2.0.
Record-Route: <sip:10.14.18.22;lr=on;ftag=1>.
Record-Route: <sip:10.14.18.22;lr=on;ftag=1>.
Record-Route: <sip:10.14.18.22;lr=on;ftag=1>.
Via: SIP/2.0/UDP 10.14.18.22;branch=0.
Via: SIP/2.0/UDP 10.14.18.22;branch=0.
Via: SIP/2.0/UDP 10.14.18.22;branch=0.
Via: SIP/2.0/UDP 127.0.0.1:5061;received=10.14.18.224;branch=z9hG4bK-2008-1-0.
From: sipp <sip:sipp@127.0.0.1:5061>;tag=1.
To: sut <sip:8989@10.14.18.22:5060>;tag=as48d10a28.
Call-ID: 1-2008@127.0.0.1.
CSeq: 0 ACK.
Contact: <sip:sipp@127.0.0.1:5061;transport=UDP>.
Max-Forwards: 67.
Subject: Performance Test.
Content-Length: 0.
.


------------------------
------------------------
This continues to build and build
------------------------
------------------------

openser.cfg route sections follow
========================
========================

 

route {
	# -----------------------------------------------------------------
	# Sanity Check Section
	# -----------------------------------------------------------------
	if (!mf_process_maxfwd_header("10")) {
		sl_send_reply("483", "Too Many Hops");
		return;
	};

	if (msg:len > max_len) {
		sl_send_reply("513", "Message Overflow");
		return;
	};

	# -----------------------------------------------------------------
	# Record Route Section
	# -----------------------------------------------------------------

	if (method!="REGISTER") {	
		record_route();	
	};


	# -----------------------------------------------------------------
	# Call Tear Down Section
	# -----------------------------------------------------------------

	if (method=="BYE" || method=="CANCEL") {
		unforce_rtp_proxy();
	};

	# -----------------------------------------------------------------
	# Loose Route Section
	# -----------------------------------------------------------------

	if (loose_route()) {
		xlog("L_INFO", "Loose routing()...\n");
		if (has_totag() && (method=="INVITE" || method=="ACK")) {
			setflag(6);
			force_rport();
			fix_nated_contact();
			force_rtp_proxy("i");
		};
		route(1);
		return;
	};

	# -----------------------------------------------------------------
	# Call Type Processing Section
	# -----------------------------------------------------------------

	#xlog("L_INFO", "request method: [$rm], from URI: [$fu], To URI: [$tu]\n");

	if (method=="CANCEL") {
		route(1);
		return;
	} else if (method=="INVITE") {
		route(3);
		return;
	} else 	if (method=="REGISTER") {
		route(2);
		return;
	} else if (method=="ACK") {
		route(1);
		return;
	} else if (method == "NOTIFY") {
		sl_send_reply("200", "Understood");
		return;
	} else if ((method==OPTIONS) && (! uri=~"sip:.*[@]+.*")) {
		options_reply();
		return;
	};

	lookup("aliases");
	if (uri!=myself) {
		route(4);
		route(1);
		return;
	};

	if (!lookup("location")) {
		sl_send_reply("404", "User Not Found");
		return;
	};
	

	route(1);
}

route[1] {

	# -----------------------------------------------------------------
	# Default Message Handler
	# -----------------------------------------------------------------

	t_on_reply("1");

	setflag(1);
	if (!t_relay()) {
		if (method=="INVITE" || method=="ACK") {
			unforce_rtp_proxy();
		};

		sl_reply_error();
	};
}

route[2] {

	# -----------------------------------------------------------------
	# REGISTER Message Handler
	# -----------------------------------------------------------------

	sl_send_reply("100", "Trying");

	if (!search("^Contact:[ ]*\*")) { 
		setflag(6);
		fix_nated_register();
		force_rport();
	};

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

route[3] {

	# -----------------------------------------------------------------
	# INVITE Message Handler
	# -----------------------------------------------------------------

	setflag(6);

	lookup("aliases");
	if (uri!=myself) {
		route(4);
		route(1);
		return;
	};

	if (!lookup("location")) {
		if (uri=~"^sip:[0-9]+@") {	# PSTN
			route(5);
			return;

		};
		
		sl_send_reply("404", "User Not Found");
		return;
	};

	route(4);
	route(1);
}

route[4] {

	# -----------------------------------------------------------------
	# NAT Traversal Section
	# -----------------------------------------------------------------

	if (isflagset(6)) {
		force_rport();
                fix_nated_contact();
		force_rtp_proxy("i");
	};
}

route[5] {

	# -----------------------------------------------------------------
        # PSTN Handler
        # -----------------------------------------------------------------

	# Proxy  (Round-Robin, SIP-Proxies)
	ds_select_domain("1", "4");

	t_on_failure("1");

        route(4);
        route(1);
}


onreply_route[1] {
	if (isflagset(6) &&  (status=~"180|183|2[0-9][0-9]")) {
		if (search("application/sdp")) {
			force_rtp_proxy("i");
		};
	}

        fix_nated_contact();
}

failure_route[1] {
        # Choose another gateway

	xlog ("L_INFO","Failed to send to proxy - $ds\n"); 
	if ((t_check_status("408") || t_check_status("603"))&& t_local_replied("all")) {
		if (ds_next_domain()) {
			xlog ("L_INFO","Next selected proxy - $ds\n"); 
			# On Failure: Choose next Proxy
			t_on_failure("1");

			route(4);
			route(1);
		} else {
			t_reply("503", "Service not available");
			return;
		}
	} else if ( t_check_status("401|407") ) {
		if (isflagset(7)) {
			t_reply("503","Authentication failed");
			return;
		}


		if (uac_auth())
		{
			# mark that auth was performed
			setflag(7);
			## trigger again the failure route
			t_on_failure("1");

			# repeat the request with auth response this time
			append_branch();

			route(4);
			route(1);
		}
	}
}