[Asterisk-code-review] AST-2021-007 - pjsip: Test for receiving re-INVITE after sending BYE. (testsuite[18])

Friendly Automation asteriskteam at digium.com
Fri Jul 23 10:57:11 CDT 2021


Friendly Automation has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/16198 )


Change subject: AST-2021-007 - pjsip: Test for receiving re-INVITE after sending BYE.
......................................................................

AST-2021-007 - pjsip: Test for receiving re-INVITE after sending BYE.

This adds a test that confirms upon receiving a re-INVITE after
we have sent a BYE that we do not crash.

ASTERISK-29381

Change-Id: I39f71f076a1d15a64f5f1efa0b2d5692c456b331
---
A tests/channels/pjsip/reinvite_after_bye/configs/ast1/extensions.conf
A tests/channels/pjsip/reinvite_after_bye/configs/ast1/pjsip.conf
A tests/channels/pjsip/reinvite_after_bye/sipp/reinvite-after-bye.xml
A tests/channels/pjsip/reinvite_after_bye/test-config.yaml
M tests/channels/pjsip/tests.yaml
5 files changed, 186 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/98/16198/1

diff --git a/tests/channels/pjsip/reinvite_after_bye/configs/ast1/extensions.conf b/tests/channels/pjsip/reinvite_after_bye/configs/ast1/extensions.conf
new file mode 100644
index 0000000..7a5b80a
--- /dev/null
+++ b/tests/channels/pjsip/reinvite_after_bye/configs/ast1/extensions.conf
@@ -0,0 +1,4 @@
+[default]
+exten => test,1,Answer()
+same => n,Wait(0.1)
+same => n,Hangup
diff --git a/tests/channels/pjsip/reinvite_after_bye/configs/ast1/pjsip.conf b/tests/channels/pjsip/reinvite_after_bye/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..68bcd4b
--- /dev/null
+++ b/tests/channels/pjsip/reinvite_after_bye/configs/ast1/pjsip.conf
@@ -0,0 +1,14 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[main-transport]
+type=transport
+protocol=udp
+bind=127.0.0.1
+
+[sipp]
+type=endpoint
+send_pai=yes
+allow=ulaw
diff --git a/tests/channels/pjsip/reinvite_after_bye/sipp/reinvite-after-bye.xml b/tests/channels/pjsip/reinvite_after_bye/sipp/reinvite-after-bye.xml
new file mode 100644
index 0000000..7426f37
--- /dev/null
+++ b/tests/channels/pjsip/reinvite_after_bye/sipp/reinvite-after-bye.xml
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="491 Test">
+  <!-- In client mode (sipp placing calls), the Call-ID MUST be         -->
+  <!-- generated by sipp. To do so, use [call_id] keyword.                -->
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:test@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: sut <sip:[service]@[remote_ip]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: sip:sipp@[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:8 PCMA/8000
+      a=rtpmap:0 PCMU/8000
+      a=ptime:20
+
+    ]]>
+  </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:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: sut <sip:[service]@[remote_ip]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv request="BYE" crlf="true" />
+
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:test@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: sut <sip:[service]@[remote_ip]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 INVITE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <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:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: sut <sip:[service]@[remote_ip]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 ACK
+      Contact: sip:sipp@[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:8 PCMA/8000
+      a=rtpmap:0 PCMU/8000
+      a=ptime:20
+
+    ]]>
+  </send>
+
+  <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:]
+      Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
+      Allow: INVITE, ACK, MESSAGE, BYE
+      Content-Type: application/sdp
+      Content-Length: 0
+    ]]>
+  </send>
+
+</scenario>
+
diff --git a/tests/channels/pjsip/reinvite_after_bye/test-config.yaml b/tests/channels/pjsip/reinvite_after_bye/test-config.yaml
new file mode 100644
index 0000000..15cad50
--- /dev/null
+++ b/tests/channels/pjsip/reinvite_after_bye/test-config.yaml
@@ -0,0 +1,30 @@
+testinfo:
+    summary: 'Ensure graceful operation when receiving a re-INVITE after sending a BYE.'
+    description: |
+        'A SIPp scenario places a call into Asterisk. Once the call has been answered, we
+        immediately hang it up causing a BYE to be sent to the caller. Upon the caller
+        receiving the BYE it sends a re-INVITE without SDP instead of responding to the BYE.
+        The re-INVITE is handled like normal and once the caller receives a retransmission
+        of the BYE it then handles the BYE like normal.'
+
+test-modules:
+    test-object:
+        config-section: sipp-config
+        typename: 'sipp.SIPpTestCase'
+
+sipp-config:
+    memcheck-delay-stop: 7
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'reinvite-after-bye.xml'}}
+
+properties:
+    dependencies:
+        - python: 'twisted'
+        - python: 'starpy'
+        - app: 'sipp'
+        - asterisk: 'res_pjsip'
+        - asterisk: 'res_pjsip_session'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/tests.yaml b/tests/channels/pjsip/tests.yaml
index 280a4a0..1b4fad8 100644
--- a/tests/channels/pjsip/tests.yaml
+++ b/tests/channels/pjsip/tests.yaml
@@ -63,3 +63,4 @@
     - test: 'moh_passthru_inactive'
     - test: 'non_negotiated_frame_SSRC_change'
     - test: 'content_disposition'
+    - test: 'reinvite_after_bye'

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

Gerrit-Project: testsuite
Gerrit-Branch: 18
Gerrit-Change-Id: I39f71f076a1d15a64f5f1efa0b2d5692c456b331
Gerrit-Change-Number: 16198
Gerrit-PatchSet: 1
Gerrit-Owner: Friendly Automation
Gerrit-CC: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210723/eb8011e3/attachment-0001.html>


More information about the asterisk-code-review mailing list