[asterisk-commits] pjsip: Add tests for 'rtp timeout' and 'rtp timeout hold' en... (testsuite[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 28 08:50:29 CDT 2015


Matt Jordan has submitted this change and it was merged.

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
---
M tests/channels/pjsip/rtp/tests.yaml
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
9 files changed, 405 insertions(+), 0 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Matt Jordan: Looks good to me, approved; Verified



diff --git a/tests/channels/pjsip/rtp/tests.yaml b/tests/channels/pjsip/rtp/tests.yaml
index 6757b6a..5d77214 100644
--- a/tests/channels/pjsip/rtp/tests.yaml
+++ b/tests/channels/pjsip/rtp/tests.yaml
@@ -1,3 +1,5 @@
 # Enter tests here in the order they should be considered for execution:
 tests:
     - dir: 'rtp_keepalive'
+    - test: 'timeout'
+    - test: 'timeout_hold'
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

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I85a8cf7c9858ab41d6708bc4b6476bef815f45b5
Gerrit-PatchSet: 2
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-commits mailing list