[Asterisk-code-review] testsuite: add validations for 181 and History-Info conversions (testsuite[16])

Torrey Searle asteriskteam at digium.com
Mon Aug 17 07:31:00 CDT 2020


Torrey Searle has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/14732 )


Change subject: testsuite: add validations for 181 and History-Info conversions
......................................................................

testsuite: add validations for 181 and History-Info conversions

ASTERISK-29027 #close

Change-Id: I287c78b38f48817ea4547e3ab0370d26d2abf2e3
---
M tests/channels/pjsip/diversion/diversion_basic/sipp/user1.xml
M tests/channels/pjsip/diversion/diversion_caller_id/sipp/user1.xml
A tests/channels/pjsip/diversion/history_info_request/configs/ast1/extensions.conf
A tests/channels/pjsip/diversion/history_info_request/configs/ast1/pjsip.conf
A tests/channels/pjsip/diversion/history_info_request/sipp/user1.xml
A tests/channels/pjsip/diversion/history_info_request/sipp/user2.xml
A tests/channels/pjsip/diversion/history_info_request/test-config.yaml
M tests/channels/pjsip/diversion/tests.yaml
8 files changed, 238 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/32/14732/1

diff --git a/tests/channels/pjsip/diversion/diversion_basic/sipp/user1.xml b/tests/channels/pjsip/diversion/diversion_basic/sipp/user1.xml
index a7c8dda..c21d27a 100644
--- a/tests/channels/pjsip/diversion/diversion_basic/sipp/user1.xml
+++ b/tests/channels/pjsip/diversion/diversion_basic/sipp/user1.xml
@@ -29,7 +29,7 @@
 
 	<recv response="100" optional="true" />
 
-	<recv response="181" optional="true" />
+	<recv response="181" />
 
 	<recv response="180" optional="true" />
 
diff --git a/tests/channels/pjsip/diversion/diversion_caller_id/sipp/user1.xml b/tests/channels/pjsip/diversion/diversion_caller_id/sipp/user1.xml
index cae005c..0151a16 100644
--- a/tests/channels/pjsip/diversion/diversion_caller_id/sipp/user1.xml
+++ b/tests/channels/pjsip/diversion/diversion_caller_id/sipp/user1.xml
@@ -29,7 +29,13 @@
 
 	<recv response="100" optional="true" />
 
-	<recv response="181" optional="true" />
+	<recv response="181">
+                <action>
+                        <!-- Check that the Diversion header is present and contains the correct caller id. -->
+	        	<ereg regexp=".*sip:user3.*" search_in="hdr" header="Diversion:" check_it="true" assign_to="1" />
+		        <log message="Received INVITE with Diversion header: [$1]." />
+		</action>
+	</recv>
 
 	<recv response="180" optional="true" />
 
