[Asterisk-code-review] pjsip: Add tests for 'rtp timeout' and 'rtp timeout hold' en... (testsuite[master])

Joshua Colp asteriskteam at digium.com
Tue Jul 21 06:17:48 CDT 2015


Joshua Colp has uploaded a new change for review.

  https://gerrit.asterisk.org/939

Change subject: pjsip: Add tests for 'rtp_timeout' and 'rtp_timeout_hold' endpoint options.
......................................................................

pjsip: Add tests for 'rtp_timeout' and 'rtp_timeout_hold' endpoint options.

These tests verify that if the 'rtp_timeout' and 'rtp_timeout_hold' options
are set and RTP is not received that the channel is hung up.

ASTERISK-25259 #close

Change-Id: I85a8cf7c9858ab41d6708bc4b6476bef815f45b5
---
A tests/channels/pjsip/rtp_timeout/configs/ast1/extensions.conf
A tests/channels/pjsip/rtp_timeout/configs/ast1/pjsip.conf
A tests/channels/pjsip/rtp_timeout/sipp/uac.xml
A tests/channels/pjsip/rtp_timeout/test-config.yaml
A tests/channels/pjsip/rtp_timeout_hold/configs/ast1/extensions.conf
A tests/channels/pjsip/rtp_timeout_hold/configs/ast1/pjsip.conf
A tests/channels/pjsip/rtp_timeout_hold/sipp/uac.xml
A tests/channels/pjsip/rtp_timeout_hold/test-config.yaml
M tests/channels/pjsip/tests.yaml
9 files changed, 405 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/39/939/1

