[Asterisk-code-review] testsuite: SIP route header is missing on UPDATE (testsuite[18])

Friendly Automation asteriskteam at digium.com
Wed Apr 27 03:39:45 CDT 2022


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/testsuite/+/18461 )

Change subject: testsuite: SIP route header is missing on UPDATE
......................................................................

testsuite: SIP route header is missing on UPDATE

Add tests to ensure we receive Route header in UPDATE

ASTERISK-29955

Change-Id: I55caad3cb2a156b8e3f2f24dd10db5ebe67910d2
---
A tests/channels/SIP/sip_semi_attended_transfer_record_route/configs/ast1/extensions.conf
A tests/channels/SIP/sip_semi_attended_transfer_record_route/configs/ast1/sip.conf
A tests/channels/SIP/sip_semi_attended_transfer_record_route/sipp/referee.xml
A tests/channels/SIP/sip_semi_attended_transfer_record_route/sipp/referer_uas.xml
A tests/channels/SIP/sip_semi_attended_transfer_record_route/sipp/uac-no-hangup.xml
A tests/channels/SIP/sip_semi_attended_transfer_record_route/sipp/uas.xml
A tests/channels/SIP/sip_semi_attended_transfer_record_route/test-config.yaml
M tests/channels/SIP/tests.yaml
A tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/configs/ast1/extensions.conf
A tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/configs/ast1/pjsip.conf
A tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/sipp/referee.xml
A tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/sipp/referer_uas.xml
A tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/sipp/uac-no-hangup.xml
A tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/sipp/uas.xml
A tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/test-config.yaml
M tests/channels/pjsip/transfers/attended_transfer/nominal/tests.yaml
16 files changed, 1,560 insertions(+), 0 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/tests/channels/SIP/sip_semi_attended_transfer_record_route/configs/ast1/extensions.conf b/tests/channels/SIP/sip_semi_attended_transfer_record_route/configs/ast1/extensions.conf
new file mode 100644
index 0000000..b66e24e
--- /dev/null
+++ b/tests/channels/SIP/sip_semi_attended_transfer_record_route/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[default]
+exten => call_c,1,NoOp()
+	same => n,Dial(SIP/charlie)
+	same => n,Hangup()
+
+exten => alice,1,NoOp()
+       same => n,Dial(SIP/bob)
+       same => n,Hangup()
diff --git a/tests/channels/SIP/sip_semi_attended_transfer_record_route/configs/ast1/sip.conf b/tests/channels/SIP/sip_semi_attended_transfer_record_route/configs/ast1/sip.conf
new file mode 100644
index 0000000..ffd805e
--- /dev/null
+++ b/tests/channels/SIP/sip_semi_attended_transfer_record_route/configs/ast1/sip.conf
@@ -0,0 +1,36 @@
+[general]
+canreinvite=no
+sipdebug=yes
+udpbindaddr=0.0.0.0
+
+rpid_update=yes
+trustrpid=yes
+sendrpid=pai
+
+
+[alice]
+insecure=invite
+host=127.0.0.1
+port=5068
+context=default
+type=friend
+
+[bob]
+insecure=invite
+host=127.0.0.1
+port=5066
+context=default
+type=friend
+
+[charlie]
+insecure=invite
+host=127.0.0.1
+port=5067
+context=default
+type=friend
+
+[david]
+insecure=invite
+host=dynamic
+context=default
+type=friend
diff --git a/tests/channels/SIP/sip_semi_attended_transfer_record_route/sipp/referee.xml b/tests/channels/SIP/sip_semi_attended_transfer_record_route/sipp/referee.xml
new file mode 100644
index 0000000..cdb3284
--- /dev/null
+++ b/tests/channels/SIP/sip_semi_attended_transfer_record_route/sipp/referee.xml
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<!-- This program is free software; you can redistribute it and/or	-->
+<!-- modify it under the terms of the GNU General Public License as	-->
+<!-- published by the Free Software Foundation; either version 2 of the -->
+<!-- License, or (at your option) any later version.			-->
+<!--									-->
+<!-- This program is distributed in the hope that it will be useful,	-->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of	-->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the	-->
+<!-- GNU General Public License for more details.			-->
+<!--									-->
+<!-- You should have received a copy of the GNU General Public License	-->
+<!-- along with this program; if not, write to the			-->
+<!-- Free Software Foundation, Inc.,					-->
+<!-- 59 Temple Place, Suite 330, Boston, MA	02111-1307 USA		-->
+<!--									-->
+
+<scenario name="Referee Leg">
+
+	<recvCmd>
+		<action>
+			<ereg
+				regexp="REMOTE(.*)"
+				search_in="hdr"
+				header="Call-ID:"
+				check_it="true"
+				assign_to="1,original_callid" />
+		</action>
+	</recvCmd>
+
+	<send retrans="500">
+		<![CDATA[
+
+			INVITE sip:call_c@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			Record-Route: <sip:[local_ip]:[local_port];transport=[transport];lr>
+			From: <sip:bob@[local_ip]:[local_port]>;tag=[call_number]
+			To: <sip:transfer@[remote_ip]:[remote_port]>
+			Call-ID: [call_id]
+			CSeq: [cseq] INVITE
+			Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, OPTIONS, UPDATE, PRACK, SUBSCRIBE, INFO
+			Contact: <sip:bob@[local_ip]:[local_port]>
+			Max-Forwards: 70
+			X-SIPP: referee.xml
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=- 1324901698 1324901698 IN IP[local_ip_type] [local_ip]
+			s=-
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			m=audio [media_port] RTP/AVP 0 101
+			a=sendrecv
+			a=rtpmap:0 PCMU/8000
+			a=rtpmap:101 telephone-event/8000
+
+		]]>
+	</send>
+
+	<recv
+		response="100"
+		optional="true" />
+	<recv
+		response="101"
+		optional="true" />
+	<recv response="180">
+		<action>
+			<ereg
+				regexp="tag=([[:alnum:].\-]*)"
+				search_in="hdr"
+				header="To:"
+				check_it="true"
+				assign_to="2,to_tag" />
+			<ereg
+				regexp="tag=([[:alnum:].\-]*)"
+				search_in="hdr"
+				header="From:"
+				check_it="true"
+				assign_to="3,from_tag" />
+		</action>
+	</recv>
+	<Reference variables="1,2,3" />
+
+	<sendCmd>
+		<![CDATA[
+			Call-ID: [$original_callid]
+			Remote-To-Tag: [$to_tag]
+			Remote-From-Tag: [$from_tag]
+			Remote-URI: sip:call_c@[remote_ip]:[remote_port]
+		]]>
+	</sendCmd>
+
+	<recv response="603" />
+
+	<send>
+		<![CDATA[
+
+			ACK sip:call_c@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch]
+			[last_From:]
+			[last_To]
+			Call-ID: [call_id]
+			CSeq: [cseq] ACK
+			Contact: sip:bob@[local_ip]:[local_port]
+			Max-Forwards: 70
+			Content-Length: 0
+
+		]]>
+	</send>
+
+	<!-- definition of the response time repartition table (unit is ms)	-->
+	<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+	<!-- definition of the call length repartition table (unit is ms)	-->
+	<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
diff --git a/tests/channels/SIP/sip_semi_attended_transfer_record_route/sipp/referer_uas.xml b/tests/channels/SIP/sip_semi_attended_transfer_record_route/sipp/referer_uas.xml
new file mode 100644
index 0000000..888d4d0
--- /dev/null
+++ b/tests/channels/SIP/sip_semi_attended_transfer_record_route/sipp/referer_uas.xml
@@ -0,0 +1,221 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<!-- This program is free software; you can redistribute it and/or	-->
+<!-- modify it under the terms of the GNU General Public License as	-->
+<!-- published by the Free Software Foundation; either version 2 of the -->
+<!-- License, or (at your option) any later version.			-->
+<!--									-->
+<!-- This program is distributed in the hope that it will be useful,	-->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of	-->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the	-->
+<!-- GNU General Public License for more details.			-->
+<!--									-->
+<!-- You should have received a copy of the GNU General Public License	-->
+<!-- along with this program; if not, write to the			-->
+<!-- Free Software Foundation, Inc.,					-->
+<!-- 59 Temple Place, Suite 330, Boston, MA	02111-1307 USA		-->
+<!--									-->
+
+<scenario name="Referer Leg">
+	<recv request="INVITE" />
+
+	<send retrans="500">
+		<![CDATA[
+
+			SIP/2.0 200 OK
+			[last_Via:]
+			Record-Route: <sip:[local_ip]:[local_port];transport=[transport];lr>
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, OPTIONS, UPDATE, PRACK, SUBSCRIBE, INFO
+			Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+			X-SIPP: referer_uas.xml
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+			s=-
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			m=audio [media_port] RTP/AVP 0
+			a=rtpmap:0 PCMU/8000
+
+		]]>
+	</send>
+
+	<recv
+		request="ACK"
+		rtd="true">
+		<action>
+			<ereg
+				regexp=" (.+)"
+				search_in="hdr"
+				header="From:"
+				check_it="true"
+				assign_to="1,outbound_to_header" />
+			<ereg
+				regexp=" (.+)"
+				search_in="hdr"
+				header="To:"
+				check_it="true"
+				assign_to="1,outbound_from_header" />
+		</action>
+	</recv>
+
+	<!-- Put this leg on hold -->
+	<send retrans="500">
+		<![CDATA[
+
+			INVITE sip:[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/UDP [local_ip]:[local_port];rport;received=127.0.0.1;branch=[branch]
+			From: [$outbound_from_header]
+			To: [$outbound_to_header]
+			Call-ID: [call_id]
+			CSeq: [cseq] INVITE
+			Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, OPTIONS, UPDATE, PRACK, SUBSCRIBE, INFO
+			Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+			Content-Type: application/sdp
+			Max-Forwards: 70
+			Content-Length: [len]
+
+			v=0
+			o=- 1324901698 1324901698 IN IP[local_ip_type] [local_ip]
+			s=-
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			m=audio [media_port] RTP/AVP 0 101
+			a=sendonly
+			a=rtpmap:0 PCMU/8000
+			a=rtpmap:101 telephone-event/8000
+
+		]]>
+	</send>
+
+	<recv
+		response="100"
+		optional="true" />
+	<recv
+		response="101"
+		optional="true" />
+	<recv
+		response="180"
+		optional="true" />
+	<recv
+		response="200"
+		rtd="true" />
+
+	<send>
+		<![CDATA[
+
+			ACK sip:[local_ip]:[local_port] SIP/2.0
+			[last_Via]
+			[last_From]
+			[last_To]
+			Call-ID: [call_id]
+			CSeq: [cseq] ACK
+			Contact: sip:bob@[local_ip]:[local_port]
+			Max-Forwards: 70
+			Content-Length: 0
+
+		]]>
+	</send>
+
+	<sendCmd>
+		<![CDATA[
+			Call-ID: REMOTE[call_id]
+			Start the Echo Leg
+		]]>
+	</sendCmd>
+
+	<recvCmd>
+		<action>
+			<ereg
+				regexp=" (.+)"
+				search_in="hdr"
+				header="Remote-URI:"
+				check_it="true"
+				assign_to="1,remote_contact" />
+			<ereg
+				regexp=" (.+)"
+				search_in="hdr"
+				header="Remote-To-Tag:"
+				check_it="true"
+				assign_to="2,remote_to_tag" />
+			<ereg
+				regexp=" (.+)"
+				search_in="hdr"
+				header="Remote-From-Tag:"
+				check_it="true"
+				assign_to="3,remote_from_tag" />
+		</action>
+	</recvCmd>
+	<Reference variables="1,2,3" />
+
+	<send>
+		<![CDATA[
+
+			REFER sip:call_c@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			[last_From:]
+			[last_To]
+			[last_Call-ID:]
+			CSeq: [cseq] REFER
+			Contact: <sip:bob@[local_ip]:[local_port]>
+			Max-Forwards: 70
+			Refer-to: <[$remote_contact]?Replaces=REMOTE[call_id]%3Bto-tag%3D[$remote_to_tag]%3Bfrom-tag%3D[$remote_from_tag]>
+			Referred-By: sip:bob@[local_ip]
+			Content-Length: 0
+
+		]]>
+	</send>
+	<recv
+		response="202"
+		rtd="true" />
+
+	<recv request="NOTIFY" />
+	<send>
+		<![CDATA[
+
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:bob@[local_ip]:[local_port]>
+			Content-Length:0
+
+		]]>
+	</send>
+
+
+	<pause milliseconds="5000" />
+
+	<send retrans="500">
+		<![CDATA[
+
+			BYE sip:[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/UDP [local_ip]:[local_port];rport;received=127.0.0.1;branch=[branch]
+			From: [$outbound_from_header]
+			To: [$outbound_to_header]
+			Call-ID: [call_id]
+			CSeq: [cseq] BYE
+			Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+			Content-Type: application/sdp
+			Max-Forwards: 70
+			Content-Length: 0
+
+		]]>
+	</send>
+
+	<!-- definition of the response time repartition table (unit is ms)	-->
+	<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+	<!-- definition of the call length repartition table (unit is ms)	-->
+	<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
diff --git a/tests/channels/SIP/sip_semi_attended_transfer_record_route/sipp/uac-no-hangup.xml b/tests/channels/SIP/sip_semi_attended_transfer_record_route/sipp/uac-no-hangup.xml
new file mode 100644
index 0000000..d678884
--- /dev/null
+++ b/tests/channels/SIP/sip_semi_attended_transfer_record_route/sipp/uac-no-hangup.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic Sipstone UAC">
+ 
+	<nop hide="true">
+		<action>
+			<assignstr
+				assign_to="rr_out"
+				value="<sip:[local_ip]:[local_port];transport=[transport];lr>" />
+		</action>
+	</nop>
+
+	<send retrans="500">
+		<![CDATA[
+
+			INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			Record-Route: [$rr_out]
+			From: sipp <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+			To: sut <sip:[service]@[remote_ip]:[remote_port]>
+			Call-ID: [call_id]
+			CSeq: 1 INVITE
+			Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, OPTIONS, UPDATE, PRACK, SUBSCRIBE, INFO
+			Contact: sip:alice@[local_ip]:[local_port]
+			Max-Forwards: 70
+			Subject: Performance Test
+			X-SIPP: uac-no-hangup.xml
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+			s=-
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			m=audio [media_port] RTP/AVP 0
+			a=rtpmap:0 PCMU/8000
+
+		]]>
+	</send>
+
+	<recv
+		response="100"
+		optional="true">
+	</recv>
+
+	<recv
+		response="181"
+		optional="true">
+	</recv>
+
+	<recv
+		response="180"
+		optional="true">
+	</recv>
+
+	<recv
+		response="183"
+		optional="true">
+	</recv>
+
+	<recv
+		response="200"
+		rtd="true">
+	</recv>
+
+	<send>
+		<![CDATA[
+
+			ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: sipp <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+			To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+			Call-ID: [call_id]
+			CSeq: 1 ACK
+			Contact: sip:alice@[local_ip]:[local_port]
+			Max-Forwards: 70
+			Subject: Performance Test
+			Content-Length: 0
+
+		]]>
+	</send>
+
+	<recv request="BYE">
+	</recv>
+
+	<send>
+		<![CDATA[
+
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+			Content-Length: 0
+
+		]]>
+	</send>
+
+	<timewait milliseconds="4000"/>
+
+	<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+	<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+
diff --git a/tests/channels/SIP/sip_semi_attended_transfer_record_route/sipp/uas.xml b/tests/channels/SIP/sip_semi_attended_transfer_record_route/sipp/uas.xml
new file mode 100644
index 0000000..4899731
--- /dev/null
+++ b/tests/channels/SIP/sip_semi_attended_transfer_record_route/sipp/uas.xml
@@ -0,0 +1,218 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<!-- This program is free software; you can redistribute it and/or	-->
+<!-- modify it under the terms of the GNU General Public License as	-->
+<!-- published by the Free Software Foundation; either version 2 of the -->
+<!-- License, or (at your option) any later version.			-->
+<!--									-->
+<!-- This program is distributed in the hope that it will be useful,	-->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of	-->
+<!-- MERCHANTARouteTNESS FOR A PARTICULAR PURPOSE. See the		-->
+<!-- GNU General Public License for more details.			-->
+<!--									-->
+<!-- You should have received a copy of the GNU General Public License	-->
+<!-- along with this program; if not, write to the			-->
+<!-- Free Software Foundation, Inc.,					-->
+<!-- 59 Temple Place, Suite 330, Boston, MA	02111-1307 USA		-->
+<!--									-->
+<!--	Sipp default 'uas' scenario.					-->
+<!--									-->
+
+<scenario name="Basic UAS responder">
+
+	<nop hide="true">
+		<action>
+			<assignstr
+				assign_to="rr_out"
+				value="<sip:[local_ip]:[local_port];transport=[transport];lr>" />
+		</action>
+	</nop>
+
+
+<!-- By adding rrs="true" (Record Route Sets), the route sets		-->
+<!-- are saved and used for following messages sent. Useful to test	-->
+<!-- against stateful SIP proxies/B2BUAs.				-->
+	<recv request="INVITE">
+
+		<action>
+			<ereg 
+				regexp=".*"
+				header="Via:"
+				search_in="hdr"
+				check_it="true"
+				assign_to="original_via"/>
+		</action>
+
+	</recv>
+
+	<!-- The '[last_*]' keyword is replaced automatically by the		-->
+	<!-- specified header if it was present in the last message received	-->
+	<!-- (except if it was a retransmission). If the header was not		-->
+	<!-- present or if no message has been received, the '[last_*]'		-->
+	<!-- keyword is discarded, and all bytes until the end of the line	-->
+	<!-- are also discarded.						-->
+	<!--									-->
+	<!-- If the specified header was present several times in the		-->
+	<!-- message, all occurences are concatenated (CRLF seperated)		-->
+	<!-- to be used in place of the '[last_*]' keyword.			-->
+
+	<send>
+		<![CDATA[
+
+			SIP/2.0 100 Trying
+			[last_Via:]
+			Record-Route: [$rr_out]
+			[last_From:]
+			[last_To:]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+			X-SIPP: uas.xml
+			Content-Length: 0
+
+		]]>
+	</send>
+
+	<send>
+		<![CDATA[
+
+			SIP/2.0 180 Ringing
+			[last_Via:]
+			Record-Route: [$rr_out]
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, OPTIONS, UPDATE, PRACK, SUBSCRIBE, INFO
+			Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+			X-SIPP: uas.xml
+			Content-Length: 0
+
+		]]>
+	</send>
+
+	<recv request="UPDATE" rtd="true">
+		<action>
+			<ereg
+				regexp="\s*(.*)\s*"
+				search_in="hdr"
+				header="Route:"
+				assign_to="1,r_got"/>
+			<strcmp
+				assign_to="1"
+				variable="r_got"
+				variable2="rr_out" />
+			<test
+				assign_to="r_wrong"
+				variable="1"
+				compare="not_equal"
+				value="" />
+		</action>
+	</recv>
+
+	<nop condexec="r_wrong">
+		<action>
+			<error message="UPDATE Route expected '[$rr_out]' but got '[$r_got]'" />
+		</action>
+	</nop>
+
+	<send>
+		<![CDATA[
+
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, OPTIONS, UPDATE, PRACK, SUBSCRIBE, INFO
+			Contact: <sip:bob@[local_ip]:[local_port]>
+			X-SIPP: uas.xml ACK UPDATE
+			Content-Length:0
+
+		]]>
+	</send>
+
+	<pause milliseconds="200" />
+
+	<send retrans="500">
+		<![CDATA[
+
+			SIP/2.0 200 OK
+			Via: [$original_via]
+			Record-Route: <sip:[local_ip]:[local_port];transport=[transport];lr>
+			[last_From:]
+			[last_To:]
+			[last_Call-ID:]
+			CSeq: [cseq-1] INVITE
+			Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, OPTIONS, UPDATE, PRACK, SUBSCRIBE, INFO
+			Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+			X-SIPP: uas.xml ANSWER CALL
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+			s=-
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			m=audio [media_port] RTP/AVP 0
+			a=rtpmap:0 PCMU/8000
+
+		]]>
+	</send>
+
+	<recv request="ACK">
+		<action>
+			<!-- Save the From tag. We'll need it when we send our BYE -->
+			<ereg
+				regexp="(;tag=.*)"
+				header="From:"
+				search_in="hdr"
+				check_it="true"
+				assign_to="remote_tag"/>
+			<!-- Save the From user portion of URI. We'll need it when we send our BYE -->
+			<ereg
+				regexp="(sip:bob)"
+				header="From:"
+				search_in="hdr"
+				check_it="true"
+				assign_to="remote_user"/>
+			</action>
+	</recv>
+
+
+	<send retrans="500">
+		<![CDATA[
+
+			BYE [$remote_user]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: <sip:charlie@[local_ip]:[local_port]>;tag=[call_number]
+			To: <[$remote_user]@[remote_ip]:[remote_port]>[$remote_tag]
+			Call-ID: [call_id]
+			CSeq: [cseq] BYE
+			Contact: sip:charlie@[local_ip]:[local_port]
+			Max-Forwards: 70
+			Subject: Performance Test
+			Content-Length: 0
+
+		]]>
+	</send>
+
+	<recv
+		request="ACK"
+		optional="true"
+		rtd="true">
+	</recv>
+
+	<recv response="200">
+	</recv>
+
+	<!-- definition of the response time repartition table (unit is ms)	-->
+	<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+	<!-- definition of the call length repartition table (unit is ms)	-->
+	<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
diff --git a/tests/channels/SIP/sip_semi_attended_transfer_record_route/test-config.yaml b/tests/channels/SIP/sip_semi_attended_transfer_record_route/test-config.yaml
new file mode 100644
index 0000000..28aef39
--- /dev/null
+++ b/tests/channels/SIP/sip_semi_attended_transfer_record_route/test-config.yaml
@@ -0,0 +1,58 @@
+testinfo:
+    summary: Test performing a callee-initiated semi attended transfer with record-route header via chan_pjsip.
+    description: |
+        "Start four SIPp scenarios that do the following:
+        SIPp #1 (uac-no-hangup.xml) calls through Asterisk to SIPp #2 (referer_uas.xml)
+        SIPp #2 kicks off SIPp #3 (referee.xml) which calls SIPp #4 (uas.xml).
+        SIPp #3 passes call information back to SIPp #2.
+        Before SIPp #4 answers SIPp #2 initiates an attended transfer via REFER with Replaces information from SIPp #3.
+        SIPp #3 is hung up.
+        SIPp #2 hangs up.
+        SIPp #4 continues to ring until it answers.
+        SIPp #1 receives a connected line update and the values are checked.
+        SIPp #4 answers.
+        SIPp #1 and SIPp #4 are bridged.
+        SIPp #4 receives a connected line update and the values are checked.
+        SIPp #4 hangs up.
+        SIPp #1 is hung up."
+
+test-modules:
+    add-test-to-search-path: True
+    test-object:
+        config-section: test-object-config
+        typename: sipp.SIPpTestCase
+    modules:
+        -
+            config-section: ami-config
+            typename: 'ami.AMIEventModule'
+
+test-object-config:
+    memcheck-delay-stop: 7
+    fail-on-any: True
+    test-iterations:
+        -
+            scenarios:
+                - { 'coordinated-sender': {'key-args': {'scenario':'referer_uas.xml', '-p':'5066', '-sleep': '2'} },
+                    'coordinated-receiver': { 'key-args': {'scenario':'referee.xml', '-p':'5065'} } }
+                - { 'key-args': {'scenario':'uas.xml', '-p':'5067', '-sleep': '2'} }
+                - { 'key-args': {'scenario':'uac-no-hangup.xml', '-p':'5068', '-s':'alice', '-sleep': '2'} }
+
+ami-config:
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'AttendedTransfer'
+                Result: 'Success'
+        count: 1
+
+properties:
+    dependencies:
+        - python : twisted
+        - python : starpy
+        - asterisk : app_dial
+        - asterisk : chan_sip
+    tags:
+        - SIP
+        - transfer
+
diff --git a/tests/channels/SIP/tests.yaml b/tests/channels/SIP/tests.yaml
index f71357f..b25f4f9 100644
--- a/tests/channels/SIP/tests.yaml
+++ b/tests/channels/SIP/tests.yaml
@@ -67,6 +67,7 @@
     - test: 'sip_outbound_proxy'
     - test: 'sip_register'
     - test: 'sip_register_domain_acl'
+    - test: 'sip_semi_attended_transfer_record_route'
     - test: 'sip_tls_call'
     - test: 'sip_tls_register'
     - test: 'sip_unregister'
diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/configs/ast1/extensions.conf b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/configs/ast1/extensions.conf
new file mode 100644
index 0000000..5dc3863
--- /dev/null
+++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[default]
+exten => call_c,1,NoOp()
+	same => n,Dial(PJSIP/charlie)
+	same => n,Hangup()
+
+exten => alice,1,NoOp()
+       same => n,Dial(PJSIP/bob)
+       same => n,Hangup()
diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/configs/ast1/pjsip.conf b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..e5eccf8
--- /dev/null
+++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/configs/ast1/pjsip.conf
@@ -0,0 +1,40 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[local]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[endpoint](!)
+type=endpoint
+context=default
+disallow=all
+allow=ulaw
+direct_media=no
+send_pai=yes
+send_rpid=yes
+
+[alice](endpoint)
+callerid=Alice <alice>
+
+[bob](endpoint)
+aors=bob
+callerid=Bob <bob>
+
+[bob]
+type=aor
+contact=sip:bob at 127.0.0.1:5066
+
+[charlie](endpoint)
+aors=charlie
+callerid=Charlie <charlie>
+
+[charlie]
+type=aor
+contact=sip:charlie at 127.0.0.1:5067
+
+[david](endpoint)
+callerid=David <david>
diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/sipp/referee.xml b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/sipp/referee.xml
new file mode 100644
index 0000000..773f6bd
--- /dev/null
+++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/sipp/referee.xml
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<!-- This program is free software; you can redistribute it and/or	-->
+<!-- modify it under the terms of the GNU General Public License as	-->
+<!-- published by the Free Software Foundation; either version 2 of the -->
+<!-- License, or (at your option) any later version.			-->
+<!--									-->
+<!-- This program is distributed in the hope that it will be useful,	-->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of	-->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the	-->
+<!-- GNU General Public License for more details.			-->
+<!--									-->
+<!-- You should have received a copy of the GNU General Public License	-->
+<!-- along with this program; if not, write to the			-->
+<!-- Free Software Foundation, Inc.,					-->
+<!-- 59 Temple Place, Suite 330, Boston, MA	02111-1307 USA		-->
+<!--									-->
+
+<scenario name="Referee Leg">
+
+	<recvCmd>
+		<action>
+			<ereg
+				regexp="REMOTE(.*)"
+				search_in="hdr"
+				header="Call-ID:"
+				check_it="true"
+				assign_to="1,original_callid" />
+		</action>
+	</recvCmd>
+
+	<send retrans="500">
+		<![CDATA[
+
+			INVITE sip:call_c@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			Record-Route: <sip:[local_ip]:[local_port];transport=[transport];lr>
+			From: <sip:bob@[local_ip]:[local_port]>;tag=[call_number]
+			To: <sip:transfer@[remote_ip]:[remote_port]>
+			Call-ID: [call_id]
+			CSeq: [cseq] INVITE
+			Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, OPTIONS, UPDATE, PRACK, SUBSCRIBE, INFO
+			Contact: <sip:bob@[local_ip]:[local_port]>
+			Max-Forwards: 70
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=- 1324901698 1324901698 IN IP[local_ip_type] [local_ip]
+			s=-
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			m=audio [media_port] RTP/AVP 0 101
+			a=sendrecv
+			a=rtpmap:0 PCMU/8000
+			a=rtpmap:101 telephone-event/8000
+
+		]]>
+	</send>
+
+	<recv
+		response="100"
+		optional="true" />
+	<recv
+		response="101"
+		optional="true" />
+	<recv response="180">
+		<action>
+			<ereg
+				regexp="tag=([[:alnum:].\-]*)"
+				search_in="hdr"
+				header="To:"
+				check_it="true"
+				assign_to="2,to_tag" />
+			<ereg
+				regexp="tag=([[:alnum:].\-]*)"
+				search_in="hdr"
+				header="From:"
+				check_it="true"
+				assign_to="3,from_tag" />
+		</action>
+	</recv>
+	<Reference variables="1,2,3" />
+
+	<pause milliseconds="1000" />
+	<sendCmd>
+		<![CDATA[
+			Call-ID: [$original_callid]
+			Remote-To-Tag: [$to_tag]
+			Remote-From-Tag: [$from_tag]
+			Remote-URI: sip:call_c@[remote_ip]:[remote_port]
+		]]>
+	</sendCmd>
+
+	<recv response="603" />
+
+	<send>
+		<![CDATA[
+
+			ACK sip:call_c@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch]
+			[last_From:]
+			[last_To]
+			Call-ID: [call_id]
+			CSeq: [cseq] ACK
+			Contact: sip:bob@[local_ip]:[local_port]
+			Max-Forwards: 70
+			Content-Length: 0
+
+		]]>
+	</send>
+
+	<!-- definition of the response time repartition table (unit is ms)	-->
+	<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+	<!-- definition of the call length repartition table (unit is ms)	-->
+	<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/sipp/referer_uas.xml b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/sipp/referer_uas.xml
new file mode 100644
index 0000000..b6f3419
--- /dev/null
+++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/sipp/referer_uas.xml
@@ -0,0 +1,234 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<!-- This program is free software; you can redistribute it and/or	-->
+<!-- modify it under the terms of the GNU General Public License as	-->
+<!-- published by the Free Software Foundation; either version 2 of the -->
+<!-- License, or (at your option) any later version.			-->
+<!--									-->
+<!-- This program is distributed in the hope that it will be useful,	-->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of	-->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the	-->
+<!-- GNU General Public License for more details.			-->
+<!--									-->
+<!-- You should have received a copy of the GNU General Public License	-->
+<!-- along with this program; if not, write to the			-->
+<!-- Free Software Foundation, Inc.,					-->
+<!-- 59 Temple Place, Suite 330, Boston, MA	02111-1307 USA		-->
+<!--									-->
+
+<scenario name="Referer Leg">
+	<recv request="INVITE" />
+
+	<send retrans="500">
+		<![CDATA[
+
+			SIP/2.0 200 OK
+			[last_Via:]
+			Record-Route: <sip:[local_ip]:[local_port];transport=[transport];lr>
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, OPTIONS, UPDATE, PRACK, SUBSCRIBE, INFO
+			Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+			s=-
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			m=audio [media_port] RTP/AVP 0
+			a=rtpmap:0 PCMU/8000
+
+		]]>
+	</send>
+
+	<recv
+		request="ACK"
+		rtd="true">
+		<action>
+			<ereg
+				regexp=" (.+)"
+				search_in="hdr"
+				header="From:"
+				check_it="true"
+				assign_to="1,outbound_to_header" />
+			<ereg
+				regexp=" (.+)"
+				search_in="hdr"
+				header="To:"
+				check_it="true"
+				assign_to="1,outbound_from_header" />
+		</action>
+	</recv>
+
+	<!-- Put this leg on hold -->
+	<send retrans="500">
+		<![CDATA[
+
+			INVITE sip:[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/UDP [local_ip]:[local_port];rport;received=127.0.0.1;branch=[branch]
+			From: [$outbound_from_header]
+			To: [$outbound_to_header]
+			Call-ID: [call_id]
+			CSeq: [cseq] INVITE
+			Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, OPTIONS, UPDATE, PRACK, SUBSCRIBE, INFO
+			Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+			Content-Type: application/sdp
+			Max-Forwards: 70
+			Content-Length: [len]
+
+			v=0
+			o=- 1324901698 1324901698 IN IP[local_ip_type] [local_ip]
+			s=-
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			m=audio [media_port] RTP/AVP 0 101
+			a=sendonly
+			a=rtpmap:0 PCMU/8000
+			a=rtpmap:101 telephone-event/8000
+
+		]]>
+	</send>
+
+	<recv
+		response="100"
+		optional="true" />
+	<recv
+		response="101"
+		optional="true" />
+	<recv
+		response="180"
+		optional="true" />
+	<recv
+		response="200"
+		rtd="true" />
+
+	<send>
+		<![CDATA[
+
+			ACK sip:[local_ip]:[local_port] SIP/2.0
+			[last_Via]
+			[last_From]
+			[last_To]
+			Call-ID: [call_id]
+			CSeq: [cseq] ACK
+			Contact: sip:bob@[local_ip]:[local_port]
+			Max-Forwards: 70
+			Content-Length: 0
+
+		]]>
+	</send>
+
+	<sendCmd>
+		<![CDATA[
+			Call-ID: REMOTE[call_id]
+			Start the Echo Leg
+		]]>
+	</sendCmd>
+
+	<recvCmd>
+		<action>
+			<ereg
+				regexp=" (.+)"
+				search_in="hdr"
+				header="Remote-URI:"
+				check_it="true"
+				assign_to="1,remote_contact" />
+			<ereg
+				regexp=" (.+)"
+				search_in="hdr"
+				header="Remote-To-Tag:"
+				check_it="true"
+				assign_to="2,remote_to_tag" />
+			<ereg
+				regexp=" (.+)"
+				search_in="hdr"
+				header="Remote-From-Tag:"
+				check_it="true"
+				assign_to="3,remote_from_tag" />
+		</action>
+	</recvCmd>
+	<Reference variables="1,2,3" />
+
+	<send>
+		<![CDATA[
+
+			REFER sip:call_c@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			[last_From:]
+			[last_To]
+			[last_Call-ID:]
+			CSeq: [cseq] REFER
+			Contact: <sip:bob@[local_ip]:[local_port]>
+			Max-Forwards: 70
+			Refer-to: <[$remote_contact]?Replaces=REMOTE[call_id]%3Bto-tag%3D[$remote_to_tag]%3Bfrom-tag%3D[$remote_from_tag]>
+			Referred-By: sip:bob@[local_ip]
+			Content-Length: 0
+
+		]]>
+	</send>
+	<recv
+		response="202"
+		rtd="true" />
+
+	<recv request="NOTIFY" />
+	<send>
+		<![CDATA[
+
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:bob@[local_ip]:[local_port]>
+			Content-Length:0
+
+		]]>
+	</send>
+
+	<recv request="NOTIFY" />
+
+	<send>
+		<![CDATA[
+
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:bob@[local_ip]:[local_port]>
+			Content-Length:0
+
+		]]>
+	</send>
+
+	<send retrans="500">
+		<![CDATA[
+
+			BYE sip:[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/UDP [local_ip]:[local_port];rport;received=127.0.0.1;branch=[branch]
+			From: [$outbound_from_header]
+			To: [$outbound_to_header]
+			Call-ID: [call_id]
+			CSeq: [cseq] BYE
+			Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+			Content-Type: application/sdp
+			Max-Forwards: 70
+			Content-Length: 0
+
+		]]>
+	</send>
+
+	<!-- definition of the response time repartition table (unit is ms)	-->
+	<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+	<!-- definition of the call length repartition table (unit is ms)	-->
+	<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/sipp/uac-no-hangup.xml b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/sipp/uac-no-hangup.xml
new file mode 100644
index 0000000..dc8b57e
--- /dev/null
+++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/sipp/uac-no-hangup.xml
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic Sipstone UAC">
+ 
+	<nop hide="true">
+		<action>
+			<assignstr
+				assign_to="rr_out"
+				value="<sip:[local_ip]:[local_port];transport=[transport];lr>" />
+		</action>
+	</nop>
+
+	<send retrans="500">
+		<![CDATA[
+
+			INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			Record-Route: [$rr_out]
+			From: sipp <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+			To: sut <sip:[service]@[remote_ip]:[remote_port]>
+			Call-ID: [call_id]
+			CSeq: 1 INVITE
+			Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, OPTIONS, UPDATE, PRACK, SUBSCRIBE, INFO
+			Contact: sip:alice@[local_ip]:[local_port]
+			Max-Forwards: 70
+			Subject: Performance Test
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+			s=-
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			m=audio [media_port] RTP/AVP 0
+			a=rtpmap:0 PCMU/8000
+
+		]]>
+	</send>
+
+	<recv
+		response="100"
+		optional="true">
+	</recv>
+
+	<recv
+		response="181"
+		optional="true">
+	</recv>
+
+	<recv
+		response="180"
+		optional="true">
+	</recv>
+
+	<recv
+		response="183"
+		optional="true">
+	</recv>
+
+	<recv
+		response="200"
+		rtd="true">
+	</recv>
+
+	<send>
+		<![CDATA[
+
+			ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: sipp <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+			To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+			Call-ID: [call_id]
+			CSeq: 1 ACK
+			Contact: sip:alice@[local_ip]:[local_port]
+			Max-Forwards: 70
+			Subject: Performance Test
+			Content-Length: 0
+
+		]]>
+	</send>
+
+	<recv request="UPDATE">
+	</recv>
+
+	<send>
+		<![CDATA[
+
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+		]]>
+	</send>
+
+	<recv request="BYE">
+	</recv>
+
+	<send>
+		<![CDATA[
+
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+			Content-Length: 0
+
+		]]>
+	</send>
+
+	<timewait milliseconds="4000"/>
+
+	<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+	<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+
diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/sipp/uas.xml b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/sipp/uas.xml
new file mode 100644
index 0000000..54fc4b9
--- /dev/null
+++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/sipp/uas.xml
@@ -0,0 +1,201 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<!-- This program is free software; you can redistribute it and/or	-->
+<!-- modify it under the terms of the GNU General Public License as	-->
+<!-- published by the Free Software Foundation; either version 2 of the -->
+<!-- License, or (at your option) any later version.			-->
+<!--									-->
+<!-- This program is distributed in the hope that it will be useful,	-->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of	-->
+<!-- MERCHANTARouteTNESS FOR A PARTICULAR PURPOSE. See the		-->
+<!-- GNU General Public License for more details.			-->
+<!--									-->
+<!-- You should have received a copy of the GNU General Public License	-->
+<!-- along with this program; if not, write to the			-->
+<!-- Free Software Foundation, Inc.,					-->
+<!-- 59 Temple Place, Suite 330, Boston, MA	02111-1307 USA		-->
+<!--									-->
+<!--	Sipp default 'uas' scenario.					-->
+<!--									-->
+
+<scenario name="Basic UAS responder">
+
+	<nop hide="true">
+		<action>
+			<assignstr
+				assign_to="rr_out"
+				value="<sip:[local_ip]:[local_port];transport=[transport];lr>" />
+		</action>
+	</nop>
+
+
+<!-- By adding rrs="true" (Record Route Sets), the route sets		-->
+<!-- are saved and used for following messages sent. Useful to test	-->
+<!-- against stateful SIP proxies/B2BUAs.				-->
+	<recv request="INVITE">
+
+		<action>
+			<ereg
+				regexp=".*"
+				header="Via:"
+				search_in="hdr"
+				check_it="true"
+				assign_to="original_via"/>
+		</action>
+
+	</recv>
+
+	<!-- The '[last_*]' keyword is replaced automatically by the		-->
+	<!-- specified header if it was present in the last message received	-->
+	<!-- (except if it was a retransmission). If the header was not		-->
+	<!-- present or if no message has been received, the '[last_*]'		-->
+	<!-- keyword is discarded, and all bytes until the end of the line	-->
+	<!-- are also discarded.						-->
+	<!--									-->
+	<!-- If the specified header was present several times in the		-->
+	<!-- message, all occurences are concatenated (CRLF seperated)		-->
+	<!-- to be used in place of the '[last_*]' keyword.			-->
+
+	<send>
+		<![CDATA[
+
+			SIP/2.0 180 Ringing
+			[last_Via:]
+			Record-Route: [$rr_out]
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, OPTIONS, UPDATE, PRACK, SUBSCRIBE, INFO
+			Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+			X-SIPP: uas.xml
+			Content-Length: 0
+
+		]]>
+	</send>
+
+	<recv request="UPDATE" rtd="true">
+		<action>
+			<ereg
+				regexp="\s*(.*)\s*"
+				search_in="hdr"
+				header="Route:"
+				assign_to="1,r_got"/>
+			<strcmp
+				assign_to="1"
+				variable="r_got"
+				variable2="rr_out" />
+			<test
+				assign_to="r_wrong"
+				variable="1"
+				compare="not_equal"
+				value="" />
+		</action>
+	</recv>
+
+	<nop condexec="r_wrong">
+		<action>
+			<error message="ACK Route expected '[$rr_out]' but got '[$r_got]'" />
+		</action>
+	</nop>
+
+	<send>
+		<![CDATA[
+
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, OPTIONS, UPDATE, PRACK, SUBSCRIBE, INFO
+			Contact: <sip:bob@[local_ip]:[local_port]>
+			X-SIPP: uas.xml ACK UPDATE
+			Content-Length:0
+
+		]]>
+	</send>
+
+	<pause milliseconds="200" />
+
+	<send retrans="500">
+		<![CDATA[
+
+			SIP/2.0 200 OK
+			Via: [$original_via]
+			Record-Route: <sip:[local_ip]:[local_port];transport=[transport];lr>
+			[last_From:]
+			[last_To:]
+			[last_Call-ID:]
+			CSeq: [cseq-1] INVITE
+			Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, OPTIONS, UPDATE, PRACK, SUBSCRIBE, INFO
+			Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+			X-SIPP: uas.xml ANSWER CALL
+			Content-Type: application/sdp
+			Content-Length: [len]
+
+			v=0
+			o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+			s=-
+			c=IN IP[media_ip_type] [media_ip]
+			t=0 0
+			m=audio [media_port] RTP/AVP 0
+			a=rtpmap:0 PCMU/8000
+
+		]]>
+	</send>
+
+	<recv request="ACK">
+		<action>
+			<!-- Save the From tag. We'll need it when we send our BYE -->
+			<ereg
+				regexp="(;tag=.*)"
+				header="From:"
+				search_in="hdr"
+				check_it="true"
+				assign_to="remote_tag"/>
+			<!-- Save the From user portion of URI. We'll need it when we send our BYE -->
+			<ereg
+				regexp="(sip:bob)"
+				header="From:"
+				search_in="hdr"
+				check_it="true"
+				assign_to="remote_user"/>
+			</action>
+	</recv>
+
+
+	<send retrans="500">
+		<![CDATA[
+
+			BYE [$remote_user]@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: <sip:charlie@[local_ip]:[local_port]>;tag=[call_number]
+			To: <[$remote_user]@[remote_ip]:[remote_port]>[$remote_tag]
+			Call-ID: [call_id]
+			CSeq: [cseq] BYE
+			Contact: sip:charlie@[local_ip]:[local_port]
+			Max-Forwards: 70
+			Subject: Performance Test
+			Content-Length: 0
+
+		]]>
+	</send>
+
+	<recv
+		request="ACK"
+		optional="true"
+		rtd="true">
+	</recv>
+
+	<recv response="200">
+	</recv>
+
+	<!-- definition of the response time repartition table (unit is ms)	-->
+	<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+	<!-- definition of the call length repartition table (unit is ms)	-->
+	<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/test-config.yaml b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/test-config.yaml
new file mode 100644
index 0000000..7e77de8
--- /dev/null
+++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/callee_local_semi_attended_transfer_record_route/test-config.yaml
@@ -0,0 +1,56 @@
+testinfo:
+    summary: Test performing a callee-initiated semi attended transfer with record-route header via chan_pjsip.
+    description: |
+        "Start four SIPp scenarios that do the following:
+        SIPp #1 (uac-no-hangup.xml) calls through Asterisk to SIPp #2 (referer_uas.xml)
+        SIPp #2 kicks off SIPp #3 (referee.xml) which calls SIPp #4 (uas.xml).
+        SIPp #3 passes call information back to SIPp #2.
+        Before SIPp #4 answers SIPp #2 initiates an attended transfer via REFER with Replaces information from SIPp #3.
+        SIPp #3 is hung up.
+        SIPp #2 hangs up.
+        SIPp #4 continues to ring until it answers.
+        SIPp #1 receives a connected line update and the values are checked.
+        SIPp #4 answers.
+        SIPp #1 and SIPp #4 are bridged.
+        SIPp #4 receives a connected line update and the values are checked.
+        SIPp #4 hangs up.
+        SIPp #1 is hung up."
+
+test-modules:
+    add-test-to-search-path: True
+    test-object:
+        config-section: test-object-config
+        typename: sipp.SIPpTestCase
+    modules:
+        -
+            config-section: ami-config
+            typename: 'ami.AMIEventModule'
+
+test-object-config:
+    memcheck-delay-stop: 7
+    fail-on-any: True
+    test-iterations:
+        -
+            scenarios:
+                - { 'coordinated-sender': {'key-args': {'scenario':'referer_uas.xml', '-p':'5066', '-sleep': '2'} },
+                    'coordinated-receiver': { 'key-args': {'scenario':'referee.xml', '-p':'5065'} } }
+                - { 'key-args': {'scenario':'uas.xml', '-p':'5067', '-sleep': '2'} }
+                - { 'key-args': {'scenario':'uac-no-hangup.xml', '-p':'5068', '-s':'alice', '-sleep': '2'} }
+
+ami-config:
+    -
+        type: 'headermatch'
+        conditions:
+            match:
+                Event: 'AttendedTransfer'
+                Result: 'Success'
+        count: 1
+
+properties:
+    dependencies:
+        - python : twisted
+        - python : starpy
+        - asterisk : app_dial
+        - asterisk : chan_pjsip
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/tests.yaml b/tests/channels/pjsip/transfers/attended_transfer/nominal/tests.yaml
index b56c877..0eefcbb 100644
--- a/tests/channels/pjsip/transfers/attended_transfer/nominal/tests.yaml
+++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/tests.yaml
@@ -10,3 +10,4 @@
     - test: 'callee_local_app'
     - test: 'caller_local_direct_media'
     - test: 'callee_local_direct_media'
+    - test: 'callee_local_semi_attended_transfer_record_route'

-- 
To view, visit https://gerrit.asterisk.org/c/testsuite/+/18461
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: 18
Gerrit-Change-Id: I55caad3cb2a156b8e3f2f24dd10db5ebe67910d2
Gerrit-Change-Number: 18461
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-CC: Mark Petersen <bugs.digium.com at zombie.dk>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220427/f79fe158/attachment-0001.html>


More information about the asterisk-code-review mailing list