[Asterisk-code-review] rtp_range: Add tests to verify rtp range settings are followed. (testsuite[16])

Friendly Automation asteriskteam at digium.com
Fri Dec 10 16:32:33 CST 2021


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/testsuite/+/16636 )

Change subject: rtp_range: Add tests to verify rtp range settings are followed.
......................................................................

rtp_range: Add tests to verify rtp range settings are followed.

New set of tests to verify that the rtp range configured in rtp.conf
is not exceeded by the port search logic and that asterisk does not
get into an infinite loop while searching for a free port.
Four tests are added based on even/odd start and stop port pairings.
rtp_range_even_even: begining and end of range are even
rtp_range_even_odd: start port is even, end port is odd
rtp_range_odd_even: start port is odd, end port is even
rtp_range_odd_odd: start port is odd, end port is odd

In each test we expect three calls to pass then three more to fail,
rejected with a 488 by asterisk due to it being out of free ports.

ASTERISK-27406

Change-Id: Iefa8545cc1785b1e32a42d740f8f567706c73199
---
A tests/rtp/rtp_range/rtp_range_even_even/configs/ast1/extensions.conf
A tests/rtp/rtp_range/rtp_range_even_even/configs/ast1/pjsip.conf
A tests/rtp/rtp_range/rtp_range_even_even/configs/ast1/rtp.conf
A tests/rtp/rtp_range/rtp_range_even_even/sipp/call_accept_test_range.xml
A tests/rtp/rtp_range/rtp_range_even_even/test-config.yaml
A tests/rtp/rtp_range/rtp_range_even_odd/configs/ast1/extensions.conf
A tests/rtp/rtp_range/rtp_range_even_odd/configs/ast1/pjsip.conf
A tests/rtp/rtp_range/rtp_range_even_odd/configs/ast1/rtp.conf
A tests/rtp/rtp_range/rtp_range_even_odd/sipp/call_accept_test_range.xml
A tests/rtp/rtp_range/rtp_range_even_odd/test-config.yaml
A tests/rtp/rtp_range/rtp_range_odd_even/configs/ast1/extensions.conf
A tests/rtp/rtp_range/rtp_range_odd_even/configs/ast1/pjsip.conf
A tests/rtp/rtp_range/rtp_range_odd_even/configs/ast1/rtp.conf
A tests/rtp/rtp_range/rtp_range_odd_even/sipp/call_accept_test_range.xml
A tests/rtp/rtp_range/rtp_range_odd_even/test-config.yaml
A tests/rtp/rtp_range/rtp_range_odd_odd/configs/ast1/extensions.conf
A tests/rtp/rtp_range/rtp_range_odd_odd/configs/ast1/pjsip.conf
A tests/rtp/rtp_range/rtp_range_odd_odd/configs/ast1/rtp.conf
A tests/rtp/rtp_range/rtp_range_odd_odd/sipp/call_accept_test_range.xml
A tests/rtp/rtp_range/rtp_range_odd_odd/test-config.yaml
A tests/rtp/rtp_range/tests.yaml
M tests/rtp/tests.yaml
22 files changed, 702 insertions(+), 0 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  George Joseph: Looks good to me, but someone else must approve
  Friendly Automation: Approved for Submit