diff --git a/tests/channels/pjsip/rtp_timeout/configs/ast1/extensions.conf b/tests/channels/pjsip/rtp_timeout/configs/ast1/extensions.conf
new file mode 100644
index 0000000..cdc2821
--- /dev/null
+++ b/tests/channels/pjsip/rtp_timeout/configs/ast1/extensions.conf
@@ -0,0 +1,4 @@
+[default]
+exten => test,1,Answer()
+same => n,Playback(demo-congrats)
+same => n,Hangup()
diff --git a/tests/channels/pjsip/rtp_timeout/configs/ast1/pjsip.conf b/tests/channels/pjsip/rtp_timeout/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..f54a8e2
--- /dev/null
+++ b/tests/channels/pjsip/rtp_timeout/configs/ast1/pjsip.conf
@@ -0,0 +1,9 @@
+[main-transport]
+type=transport
+protocol=udp
+bind=127.0.0.1
+
+[sipp]
+type=endpoint
+allow=ulaw
+rtp_timeout=5
diff --git a/tests/channels/pjsip/rtp_timeout/sipp/uac.xml b/tests/channels/pjsip/rtp_timeout/sipp/uac.xml
new file mode 100644
index 0000000..4436389
--- /dev/null
+++ b/tests/channels/pjsip/rtp_timeout/sipp/uac.xml
@@ -0,0 +1,119 @@
+<?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             -->
+<!--                                                                    -->
+<!--                 Sipp default 'uac' scenario.                       -->
+<!--                                                                    -->
+
+<scenario name="Basic Sipstone UAC">
+  <!-- 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:test@[remote_ip]:[remote_port]>
+      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: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>
+
+  <!-- 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 response="200" rtd="true">
+  </recv>
+
+  <!-- Packet lost can be simulated in any send/recv message by         -->
+  <!-- by adding the 'lost = "10"'. Value can be [1-100] percent.       -->
+  <send>
+    <![CDATA[
+
+      ACK 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:test@[remote_ip]:[remote_port]>[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">
+  </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>
+
+  <!-- Keep the call open for a while in case the 200 is lost to be     -->
+  <!-- able to retransmit it if we receive the BYE again.               -->
+  <pause milliseconds="4000"/>
+
+
+  <!-- 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/rtp_timeout/test-config.yaml b/tests/channels/pjsip/rtp_timeout/test-config.yaml
new file mode 100644
index 0000000..639f14a
--- /dev/null
+++ b/tests/channels/pjsip/rtp_timeout/test-config.yaml
@@ -0,0 +1,44 @@
+testinfo:
+    summary: 'Ensure channel is hung up when RTP timeout is reached.'
+    description: |
+        'A SIPp scenario places a call into Asterisk. The call is immediately answered and
+        media is sent to the address provided in the SDP. SIPp is not configured to echo
+        or send RTP. The endpoint the SIPp scenario uses is configured to have an RTP timeout
+        of 5 seconds. After 5 seconds the channel should be hung up as a result of the
+        RTP timeout.'
+
+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.xml'}}
+
+ami-config:
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'SoftHangupRequest'
+                Channel: 'PJSIP/sipp-*'
+        count: '2'
+
+properties:
+    minversion: '13.5.0'
+    dependencies:
+        - python: 'twisted'
+        - python: 'starpy'
+        - app: 'sipp'
+        - asterisk: 'res_pjsip'
+        - asterisk: 'res_pjsip_session'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/rtp_timeout_hold/configs/ast1/extensions.conf b/tests/channels/pjsip/rtp_timeout_hold/configs/ast1/extensions.conf
new file mode 100644
index 0000000..cdc2821
--- /dev/null
+++ b/tests/channels/pjsip/rtp_timeout_hold/configs/ast1/extensions.conf
@@ -0,0 +1,4 @@
+[default]
+exten => test,1,Answer()
+same => n,Playback(demo-congrats)
+same => n,Hangup()
diff --git a/tests/channels/pjsip/rtp_timeout_hold/configs/ast1/pjsip.conf b/tests/channels/pjsip/rtp_timeout_hold/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..1de9f9c
--- /dev/null
+++ b/tests/channels/pjsip/rtp_timeout_hold/configs/ast1/pjsip.conf
@@ -0,0 +1,9 @@
+[main-transport]
+type=transport
+protocol=udp
+bind=127.0.0.1
+
+[sipp]
+type=endpoint
+allow=ulaw
+rtp_timeout_hold=5
diff --git a/tests/channels/pjsip/rtp_timeout_hold/sipp/uac.xml b/tests/channels/pjsip/rtp_timeout_hold/sipp/uac.xml
new file mode 100644
index 0000000..94c47d6
--- /dev/null
+++ b/tests/channels/pjsip/rtp_timeout_hold/sipp/uac.xml
@@ -0,0 +1,170 @@
+<?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             -->
+<!--                                                                    -->
+<!--                 Sipp default 'uac' scenario.                       -->
+<!--                                                                    -->
+
+<scenario name="Basic Sipstone UAC">
+  <!-- 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:test@[remote_ip]:[remote_port]>
+      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: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>
+
+  <!-- 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 response="200" rtd="true">
+  </recv>
+
+  <!-- Packet lost can be simulated in any send/recv message by         -->
+  <!-- by adding the 'lost = "10"'. Value can be [1-100] percent.       -->
+  <send>
+    <![CDATA[
+
+      ACK 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:test@[remote_ip]:[remote_port]>[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>
+
+  <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:test@[remote_ip]:[remote_port]>[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:0 PCMU/8000
+      a=sendonly
+
+    ]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK 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:test@[remote_ip]:[remote_port]>[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>
+
+  <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>
+
+  <!-- Keep the call open for a while in case the 200 is lost to be     -->
+  <!-- able to retransmit it if we receive the BYE again.               -->
+  <pause milliseconds="4000"/>
+
+
+  <!-- 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/rtp_timeout_hold/test-config.yaml b/tests/channels/pjsip/rtp_timeout_hold/test-config.yaml
new file mode 100644
index 0000000..55a7b07
--- /dev/null
+++ b/tests/channels/pjsip/rtp_timeout_hold/test-config.yaml
@@ -0,0 +1,44 @@
+testinfo:
+    summary: 'Ensure channel is hung up when RTP hold timeout is reached.'
+    description: |
+        'A SIPp scenario places a call into Asterisk. The call is immediately answered and
+        media is sent to the address provided in the SDP. SIPp then places the call on hold.
+        SIPp is not configured to echo or send RTP. The endpoint the SIPp scenario uses is
+        configured to have an RTP hold timeout of 5 seconds. After 5 seconds the channel
+        should be hung up as a result of the RTP hold timeout.'
+
+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.xml'}}
+
+ami-config:
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'SoftHangupRequest'
+                Channel: 'PJSIP/sipp-*'
+        count: '2'
+
+properties:
+    minversion: '13.5.0'
+    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 6351df0..6d8d21b 100644
--- a/tests/channels/pjsip/tests.yaml
+++ b/tests/channels/pjsip/tests.yaml
@@ -40,3 +40,5 @@
     - test: 'forward_loop'
     - dir: 'configuration'
     - dir: 'nat'
+    - test: 'rtp_timeout'
+    - test: 'rtp_timeout_hold'

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I85a8cf7c9858ab41d6708bc4b6476bef815f45b5
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>



More information about the asterisk-code-review mailing list