[asterisk-commits] reinvite early: Verify operation when get an unexpected reIN... (testsuite[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Oct 8 13:49:37 CDT 2015


Joshua Colp has submitted this change and it was merged.

Change subject: reinvite_early: Verify operation when get an unexpected reINVITE.
......................................................................


reinvite_early: Verify operation when get an unexpected reINVITE.

A SIPp scenario places a call into Asterisk.  Once the call has been
answered, the caller sends a reINVITE before sending the ACK to the
initial INVITE.  Asterisk should respond to the reINVITE with a 491
because it has not seen the ACK completing the initial INVITE transaction.
Once the reINVITE is completed the SIPp scenario completes the original
INVITE and hangs up the call.

The reason this test exists is because Asterisk would crash on the early
reINVITE because the reINVITE was not identified and was treated as an
initial INVITE.  The call wound up with two PBX threads running on the
same channel.  This test ensures that the code changes have fixed the
issue as expected.

ASTERISK-25404
Reported by Chet Stevens

Change-Id: Id6fcdb655228b9bc89764cff00fdb921e6571152
---
A tests/channels/pjsip/reinvite_early/configs/ast1/extensions.conf
A tests/channels/pjsip/reinvite_early/configs/ast1/pjsip.conf
A tests/channels/pjsip/reinvite_early/sipp/uac-reinvite-early.xml
A tests/channels/pjsip/reinvite_early/test-config.yaml
M tests/channels/pjsip/tests.yaml
5 files changed, 216 insertions(+), 0 deletions(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved



diff --git a/tests/channels/pjsip/reinvite_early/configs/ast1/extensions.conf b/tests/channels/pjsip/reinvite_early/configs/ast1/extensions.conf
new file mode 100644
index 0000000..e54a358
--- /dev/null
+++ b/tests/channels/pjsip/reinvite_early/configs/ast1/extensions.conf
@@ -0,0 +1,9 @@
+[default]
+exten => test,1,NoOp()
+; Due to the nature of the bug we need a single
+; application that will answer and generate an
+; AMI event for the test controller to count.
+same => n,Playback(tt-monkeys)
+same => n,Echo()
+same => n,Hangup()
+
diff --git a/tests/channels/pjsip/reinvite_early/configs/ast1/pjsip.conf b/tests/channels/pjsip/reinvite_early/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..9d4ec8b
--- /dev/null
+++ b/tests/channels/pjsip/reinvite_early/configs/ast1/pjsip.conf
@@ -0,0 +1,9 @@
+[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_early/sipp/uac-reinvite-early.xml b/tests/channels/pjsip/reinvite_early/sipp/uac-reinvite-early.xml
new file mode 100644
index 0000000..e0d0ec6
--- /dev/null
+++ b/tests/channels/pjsip/reinvite_early/sipp/uac-reinvite-early.xml
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Early reINVITE 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=my_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 retrans="500">
+        <![CDATA[
+            INVITE sip:test@[remote_ip]:[remote_port] SIP/2.0
+            Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=my_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-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="491" 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=my_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-Length: 0
+            ]]>
+    </send>
+
+    <send>
+        <![CDATA[
+            ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+            Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=my_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>
+
+    <!-- Give the call some time to sink in. -->
+    <pause milliseconds="1000" />
+
+    <send retrans="500">
+        <![CDATA[
+            BYE sip:test@[remote_ip]:[remote_port] SIP/2.0
+            Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=my_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: 3 BYE
+            Contact: sip:sipp@[local_ip]:[local_port]
+            Max-Forwards: 70
+            Subject: Performance Test
+            Content-Length: 0
+            ]]>
+    </send>
+
+    <recv response="200" crlf="true">
+    </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/reinvite_early/test-config.yaml b/tests/channels/pjsip/reinvite_early/test-config.yaml
new file mode 100644
index 0000000..aa95249
--- /dev/null
+++ b/tests/channels/pjsip/reinvite_early/test-config.yaml
@@ -0,0 +1,59 @@
+testinfo:
+    summary: 'Ensure graceful operation when receiving an unexpected early reINVITE.'
+    description: |
+        'A SIPp scenario places a call into Asterisk.  Once the call has
+        been answered, the caller sends a reINVITE before sending the
+        ACK to the initial INVITE.  Asterisk should respond to the reINVITE
+        with a 491 because it has not seen the ACK completing the initial
+        INVITE transaction.  Once the reINVITE is completed the SIPp scenario
+        completes the original INVITE and hangs up the call.
+
+        The reason this test exists is because Asterisk would crash on the
+        early reINVITE because the reINVITE was not identified and was treated
+        as an initial INVITE.  The call wound up with two PBX threads running
+        on the same channel.  This test ensures that the code changes have
+        fixed the issue as expected.'
+
+test-modules:
+    test-object:
+        config-section: sipp-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: 'ami-config'
+            typename: 'ami.AMIEventModule'
+
+sipp-config:
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'uac-reinvite-early.xml'}}
+
+ami-config:
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'TestEvent'
+                State: 'PLAYBACK'
+                Channel: 'PJSIP/sipp-*'
+        requirements:
+            match:
+                Message: 'tt-monkeys'
+        count: '1'
+
+properties:
+    minversion: '13.7.0'
+    dependencies:
+        - python: 'twisted'
+        - python: 'starpy'
+        - app: 'sipp'
+        - asterisk: 'app_echo'
+        - asterisk: 'app_playback'
+        - asterisk: 'chan_pjsip'
+        - asterisk: 'res_pjsip'
+        - asterisk: 'res_pjsip_caller_id'
+        - asterisk: 'res_pjsip_session'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/tests.yaml b/tests/channels/pjsip/tests.yaml
index 7f98d3e..1941c54 100644
--- a/tests/channels/pjsip/tests.yaml
+++ b/tests/channels/pjsip/tests.yaml
@@ -37,6 +37,7 @@
     - test: 'info_dtmf'
     - test: 'keep_alive'
     - test: 'refer_send_to_vm'
+    - test: 'reinvite_early'
     - test: 'reinvite_pending'
     - test: 'rpid_immediate'
     - test: 'set_var'

-- 
To view, visit https://gerrit.asterisk.org/1398
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id6fcdb655228b9bc89764cff00fdb921e6571152
Gerrit-PatchSet: 2
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-commits mailing list