[Asterisk-code-review] pjsip: return all codecs on a re-INVITE without SDP (testsuite[20])

Friendly Automation asteriskteam at digium.com
Thu Oct 27 10:13:26 CDT 2022


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

Change subject: pjsip: return all codecs on a re-INVITE without SDP
......................................................................

pjsip: return all codecs on a re-INVITE without SDP

Currently chan_pjsip on receiving a re-INVITE without SDP will only
return the codecs that are previously negotiated and not offering
all enabled codecs.

This causes interoperability issues with different equipment (e.g.
from Cisco) for some of our customers and probably also in other
scenarios involving 3PCC infrastructure.

According to RFC 3261, section 14.2 we SHOULD return all codecs
on a re-INVITE without SDP.

This commit add the test for the implementation in Gerrit 18990

ASTERISK-30193

Change-Id: I4ccbbe270358e993e023baf64b85f79fc2f9a594
---
A tests/channels/pjsip/all_codecs_on_empty_reinvite/configs/ast1/extensions.conf
A tests/channels/pjsip/all_codecs_on_empty_reinvite/configs/ast1/pjsip.conf
A tests/channels/pjsip/all_codecs_on_empty_reinvite/sipp/empty-reinvite-all-codecs.xml
A tests/channels/pjsip/all_codecs_on_empty_reinvite/test-config.yaml
M tests/channels/pjsip/tests.yaml
5 files changed, 265 insertions(+), 0 deletions(-)

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




diff --git a/tests/channels/pjsip/all_codecs_on_empty_reinvite/configs/ast1/extensions.conf b/tests/channels/pjsip/all_codecs_on_empty_reinvite/configs/ast1/extensions.conf
new file mode 100644
index 0000000..554659f
--- /dev/null
+++ b/tests/channels/pjsip/all_codecs_on_empty_reinvite/configs/ast1/extensions.conf
@@ -0,0 +1,4 @@
+[default]
+exten => test,1,Answer()
+same => n,Wait(10)
+same => n,Hangup
diff --git a/tests/channels/pjsip/all_codecs_on_empty_reinvite/configs/ast1/pjsip.conf b/tests/channels/pjsip/all_codecs_on_empty_reinvite/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..603ccda
--- /dev/null
+++ b/tests/channels/pjsip/all_codecs_on_empty_reinvite/configs/ast1/pjsip.conf
@@ -0,0 +1,18 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+all_codecs_on_empty_reinvite=yes
+
+[local-transport-udp]
+type=transport
+protocol=udp
+bind=127.0.0.1
+
+[sipp]
+type=endpoint
+context=default
+media_address=127.0.0.1
+allow=!all,g722,alaw,ulaw,ilbc,opus
diff --git a/tests/channels/pjsip/all_codecs_on_empty_reinvite/sipp/empty-reinvite-all-codecs.xml b/tests/channels/pjsip/all_codecs_on_empty_reinvite/sipp/empty-reinvite-all-codecs.xml
new file mode 100644
index 0000000..0e9d3a4
--- /dev/null
+++ b/tests/channels/pjsip/all_codecs_on_empty_reinvite/sipp/empty-reinvite-all-codecs.xml
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="empty reinvite all codecs">
+  <!-- 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:[service]@[remote_ip]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [media_port] RTP/AVP 0 8
+      a=rtpmap:8 PCMA/8000
+      a=rtpmap:0 PCMU/8000
+      a=ptime:20
+
+    ]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="181"
+        optional="true">
+  </recv>
+
+  <recv response="180" optional="true">
+  </recv>
+
+  <recv response="183" optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK 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]SIPpTag00[call_number]
+      To: sut <sip:[service]@[remote_ip]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <pause milliseconds="500"/>
+
+<!-- For a re-INVITE with empty SDP Asterisk should return all codecs from the endpoint -->
+  <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:[service]@[remote_ip]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 INVITE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" rtd="true">
+    <action>
+      <ereg regexp="m=audio [0-9]{1,5} RTP/AVP 9 8 0 97 107 101+..*"
+            search_in="body" check_it="true" assign_to="1"/>
+      <test assign_to="1" variable="1" compare="equal" value=""/>
+    </action>
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK 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]SIPpTag00[call_number]
+      To: sut <sip:[service]@[remote_ip]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 ACK
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+<!-- Normal re-INIVTE, Asterisk should return negotiated codecs -->
+  <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:[service]@[remote_ip]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 3 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 8
+      a=rtpmap:8 PCMA/8000
+      a=rtpmap:0 PCMU/8000
+      a=ptime:20
+
+    ]]>
+  </send>
+
+  <recv response="200" rtd="true">
+    <action>
+      <ereg regexp="m=audio [0-9]{1,5} RTP/AVP 8 0+..*"
+            search_in="body" check_it="true" assign_to="1"/>
+      <test assign_to="1" variable="1" compare="equal" value=""/>
+    </action>
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK 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]SIPpTag00[call_number]
+      To: sut <sip:[service]@[remote_ip]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 3 ACK
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+-->
+
+ <pause milliseconds="1000"/>
+
+  <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]SIPpTag00[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 4 BYE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+    ]]>
+  </send>
+
+  <recv response="200"/>
+
+</scenario>
diff --git a/tests/channels/pjsip/all_codecs_on_empty_reinvite/test-config.yaml b/tests/channels/pjsip/all_codecs_on_empty_reinvite/test-config.yaml
new file mode 100644
index 0000000..26bf933
--- /dev/null
+++ b/tests/channels/pjsip/all_codecs_on_empty_reinvite/test-config.yaml
@@ -0,0 +1,30 @@
+testinfo:
+    summary: 'Ensure correct operation regarding the all_codecs_on_empty_reinvite setting'
+    description: |
+        'A SIPp scenario places a call into Asterisk. Once the call has been answered, we
+        send an re-INVITE without SDP. Asterisk should send an SDP offer in the 200 OK
+        response containing all configured codecs on the endpoint if the parameter
+        all_codecs_on_empty_reinvite is activated. An re-INVITE with SDP should be
+        answered normally.'
+
+test-modules:
+    test-object:
+        config-section: sipp-config
+        typename: 'sipp.SIPpTestCase'
+
+sipp-config:
+    memcheck-delay-stop: 7
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'empty-reinvite-all-codecs.xml'}}
+
+properties:
+    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 b26439f..858e063 100644
--- a/tests/channels/pjsip/tests.yaml
+++ b/tests/channels/pjsip/tests.yaml
@@ -68,3 +68,4 @@
     - test: 'non_negotiated_frame_SSRC_change'
     - test: 'content_disposition'
     - test: 'reinvite_after_bye'
+    - test: 'all_codecs_on_empty_reinvite'

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

Gerrit-Project: testsuite
Gerrit-Branch: 20
Gerrit-Change-Id: I4ccbbe270358e993e023baf64b85f79fc2f9a594
Gerrit-Change-Number: 19500
Gerrit-PatchSet: 1
Gerrit-Owner: Henning Westerholt <hw at gilawa.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/20221027/f7980d9d/attachment-0001.html>


More information about the asterisk-code-review mailing list