diff --git a/tests/rtp/rtp_range/rtp_range_even_even/configs/ast1/extensions.conf b/tests/rtp/rtp_range/rtp_range_even_even/configs/ast1/extensions.conf
new file mode 100644
index 0000000..87291fb
--- /dev/null
+++ b/tests/rtp/rtp_range/rtp_range_even_even/configs/ast1/extensions.conf
@@ -0,0 +1,6 @@
+[default]
+
+exten => test,1,Answer
+exten => test,n,Noop(RTCP Range Test ASTERISK-27406)
+exten => test,n,Wait(15)
+exten => test,n,Hangup
diff --git a/tests/rtp/rtp_range/rtp_range_even_even/configs/ast1/pjsip.conf b/tests/rtp/rtp_range/rtp_range_even_even/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..bef6c2f
--- /dev/null
+++ b/tests/rtp/rtp_range/rtp_range_even_even/configs/ast1/pjsip.conf
@@ -0,0 +1,19 @@
+[global]
+type=global
+debug=yes
+
+[local]
+type=transport
+bind=0.0.0.0
+protocol=udp
+
+[alice]
+type=endpoint
+context=default
+allow=!all,ulaw
+transport=local
+direct_media=no
+
+[alice]
+type=aor
+contact=sip:alice at 127.0.0.1:5061
diff --git a/tests/rtp/rtp_range/rtp_range_even_even/configs/ast1/rtp.conf b/tests/rtp/rtp_range/rtp_range_even_even/configs/ast1/rtp.conf
new file mode 100644
index 0000000..5472994
--- /dev/null
+++ b/tests/rtp/rtp_range/rtp_range_even_even/configs/ast1/rtp.conf
@@ -0,0 +1,3 @@
+[general]
+rtpstart=10000
+rtpend=10004
diff --git a/tests/rtp/rtp_range/rtp_range_even_even/sipp/call_accept_test_range.xml b/tests/rtp/rtp_range/rtp_range_even_even/sipp/call_accept_test_range.xml
new file mode 100644
index 0000000..9bfa262
--- /dev/null
+++ b/tests/rtp/rtp_range/rtp_range_even_even/sipp/call_accept_test_range.xml
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to echo with SDP in initial INVITE">
+  <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: test[call_number] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      User-Agent: Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="488"
+        optional="true"
+        next="1"
+        rtd="true">
+        <action>
+          <ereg regexp="test[4-6]" search_in="hdr" header="From: " assign_to="4"/>
+          <test assign_to="4" variable="4" compare="equal" value=""/>
+        </action>
+  </recv>
+
+  <recv response="200" rtd="true">
+      <action>
+      <ereg regexp="m=audio 1000[0-4] RTP/AVP 0+..*"
+            search_in="body" check_it="true" assign_to="5"/>
+      <test assign_to="5" variable="5" compare="equal" value=""/>
+    </action>
+  </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: test[call_number] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv request="BYE">
+  </recv>
+
+  <send next="2">
+    <![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>
+
+  <label id="1"/>
+
+  <send next="2">
+    <![CDATA[
+
+      ACK sip:test@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test[call_number] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <label id="2"/>
+
+  <!-- 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/rtp/rtp_range/rtp_range_even_even/test-config.yaml b/tests/rtp/rtp_range/rtp_range_even_even/test-config.yaml
new file mode 100644
index 0000000..5e0a67a
--- /dev/null
+++ b/tests/rtp/rtp_range/rtp_range_even_even/test-config.yaml
@@ -0,0 +1,28 @@
+testinfo:
+    summary: 'Verify Asterisk does not go into an infinite loop and uses correct range'
+    description:
+        This test verifies that the correct RTP Range is used and that Asterisk does not go
+        in to an infinite loop searching for a free RTP port.  Uses an even start and end port
+    issues:
+        - jira: 'ASTERISK-27406'
+
+test-modules:
+    add-test-to-search-path: True
+    test-object:
+        config-section: 'test-object-config'
+        typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+    memcheck-delay-stop: 7
+    test-iterations:
+        - scenarios:
+                - { 'key-args': {'scenario': 'call_accept_test_range.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'alice', '-timeout': '20s', '-r': '1', '-m': '6', '-l': '6'} }
+properties:
+    dependencies:
+        - sipp :
+            version : 'v3.0'
+        - asterisk : 'chan_pjsip'
+
+    tags:
+        - pjsip
+        - RTP
\ No newline at end of file
diff --git a/tests/rtp/rtp_range/rtp_range_even_odd/configs/ast1/extensions.conf b/tests/rtp/rtp_range/rtp_range_even_odd/configs/ast1/extensions.conf
new file mode 100644
index 0000000..87291fb
--- /dev/null
+++ b/tests/rtp/rtp_range/rtp_range_even_odd/configs/ast1/extensions.conf
@@ -0,0 +1,6 @@
+[default]
+
+exten => test,1,Answer
+exten => test,n,Noop(RTCP Range Test ASTERISK-27406)
+exten => test,n,Wait(15)
+exten => test,n,Hangup
diff --git a/tests/rtp/rtp_range/rtp_range_even_odd/configs/ast1/pjsip.conf b/tests/rtp/rtp_range/rtp_range_even_odd/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..bef6c2f
--- /dev/null
+++ b/tests/rtp/rtp_range/rtp_range_even_odd/configs/ast1/pjsip.conf
@@ -0,0 +1,19 @@
+[global]
+type=global
+debug=yes
+
+[local]
+type=transport
+bind=0.0.0.0
+protocol=udp
+
+[alice]
+type=endpoint
+context=default
+allow=!all,ulaw
+transport=local
+direct_media=no
+
+[alice]
+type=aor
+contact=sip:alice at 127.0.0.1:5061
diff --git a/tests/rtp/rtp_range/rtp_range_even_odd/configs/ast1/rtp.conf b/tests/rtp/rtp_range/rtp_range_even_odd/configs/ast1/rtp.conf
new file mode 100644
index 0000000..9c05a59
--- /dev/null
+++ b/tests/rtp/rtp_range/rtp_range_even_odd/configs/ast1/rtp.conf
@@ -0,0 +1,3 @@
+[general]
+rtpstart=10000
+rtpend=10005
diff --git a/tests/rtp/rtp_range/rtp_range_even_odd/sipp/call_accept_test_range.xml b/tests/rtp/rtp_range/rtp_range_even_odd/sipp/call_accept_test_range.xml
new file mode 100644
index 0000000..9bfa262
--- /dev/null
+++ b/tests/rtp/rtp_range/rtp_range_even_odd/sipp/call_accept_test_range.xml
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to echo with SDP in initial INVITE">
+  <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: test[call_number] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      User-Agent: Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="488"
+        optional="true"
+        next="1"
+        rtd="true">
+        <action>
+          <ereg regexp="test[4-6]" search_in="hdr" header="From: " assign_to="4"/>
+          <test assign_to="4" variable="4" compare="equal" value=""/>
+        </action>
+  </recv>
+
+  <recv response="200" rtd="true">
+      <action>
+      <ereg regexp="m=audio 1000[0-4] RTP/AVP 0+..*"
+            search_in="body" check_it="true" assign_to="5"/>
+      <test assign_to="5" variable="5" compare="equal" value=""/>
+    </action>
+  </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: test[call_number] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv request="BYE">
+  </recv>
+
+  <send next="2">
+    <![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>
+
+  <label id="1"/>
+
+  <send next="2">
+    <![CDATA[
+
+      ACK sip:test@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test[call_number] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <label id="2"/>
+
+  <!-- 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/rtp/rtp_range/rtp_range_even_odd/test-config.yaml b/tests/rtp/rtp_range/rtp_range_even_odd/test-config.yaml
new file mode 100644
index 0000000..d46634e
--- /dev/null
+++ b/tests/rtp/rtp_range/rtp_range_even_odd/test-config.yaml
@@ -0,0 +1,29 @@
+testinfo:
+    summary: 'Verify Asterisk does not go into an infinite loop and uses correct range'
+    description:
+        This test verifies that the correct RTP Range is used and that Asterisk does not go
+        in to an infinite loop searching for a free RTP port.  Uses an even start port and an odd end port
+    issues:
+        - jira: 'ASTERISK-27406'
+
+test-modules:
+    add-test-to-search-path: True
+    test-object:
+        config-section: 'test-object-config'
+        typename: 'sipp.SIPpTestCase'
+
+
+test-object-config:
+    memcheck-delay-stop: 7
+    test-iterations:
+        - scenarios:
+                - { 'key-args': {'scenario': 'call_accept_test_range.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'alice', '-timeout': '20s', '-r': '1', '-m': '6', '-l': '6'} }
+properties:
+    dependencies:
+        - sipp :
+            version : 'v3.0'
+        - asterisk : 'chan_pjsip'
+
+    tags:
+        - pjsip
+        - RTP
\ No newline at end of file
diff --git a/tests/rtp/rtp_range/rtp_range_odd_even/configs/ast1/extensions.conf b/tests/rtp/rtp_range/rtp_range_odd_even/configs/ast1/extensions.conf
new file mode 100644
index 0000000..87291fb
--- /dev/null
+++ b/tests/rtp/rtp_range/rtp_range_odd_even/configs/ast1/extensions.conf
@@ -0,0 +1,6 @@
+[default]
+
+exten => test,1,Answer
+exten => test,n,Noop(RTCP Range Test ASTERISK-27406)
+exten => test,n,Wait(15)
+exten => test,n,Hangup
diff --git a/tests/rtp/rtp_range/rtp_range_odd_even/configs/ast1/pjsip.conf b/tests/rtp/rtp_range/rtp_range_odd_even/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..bef6c2f
--- /dev/null
+++ b/tests/rtp/rtp_range/rtp_range_odd_even/configs/ast1/pjsip.conf
@@ -0,0 +1,19 @@
+[global]
+type=global
+debug=yes
+
+[local]
+type=transport
+bind=0.0.0.0
+protocol=udp
+
+[alice]
+type=endpoint
+context=default
+allow=!all,ulaw
+transport=local
+direct_media=no
+
+[alice]
+type=aor
+contact=sip:alice at 127.0.0.1:5061
diff --git a/tests/rtp/rtp_range/rtp_range_odd_even/configs/ast1/rtp.conf b/tests/rtp/rtp_range/rtp_range_odd_even/configs/ast1/rtp.conf
new file mode 100644
index 0000000..55f467a
--- /dev/null
+++ b/tests/rtp/rtp_range/rtp_range_odd_even/configs/ast1/rtp.conf
@@ -0,0 +1,3 @@
+[general]
+rtpstart=9999
+rtpend=10004
diff --git a/tests/rtp/rtp_range/rtp_range_odd_even/sipp/call_accept_test_range.xml b/tests/rtp/rtp_range/rtp_range_odd_even/sipp/call_accept_test_range.xml
new file mode 100644
index 0000000..9bfa262
--- /dev/null
+++ b/tests/rtp/rtp_range/rtp_range_odd_even/sipp/call_accept_test_range.xml
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to echo with SDP in initial INVITE">
+  <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: test[call_number] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      User-Agent: Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="488"
+        optional="true"
+        next="1"
+        rtd="true">
+        <action>
+          <ereg regexp="test[4-6]" search_in="hdr" header="From: " assign_to="4"/>
+          <test assign_to="4" variable="4" compare="equal" value=""/>
+        </action>
+  </recv>
+
+  <recv response="200" rtd="true">
+      <action>
+      <ereg regexp="m=audio 1000[0-4] RTP/AVP 0+..*"
+            search_in="body" check_it="true" assign_to="5"/>
+      <test assign_to="5" variable="5" compare="equal" value=""/>
+    </action>
+  </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: test[call_number] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv request="BYE">
+  </recv>
+
+  <send next="2">
+    <![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>
+
+  <label id="1"/>
+
+  <send next="2">
+    <![CDATA[
+
+      ACK sip:test@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test[call_number] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <label id="2"/>
+
+  <!-- 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/rtp/rtp_range/rtp_range_odd_even/test-config.yaml b/tests/rtp/rtp_range/rtp_range_odd_even/test-config.yaml
new file mode 100644
index 0000000..018ef71
--- /dev/null
+++ b/tests/rtp/rtp_range/rtp_range_odd_even/test-config.yaml
@@ -0,0 +1,29 @@
+testinfo:
+    summary: 'Verify Asterisk does not go into an infinite loop and uses correct range'
+    description:
+        This test verifies that the correct RTP Range is used and that Asterisk does not go
+        in to an infinite loop searching for a free RTP port.  Uses an odd start port and even end port
+    issues:
+        - jira: 'ASTERISK-27406'
+
+test-modules:
+    add-test-to-search-path: True
+    test-object:
+        config-section: 'test-object-config'
+        typename: 'sipp.SIPpTestCase'
+
+
+test-object-config:
+    memcheck-delay-stop: 7
+    test-iterations:
+        - scenarios:
+                - { 'key-args': {'scenario': 'call_accept_test_range.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'alice', '-timeout': '20s', '-r': '1', '-m': '6', '-l': '6'} }
+properties:
+    dependencies:
+        - sipp :
+            version : 'v3.0'
+        - asterisk : 'chan_pjsip'
+
+    tags:
+        - pjsip
+        - RTP
\ No newline at end of file
diff --git a/tests/rtp/rtp_range/rtp_range_odd_odd/configs/ast1/extensions.conf b/tests/rtp/rtp_range/rtp_range_odd_odd/configs/ast1/extensions.conf
new file mode 100644
index 0000000..87291fb
--- /dev/null
+++ b/tests/rtp/rtp_range/rtp_range_odd_odd/configs/ast1/extensions.conf
@@ -0,0 +1,6 @@
+[default]
+
+exten => test,1,Answer
+exten => test,n,Noop(RTCP Range Test ASTERISK-27406)
+exten => test,n,Wait(15)
+exten => test,n,Hangup
diff --git a/tests/rtp/rtp_range/rtp_range_odd_odd/configs/ast1/pjsip.conf b/tests/rtp/rtp_range/rtp_range_odd_odd/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..bef6c2f
--- /dev/null
+++ b/tests/rtp/rtp_range/rtp_range_odd_odd/configs/ast1/pjsip.conf
@@ -0,0 +1,19 @@
+[global]
+type=global
+debug=yes
+
+[local]
+type=transport
+bind=0.0.0.0
+protocol=udp
+
+[alice]
+type=endpoint
+context=default
+allow=!all,ulaw
+transport=local
+direct_media=no
+
+[alice]
+type=aor
+contact=sip:alice at 127.0.0.1:5061
diff --git a/tests/rtp/rtp_range/rtp_range_odd_odd/configs/ast1/rtp.conf b/tests/rtp/rtp_range/rtp_range_odd_odd/configs/ast1/rtp.conf
new file mode 100644
index 0000000..f791bc0
--- /dev/null
+++ b/tests/rtp/rtp_range/rtp_range_odd_odd/configs/ast1/rtp.conf
@@ -0,0 +1,3 @@
+[general]
+rtpstart=9999
+rtpend=10005
diff --git a/tests/rtp/rtp_range/rtp_range_odd_odd/sipp/call_accept_test_range.xml b/tests/rtp/rtp_range/rtp_range_odd_odd/sipp/call_accept_test_range.xml
new file mode 100644
index 0000000..9bfa262
--- /dev/null
+++ b/tests/rtp/rtp_range/rtp_range_odd_odd/sipp/call_accept_test_range.xml
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to echo with SDP in initial INVITE">
+  <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: test[call_number] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      User-Agent: Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="488"
+        optional="true"
+        next="1"
+        rtd="true">
+        <action>
+          <ereg regexp="test[4-6]" search_in="hdr" header="From: " assign_to="4"/>
+          <test assign_to="4" variable="4" compare="equal" value=""/>
+        </action>
+  </recv>
+
+  <recv response="200" rtd="true">
+      <action>
+      <ereg regexp="m=audio 1000[0-4] RTP/AVP 0+..*"
+            search_in="body" check_it="true" assign_to="5"/>
+      <test assign_to="5" variable="5" compare="equal" value=""/>
+    </action>
+  </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: test[call_number] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv request="BYE">
+  </recv>
+
+  <send next="2">
+    <![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>
+
+  <label id="1"/>
+
+  <send next="2">
+    <![CDATA[
+
+      ACK sip:test@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test[call_number] <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <label id="2"/>
+
+  <!-- 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/rtp/rtp_range/rtp_range_odd_odd/test-config.yaml b/tests/rtp/rtp_range/rtp_range_odd_odd/test-config.yaml
new file mode 100644
index 0000000..33fcdf6
--- /dev/null
+++ b/tests/rtp/rtp_range/rtp_range_odd_odd/test-config.yaml
@@ -0,0 +1,29 @@
+testinfo:
+    summary: 'Verify Asterisk does not go into an infinite loop and uses correct range'
+    description:
+        This test verifies that the correct RTP Range is used and that Asterisk does not go
+        in to an infinite loop searching for a free RTP port. Uses an odd start and end port
+    issues:
+        - jira: 'ASTERISK-27406'
+
+test-modules:
+    add-test-to-search-path: True
+    test-object:
+        config-section: 'test-object-config'
+        typename: 'sipp.SIPpTestCase'
+
+
+test-object-config:
+    memcheck-delay-stop: 7
+    test-iterations:
+        - scenarios:
+                - { 'key-args': {'scenario': 'call_accept_test_range.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'alice', '-timeout': '20s', '-r': '1', '-m': '6', '-l': '6'} }
+properties:
+    dependencies:
+        - sipp :
+            version : 'v3.0'
+        - asterisk : 'chan_pjsip'
+
+    tags:
+        - pjsip
+        - RTP
\ No newline at end of file
diff --git a/tests/rtp/rtp_range/tests.yaml b/tests/rtp/rtp_range/tests.yaml
new file mode 100644
index 0000000..f39df01
--- /dev/null
+++ b/tests/rtp/rtp_range/tests.yaml
@@ -0,0 +1,6 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - test: 'rtp_range_even_even'
+    - test: 'rtp_range_even_odd'
+    - test: 'rtp_range_odd_even'
+    - test: 'rtp_range_odd_odd'
diff --git a/tests/rtp/tests.yaml b/tests/rtp/tests.yaml
index 56e9f9e..2e2a177 100644
--- a/tests/rtp/tests.yaml
+++ b/tests/rtp/tests.yaml
@@ -2,3 +2,4 @@
 tests:
     - dir: 'strict_rtp'
     - test: 'ast-2017-012'
+    - dir: 'rtp_range'

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

Gerrit-Project: testsuite
Gerrit-Branch: 16
Gerrit-Change-Id: Iefa8545cc1785b1e32a42d740f8f567706c73199
Gerrit-Change-Number: 16636
Gerrit-PatchSet: 5
Gerrit-Owner: Michael Bradeen <mbradeen at sangoma.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20211210/90a5ac98/attachment-0001.html>


More information about the asterisk-code-review mailing list