[Asterisk-code-review] pjsip: Add tests for 100rel peer_supported. (testsuite[master])

Friendly Automation asteriskteam at digium.com
Mon Sep 26 10:10:37 CDT 2022


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

Change subject: pjsip: Add tests for 100rel peer_supported.
......................................................................

pjsip: Add tests for 100rel peer_supported.

Adds tests for the pjsip endpoint configuration 100rel=peer_supported.

ASTERISK-30158

Change-Id: I3e5b4a6655f1b97c29f4551893c17f65fb9270ae
---
A tests/channels/pjsip/rel100/incoming/peer_supported_not_used/configs/ast1/extensions.conf
A tests/channels/pjsip/rel100/incoming/peer_supported_not_used/configs/ast1/pjsip.conf
A tests/channels/pjsip/rel100/incoming/peer_supported_not_used/sipp/check_100rel.xml
A tests/channels/pjsip/rel100/incoming/peer_supported_not_used/test-config.yaml
A tests/channels/pjsip/rel100/incoming/peer_supported_require/configs/ast1/extensions.conf
A tests/channels/pjsip/rel100/incoming/peer_supported_require/configs/ast1/pjsip.conf
A tests/channels/pjsip/rel100/incoming/peer_supported_require/sipp/check_100rel.xml
A tests/channels/pjsip/rel100/incoming/peer_supported_require/test-config.yaml
A tests/channels/pjsip/rel100/incoming/peer_supported_used/configs/ast1/extensions.conf
A tests/channels/pjsip/rel100/incoming/peer_supported_used/configs/ast1/pjsip.conf
A tests/channels/pjsip/rel100/incoming/peer_supported_used/sipp/check_100rel.xml
A tests/channels/pjsip/rel100/incoming/peer_supported_used/test-config.yaml
A tests/channels/pjsip/rel100/incoming/tests.yaml
A tests/channels/pjsip/rel100/outgoing/peer_supported_not_used/configs/ast1/pjsip.conf
A tests/channels/pjsip/rel100/outgoing/peer_supported_not_used/sipp/check_100rel.xml
A tests/channels/pjsip/rel100/outgoing/peer_supported_not_used/test-config.yaml
A tests/channels/pjsip/rel100/outgoing/peer_supported_used/configs/ast1/pjsip.conf
A tests/channels/pjsip/rel100/outgoing/peer_supported_used/sipp/check_100rel.xml
A tests/channels/pjsip/rel100/outgoing/peer_supported_used/test-config.yaml
A tests/channels/pjsip/rel100/outgoing/tests.yaml
A tests/channels/pjsip/rel100/tests.yaml
M tests/channels/pjsip/tests.yaml
22 files changed, 927 insertions(+), 0 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit




diff --git a/tests/channels/pjsip/rel100/incoming/peer_supported_not_used/configs/ast1/extensions.conf b/tests/channels/pjsip/rel100/incoming/peer_supported_not_used/configs/ast1/extensions.conf
new file mode 100644
index 0000000..5dc47d8
--- /dev/null
+++ b/tests/channels/pjsip/rel100/incoming/peer_supported_not_used/configs/ast1/extensions.conf
@@ -0,0 +1,4 @@
+[default]
+exten => alice,1,Progress()
+same  =>       n,Answer()
+same  =>       n,Hangup()
diff --git a/tests/channels/pjsip/rel100/incoming/peer_supported_not_used/configs/ast1/pjsip.conf b/tests/channels/pjsip/rel100/incoming/peer_supported_not_used/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..3bcf1eb
--- /dev/null
+++ b/tests/channels/pjsip/rel100/incoming/peer_supported_not_used/configs/ast1/pjsip.conf
@@ -0,0 +1,35 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+endpoint_identifier_order=username,ip
+
+[local-transport-template](!)
+type=transport
+bind=127.0.0.1
+
+[local-transport-udp](local-transport-template)
+protocol=udp
+
+[endpoint-template](!)
+type=endpoint
+context=default
+allow=!all,ulaw,alaw
+media_address=127.0.0.1
+identify_by=ip
+100rel=peer_supported
+
+[alice-udp](endpoint-template)
+
+[unknown](endpoint-template)
+context=does-not-exist
+
+[identify-template](!)
+type=identify
+
+[alice-identify](identify-template)
+endpoint=alice-udp
+match=127.0.0.1
diff --git a/tests/channels/pjsip/rel100/incoming/peer_supported_not_used/sipp/check_100rel.xml b/tests/channels/pjsip/rel100/incoming/peer_supported_not_used/sipp/check_100rel.xml
new file mode 100644
index 0000000..d28cab4
--- /dev/null
+++ b/tests/channels/pjsip/rel100/incoming/peer_supported_not_used/sipp/check_100rel.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to alice without indicating support of 100rel">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:alice@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[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="183">
+  </recv>
+
+  <recv response="200" rtd="true">
+    <action>
+      <ereg regexp="100rel"
+          header="Supported:"
+          search_in="hdr"
+          check_it="true"
+          assign_to="1"/>
+    </action>
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:alice@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[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>
+    <![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>
+
+  <Reference variables="1" />
+
+</scenario>
+
diff --git a/tests/channels/pjsip/rel100/incoming/peer_supported_not_used/test-config.yaml b/tests/channels/pjsip/rel100/incoming/peer_supported_not_used/test-config.yaml
new file mode 100644
index 0000000..0b6a5c1
--- /dev/null
+++ b/tests/channels/pjsip/rel100/incoming/peer_supported_not_used/test-config.yaml
@@ -0,0 +1,30 @@
+testinfo:
+    summary:     'Tests 100rel=peer_supported option when caller does not support 100rel'
+    description: |
+        'Asterisk receives an incoming call with caller not indicating support for
+        100rel and Asterisk should send provisional responses normally.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+    memcheck-delay-stop: 7
+    reactor-timeout: 80
+    fail-on-any: False
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'check_100rel.xml', '-i': '127.0.0.1', '-p': '5061'} }
+
+properties:
+    dependencies:
+        - sipp :
+            version : 'v3.0'
+        - asterisk : 'res_pjsip'
+        - asterisk : 'res_pjsip_session'
+        - asterisk : 'chan_pjsip'
+        - asterisk : 'res_pjsip_endpoint_identifier_ip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/rel100/incoming/peer_supported_require/configs/ast1/extensions.conf b/tests/channels/pjsip/rel100/incoming/peer_supported_require/configs/ast1/extensions.conf
new file mode 100644
index 0000000..5dc47d8
--- /dev/null
+++ b/tests/channels/pjsip/rel100/incoming/peer_supported_require/configs/ast1/extensions.conf
@@ -0,0 +1,4 @@
+[default]
+exten => alice,1,Progress()
+same  =>       n,Answer()
+same  =>       n,Hangup()
diff --git a/tests/channels/pjsip/rel100/incoming/peer_supported_require/configs/ast1/pjsip.conf b/tests/channels/pjsip/rel100/incoming/peer_supported_require/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..3bcf1eb
--- /dev/null
+++ b/tests/channels/pjsip/rel100/incoming/peer_supported_require/configs/ast1/pjsip.conf
@@ -0,0 +1,35 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+endpoint_identifier_order=username,ip
+
+[local-transport-template](!)
+type=transport
+bind=127.0.0.1
+
+[local-transport-udp](local-transport-template)
+protocol=udp
+
+[endpoint-template](!)
+type=endpoint
+context=default
+allow=!all,ulaw,alaw
+media_address=127.0.0.1
+identify_by=ip
+100rel=peer_supported
+
+[alice-udp](endpoint-template)
+
+[unknown](endpoint-template)
+context=does-not-exist
+
+[identify-template](!)
+type=identify
+
+[alice-identify](identify-template)
+endpoint=alice-udp
+match=127.0.0.1
diff --git a/tests/channels/pjsip/rel100/incoming/peer_supported_require/sipp/check_100rel.xml b/tests/channels/pjsip/rel100/incoming/peer_supported_require/sipp/check_100rel.xml
new file mode 100644
index 0000000..916857b
--- /dev/null
+++ b/tests/channels/pjsip/rel100/incoming/peer_supported_require/sipp/check_100rel.xml
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to alice with Require: 100rel">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:alice@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[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
+      Require: 100rel
+      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="183" >
+    <action>
+      <ereg regexp="100rel"
+          header="Require:"
+          search_in="hdr"
+          check_it="true"
+          assign_to="1"/>
+      <ereg regexp=".*([0-9]{1,5})"
+          header="RSeq:"
+          search_in="hdr"
+          check_it="true"
+          assign_to="rseq"/>
+    </action>
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      PRACK sip:alice@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 PRACK
+      RAck: [$rseq] 1 INVITE
+      Max-Forwards: 70
+      Subject: Test
+      User-Agent: Test
+
+    ]]>
+  </send>
+
+  <recv response="200" >
+    <action>
+      <ereg regexp="2 PRACK"
+          header="CSeq:"
+          search_in="hdr"
+          check_it="true"
+          assign_to="1"/>
+    </action>
+  </recv>
+
+  <recv response="200" rtd="true">
+    <action>
+      <ereg regexp="1 INVITE"
+          header="CSeq:"
+          search_in="hdr"
+          check_it="true"
+          assign_to="1"/>
+      <ereg regexp="100rel"
+          header="Supported:"
+          search_in="hdr"
+          check_it="true"
+          assign_to="1"/>
+    </action>
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:alice@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[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>
+    <![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>
+
+  <Reference variables="rseq,1" />
+
+</scenario>
+
diff --git a/tests/channels/pjsip/rel100/incoming/peer_supported_require/test-config.yaml b/tests/channels/pjsip/rel100/incoming/peer_supported_require/test-config.yaml
new file mode 100644
index 0000000..6492e5a
--- /dev/null
+++ b/tests/channels/pjsip/rel100/incoming/peer_supported_require/test-config.yaml
@@ -0,0 +1,30 @@
+testinfo:
+    summary:     'Tests 100rel=peer_supported option when caller requires it'
+    description: |
+        'Asterisk receives an incoming call with caller requiring the use of
+        100rel and Asterisk should send provisional responses reliably.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+    memcheck-delay-stop: 7
+    reactor-timeout: 80
+    fail-on-any: False
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'check_100rel.xml', '-i': '127.0.0.1', '-p': '5061'} }
+
+properties:
+    dependencies:
+        - sipp :
+            version : 'v3.0'
+        - asterisk : 'res_pjsip'
+        - asterisk : 'res_pjsip_session'
+        - asterisk : 'chan_pjsip'
+        - asterisk : 'res_pjsip_endpoint_identifier_ip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/rel100/incoming/peer_supported_used/configs/ast1/extensions.conf b/tests/channels/pjsip/rel100/incoming/peer_supported_used/configs/ast1/extensions.conf
new file mode 100644
index 0000000..5dc47d8
--- /dev/null
+++ b/tests/channels/pjsip/rel100/incoming/peer_supported_used/configs/ast1/extensions.conf
@@ -0,0 +1,4 @@
+[default]
+exten => alice,1,Progress()
+same  =>       n,Answer()
+same  =>       n,Hangup()
diff --git a/tests/channels/pjsip/rel100/incoming/peer_supported_used/configs/ast1/pjsip.conf b/tests/channels/pjsip/rel100/incoming/peer_supported_used/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..3bcf1eb
--- /dev/null
+++ b/tests/channels/pjsip/rel100/incoming/peer_supported_used/configs/ast1/pjsip.conf
@@ -0,0 +1,35 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+endpoint_identifier_order=username,ip
+
+[local-transport-template](!)
+type=transport
+bind=127.0.0.1
+
+[local-transport-udp](local-transport-template)
+protocol=udp
+
+[endpoint-template](!)
+type=endpoint
+context=default
+allow=!all,ulaw,alaw
+media_address=127.0.0.1
+identify_by=ip
+100rel=peer_supported
+
+[alice-udp](endpoint-template)
+
+[unknown](endpoint-template)
+context=does-not-exist
+
+[identify-template](!)
+type=identify
+
+[alice-identify](identify-template)
+endpoint=alice-udp
+match=127.0.0.1
diff --git a/tests/channels/pjsip/rel100/incoming/peer_supported_used/sipp/check_100rel.xml b/tests/channels/pjsip/rel100/incoming/peer_supported_used/sipp/check_100rel.xml
new file mode 100644
index 0000000..3fc31c7
--- /dev/null
+++ b/tests/channels/pjsip/rel100/incoming/peer_supported_used/sipp/check_100rel.xml
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to alice with Supported: 100rel">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:alice@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[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
+      Supported: 100rel
+      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="183" >
+    <action>
+      <ereg regexp="100rel"
+          header="Require:"
+          search_in="hdr"
+          check_it="true"
+          assign_to="1"/>
+      <ereg regexp=".*([0-9]{1,5})"
+          header="RSeq:"
+          search_in="hdr"
+          check_it="true"
+          assign_to="rseq"/>
+    </action>
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      PRACK sip:alice@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 PRACK
+      RAck: [$rseq] 1 INVITE
+      Max-Forwards: 70
+      Subject: Test
+      User-Agent: Test
+
+    ]]>
+  </send>
+
+  <recv response="200" >
+    <action>
+      <ereg regexp="2 PRACK"
+          header="CSeq:"
+          search_in="hdr"
+          check_it="true"
+          assign_to="1"/>
+    </action>
+  </recv>
+
+  <recv response="200" rtd="true">
+    <action>
+      <ereg regexp="1 INVITE"
+          header="CSeq:"
+          search_in="hdr"
+          check_it="true"
+          assign_to="1"/>
+      <ereg regexp="100rel"
+          header="Supported:"
+          search_in="hdr"
+          check_it="true"
+          assign_to="1"/>
+    </action>
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:alice@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:unknown@[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>
+    <![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>
+
+  <Reference variables="rseq,1" />
+
+</scenario>
+
diff --git a/tests/channels/pjsip/rel100/incoming/peer_supported_used/test-config.yaml b/tests/channels/pjsip/rel100/incoming/peer_supported_used/test-config.yaml
new file mode 100644
index 0000000..5b74d11
--- /dev/null
+++ b/tests/channels/pjsip/rel100/incoming/peer_supported_used/test-config.yaml
@@ -0,0 +1,30 @@
+testinfo:
+    summary:     'Tests 100rel=peer_supported option when caller supports it'
+    description: |
+        'Asterisk receives an incoming call with caller indicating support for
+        100rel and Asterisk should send provisional responses reliably.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+    memcheck-delay-stop: 7
+    reactor-timeout: 80
+    fail-on-any: False
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'check_100rel.xml', '-i': '127.0.0.1', '-p': '5061'} }
+
+properties:
+    dependencies:
+        - sipp :
+            version : 'v3.0'
+        - asterisk : 'res_pjsip'
+        - asterisk : 'res_pjsip_session'
+        - asterisk : 'chan_pjsip'
+        - asterisk : 'res_pjsip_endpoint_identifier_ip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/rel100/incoming/tests.yaml b/tests/channels/pjsip/rel100/incoming/tests.yaml
new file mode 100644
index 0000000..6cabc00
--- /dev/null
+++ b/tests/channels/pjsip/rel100/incoming/tests.yaml
@@ -0,0 +1,4 @@
+tests:
+    - test: 'peer_supported_not_used'
+    - test: 'peer_supported_require'
+    - test: 'peer_supported_used'
diff --git a/tests/channels/pjsip/rel100/outgoing/peer_supported_not_used/configs/ast1/pjsip.conf b/tests/channels/pjsip/rel100/outgoing/peer_supported_not_used/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..35e2b79
--- /dev/null
+++ b/tests/channels/pjsip/rel100/outgoing/peer_supported_not_used/configs/ast1/pjsip.conf
@@ -0,0 +1,24 @@
+[global]
+debug=yes
+
+[transport-template](!)
+type=transport
+bind=127.0.0.1
+
+[transport-udp](transport-template)
+protocol=udp
+
+[aor-template](!)
+type=aor
+
+[endpoint-template](!)
+type=endpoint
+context=default
+allow=!all,ulaw
+100rel=peer_supported
+
+[alice](aor-template)
+contact=sip:alice at 127.0.0.1:5061
+
+[alice](endpoint-template)
+aors=alice
diff --git a/tests/channels/pjsip/rel100/outgoing/peer_supported_not_used/sipp/check_100rel.xml b/tests/channels/pjsip/rel100/outgoing/peer_supported_not_used/sipp/check_100rel.xml
new file mode 100644
index 0000000..366d91d
--- /dev/null
+++ b/tests/channels/pjsip/rel100/outgoing/peer_supported_not_used/sipp/check_100rel.xml
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Testing 100rel support but not usage">
+  <recv request="INVITE" rtd="true" crlf="true">
+      <!-- Save the from tag. We'll need it when we send our BYE -->
+      <action>
+          <ereg regexp=".*(;tag=.*)"
+              header="From:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_tag"/>
+          <ereg regexp="100rel"
+              header="Supported:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="1"/>
+      </action>
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 183 Call progress
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+      Supported: 100rel
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 100 100 IN IP[local_ip_type] 127.0.0.2
+      s=-
+      c=IN IP[media_ip_type] 127.0.0.2
+      t=0 0
+      m=audio [media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <pause/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+      Supported: 100rel
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 5 5 IN IP[local_ip_type] 127.0.0.3
+      s=-
+      c=IN IP[media_ip_type] 127.0.0.3
+      t=0 0
+      m=audio [media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv request="ACK"
+        rtd="true"
+        crlf="true">
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE 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]SIPpTag01[call_number]
+      To: [$remote_tag]
+      [last_Call-ID:]
+      CSeq: [cseq] BYE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" />
+
+  <Reference variables="remote_tag,1" />
+
+</scenario>
+
diff --git a/tests/channels/pjsip/rel100/outgoing/peer_supported_not_used/test-config.yaml b/tests/channels/pjsip/rel100/outgoing/peer_supported_not_used/test-config.yaml
new file mode 100644
index 0000000..622d10d
--- /dev/null
+++ b/tests/channels/pjsip/rel100/outgoing/peer_supported_not_used/test-config.yaml
@@ -0,0 +1,32 @@
+testinfo:
+    summary: 'Test that the 100rel=peer_supported setting works properly'
+    description: |
+        'Establish an outgoing call with 100rel in the Supported header.'
+
+test-modules:
+    test-object:
+        config-section: test-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: orig-config
+            typename: 'pluggable_modules.Originator'
+
+test-config:
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'check_100rel.xml', '-s': 'alice', '-p': '5061'} }
+
+orig-config:
+    channel: 'PJSIP/alice'
+
+properties:
+    dependencies:
+        - python: 'starpy'
+        - sipp:
+            version: 'v3.1'
+        - asterisk: 'chan_pjsip'
+        - asterisk: 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/rel100/outgoing/peer_supported_used/configs/ast1/pjsip.conf b/tests/channels/pjsip/rel100/outgoing/peer_supported_used/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..35e2b79
--- /dev/null
+++ b/tests/channels/pjsip/rel100/outgoing/peer_supported_used/configs/ast1/pjsip.conf
@@ -0,0 +1,24 @@
+[global]
+debug=yes
+
+[transport-template](!)
+type=transport
+bind=127.0.0.1
+
+[transport-udp](transport-template)
+protocol=udp
+
+[aor-template](!)
+type=aor
+
+[endpoint-template](!)
+type=endpoint
+context=default
+allow=!all,ulaw
+100rel=peer_supported
+
+[alice](aor-template)
+contact=sip:alice at 127.0.0.1:5061
+
+[alice](endpoint-template)
+aors=alice
diff --git a/tests/channels/pjsip/rel100/outgoing/peer_supported_used/sipp/check_100rel.xml b/tests/channels/pjsip/rel100/outgoing/peer_supported_used/sipp/check_100rel.xml
new file mode 100644
index 0000000..d8b106e
--- /dev/null
+++ b/tests/channels/pjsip/rel100/outgoing/peer_supported_used/sipp/check_100rel.xml
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Testing 100rel support and usage when required by callee">
+  <recv request="INVITE" rtd="true" crlf="true">
+      <!-- Save the from tag. We'll need it when we send our BYE -->
+      <action>
+          <ereg regexp=".*(;tag=.*)"
+              header="From:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_tag"/>
+          <ereg regexp="100rel"
+              header="Supported:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="1"/>
+      </action>
+  </recv>
+  
+  <send>
+    <![CDATA[
+
+      SIP/2.0 183 Call progress
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+      Require: 100rel
+      RSeq: 3000
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 100 100 IN IP[local_ip_type] 127.0.0.2
+      s=-
+      c=IN IP[media_ip_type] 127.0.0.2
+      t=0 0
+      m=audio [media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+    <action>
+      <assignstr assign_to="invite_via" value="[last_Via:]" />
+      <assignstr assign_to="invite_from" value="[last_From:]" />
+      <assignstr assign_to="invite_to" value="[last_To:]" />
+      <assignstr assign_to="invite_cseq" value="[last_CSeq:]" />
+    </action>
+  </send>
+
+  <recv request="PRACK" rtd="true" crlf="true">
+      <!-- Save the from tag. We'll need it when we send our BYE -->
+      <action>
+          <ereg regexp="3000 ([0-9]{1,5}) INVITE"
+              header="RAck: "
+              search_in="hdr"
+              check_it="true"
+              assign_to="1"/>
+      </action>
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+
+    ]]>
+  </send>
+
+  <pause/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [$invite_via]
+      [$invite_from]
+      [$invite_to];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [$invite_cseq]
+      Contact: <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+      Supported: 100rel
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 5 5 IN IP[local_ip_type] 127.0.0.3
+      s=-
+      c=IN IP[media_ip_type] 127.0.0.3
+      t=0 0
+      m=audio [media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv request="ACK"
+        rtd="true"
+        crlf="true">
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE 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]SIPpTag01[call_number]
+      To: [$remote_tag]
+      [last_Call-ID:]
+      CSeq: [cseq] BYE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" />
+
+  <Reference variables="remote_tag,invite_via,invite_from,invite_to,invite_cseq,1" />
+
+</scenario>
+
diff --git a/tests/channels/pjsip/rel100/outgoing/peer_supported_used/test-config.yaml b/tests/channels/pjsip/rel100/outgoing/peer_supported_used/test-config.yaml
new file mode 100644
index 0000000..9bfe7bb
--- /dev/null
+++ b/tests/channels/pjsip/rel100/outgoing/peer_supported_used/test-config.yaml
@@ -0,0 +1,34 @@
+testinfo:
+    summary: 'Test that the 100rel=peer_supported setting works when the peer requires 100rel'
+    description: |
+        'Send an outgoing call with 100rel in the Supported header, peer responds with
+        Require: 100rel in provisional response and Asterisk correctly acknowledges provisional
+        response with PRACK as defined in RFC 3262.'
+
+test-modules:
+    test-object:
+        config-section: test-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: orig-config
+            typename: 'pluggable_modules.Originator'
+
+test-config:
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'check_100rel.xml', '-s': 'alice', '-p': '5061'} }
+
+orig-config:
+    channel: 'PJSIP/alice'
+
+properties:
+    dependencies:
+        - python: 'starpy'
+        - sipp:
+            version: 'v3.1'
+        - asterisk: 'chan_pjsip'
+        - asterisk: 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/rel100/outgoing/tests.yaml b/tests/channels/pjsip/rel100/outgoing/tests.yaml
new file mode 100644
index 0000000..96b57cc
--- /dev/null
+++ b/tests/channels/pjsip/rel100/outgoing/tests.yaml
@@ -0,0 +1,3 @@
+tests:
+    - test: 'peer_supported_not_used'
+    - test: 'peer_supported_used'
diff --git a/tests/channels/pjsip/rel100/tests.yaml b/tests/channels/pjsip/rel100/tests.yaml
new file mode 100644
index 0000000..542592d
--- /dev/null
+++ b/tests/channels/pjsip/rel100/tests.yaml
@@ -0,0 +1,3 @@
+tests:
+    - dir: 'incoming'
+    - dir: 'outgoing'
diff --git a/tests/channels/pjsip/tests.yaml b/tests/channels/pjsip/tests.yaml
index b080292..b26439f 100644
--- a/tests/channels/pjsip/tests.yaml
+++ b/tests/channels/pjsip/tests.yaml
@@ -18,6 +18,7 @@
     - dir: 'publish'
     - dir: 'qualify'
     - dir: 'registration'
+    - dir: 'rel100'
     - dir: 'resolver'
     - dir: 'rtp'
     - dir: 'rtcp'

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

Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Change-Id: I3e5b4a6655f1b97c29f4551893c17f65fb9270ae
Gerrit-Change-Number: 19340
Gerrit-PatchSet: 2
Gerrit-Owner: Maximilian Fridrich <m.fridrich at commend.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220926/6853a7ee/attachment-0001.html>


More information about the asterisk-code-review mailing list