diff --git a/tests/channels/pjsip/diversion/history_info_request/configs/ast1/extensions.conf b/tests/channels/pjsip/diversion/history_info_request/configs/ast1/extensions.conf
new file mode 100644
index 0000000..4719251
--- /dev/null
+++ b/tests/channels/pjsip/diversion/history_info_request/configs/ast1/extensions.conf
@@ -0,0 +1,7 @@
+[general]
+
+[default]
+
+exten => user1,1,Dial(PJSIP/user1)
+exten => user2,1,Dial(PJSIP/user2)
+exten => user3,1,Dial(PJSIP/user3)
diff --git a/tests/channels/pjsip/diversion/history_info_request/configs/ast1/pjsip.conf b/tests/channels/pjsip/diversion/history_info_request/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..0291c85
--- /dev/null
+++ b/tests/channels/pjsip/diversion/history_info_request/configs/ast1/pjsip.conf
@@ -0,0 +1,45 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[local]
+type=transport
+protocol=udp
+bind=0.0.0.0
+
+[user1-aors]
+type=aor
+contact=sip:user1 at 127.0.0.1:5061
+
+[user1]
+type=endpoint
+context=default
+aors=user1-aors
+direct_media=no
+disallow=all
+allow=ulaw
+
+[user2-aors]
+type=aor
+contact=sip:user2 at 127.0.0.1:5062
+
+[user2]
+type=endpoint
+context=default
+aors=user2-aors
+direct_media=no
+disallow=all
+allow=ulaw
+
+[user3-aors]
+type=aor
+contact=sip:user3 at 127.0.0.1:5063
+
+[user3]
+type=endpoint
+context=default
+aors=user3-aors
+direct_media=no
+disallow=all
+allow=ulaw
diff --git a/tests/channels/pjsip/diversion/history_info_request/sipp/user1.xml b/tests/channels/pjsip/diversion/history_info_request/sipp/user1.xml
new file mode 100644
index 0000000..9141de1
--- /dev/null
+++ b/tests/channels/pjsip/diversion/history_info_request/sipp/user1.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<scenario name="send an invite to user2">
+	<send retrans="500">
+		<![CDATA[
+                        INVITE sip:user2@[remote_ip]:[remote_port] SIP/2.0
+                        Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+                        From: user1 <sip:user1@[local_ip]:[local_port]>;tag=[call_number]
+                        To: user2 <sip:amenhotep@[remote_ip]:[remote_port]>
+                        Call-ID: [call_id]
+                        CSeq: [cseq] INVITE
+                        Contact: sip:user1@[local_ip]:[local_port]
+                        Max-Forwards: 70
+			History-Info: <sip:amenhotep at 127.0.0.1>;index=1
+			History-Info: <sip:user2 at 127.0.0.1;cause=302>;index=1.1
+                        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="181" optional="true" />
+
+	<recv response="180" optional="true" />
+
+	<recv response="183" optional="true" />
+
+	<recv response="200" />
+
+	<send>
+		<![CDATA[
+			ACK sip:user2@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: <sip:user1@[local_ip]>;tag=[call_number]
+			To: <sip:user2@[remote_ip]:[remote_port]>[peer_tag_param]
+			CSeq: [cseq] ACK
+			Call-ID: [call_id]
+			Max-Forwards: 70
+			Content-Length: 0
+
+		]]>
+	</send>
+
+	<send retrans="500">
+		<![CDATA[
+			BYE sip:user2@[remote_ip]:[remote_port] SIP/2.0
+			Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+			From: <sip:user1@[local_ip]>;tag=[call_number]
+			To: <sip:user2@[remote_ip]:[remote_port]>[peer_tag_param]
+			CSeq: [cseq] BYE
+			Call-ID: [call_id]
+			Max-Forwards: 70
+			Content-Length: 0
+		]]>
+	</send>
+
+	<recv response="200" crlf="true" />
+</scenario>
diff --git a/tests/channels/pjsip/diversion/history_info_request/sipp/user2.xml b/tests/channels/pjsip/diversion/history_info_request/sipp/user2.xml
new file mode 100644
index 0000000..c6b1b39
--- /dev/null
+++ b/tests/channels/pjsip/diversion/history_info_request/sipp/user2.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<scenario name="receives invite with diversion info">
+	<recv request="INVITE" crlf="true">
+                <action>
+                        <!-- Check that the Diversion header is present and contains the correct name. -->
+	        	<ereg regexp="amenhotep" search_in="hdr" header="Diversion:" check_it="true" assign_to="1" />
+		        <log message="Received INVITE with Diversion header: [$1]." />
+		</action>
+        </recv>
+
+	<send>
+		<![CDATA[
+			SIP/2.0 100 Trying
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:user2@[local_ip]:[local_port];transport=[transport]>
+			Content-Length: 0
+		]]>
+	</send>
+
+	<send>
+		<![CDATA[
+			SIP/2.0 180 Ringing
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:user2@[local_ip]:[local_port];transport=[transport]>
+			Content-Length: 0
+		]]>
+	</send>
+
+	<send retrans="500">
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Contact: <sip:user2@[local_ip]:[local_port];transport=[transport]>
+			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 request="ACK"/>
+
+	<recv request="BYE" crlf="true" />
+
+	<send retrans="500">
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:];tag=[call_number]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Content-Type: application/sdp
+			Content-Length: 0
+
+		]]>
+	</send>
+</scenario>
diff --git a/tests/channels/pjsip/diversion/history_info_request/test-config.yaml b/tests/channels/pjsip/diversion/history_info_request/test-config.yaml
new file mode 100644
index 0000000..43b1a38
--- /dev/null
+++ b/tests/channels/pjsip/diversion/history_info_request/test-config.yaml
@@ -0,0 +1,27 @@
+testinfo:
+    summary: 'Test to make sure the history-info headers on an invite gets
+              propagated as diversion correctly.'
+    description: |
+        'user1 calls user2 with an invite containing a diversion header.'
+
+properties:
+    dependencies:
+        - app : 'sipp'
+        - asterisk : 'app_dial'
+        - asterisk : 'res_pjsip'
+        - asterisk : 'res_pjsip_diversion'
+    tags:
+        - pjsip
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+    memcheck-delay-stop: 7
+    test-iterations:
+        -
+             scenarios:
+                - { 'key-args': { 'scenario':'user2.xml', '-p':'5062' } }
+                - { 'key-args': { 'scenario':'user1.xml', '-p':'5061' } }
diff --git a/tests/channels/pjsip/diversion/tests.yaml b/tests/channels/pjsip/diversion/tests.yaml
index ea60a32..2d0502f 100644
--- a/tests/channels/pjsip/diversion/tests.yaml
+++ b/tests/channels/pjsip/diversion/tests.yaml
@@ -4,6 +4,7 @@
     - test: 'diversion_basic_drop_options'
     - test: 'diversion_caller_id'
     - test: 'diversion_request'
+    - test: 'history_info_request'
     - test: 'diversion_request_drop_options'
     - test: 'diversion_response'
     - test: 'diversion_response_drop_options'

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

Gerrit-Project: testsuite
Gerrit-Branch: 16
Gerrit-Change-Id: I287c78b38f48817ea4547e3ab0370d26d2abf2e3
Gerrit-Change-Number: 14732
Gerrit-PatchSet: 1
Gerrit-Owner: Torrey Searle <tsearle at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200817/dc79dc4d/attachment-0001.html>


More information about the asterisk-code-review mailing list