[Asterisk-code-review] pjsip: Add test for changing video stream to bidirectional. (testsuite[16])

Joshua Colp asteriskteam at digium.com
Wed Mar 25 17:22:16 CDT 2020


Joshua Colp has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/14027 )


Change subject: pjsip: Add test for changing video stream to bidirectional.
......................................................................

pjsip: Add test for changing video stream to bidirectional.

This test establishes a two-party call and then adds video.
Starting out the video stream is unidirectional but then
the sender decides they also want to become a receiver.
The test ensures that the other party receives a re-INVITE
so that it becomes a sender of video as well.

ASTERISK-28783

Change-Id: Ifa07271fd767195cbe5faa79bff2683737f8d774
---
M tests/channels/pjsip/basic_calls/two_parties/nominal/tests.yaml
A tests/channels/pjsip/basic_calls/two_parties/nominal/video_unidirectional_to_bidirectional/configs/ast1/extensions.conf
A tests/channels/pjsip/basic_calls/two_parties/nominal/video_unidirectional_to_bidirectional/configs/ast1/pjsip.conf
A tests/channels/pjsip/basic_calls/two_parties/nominal/video_unidirectional_to_bidirectional/sipp/alice.xml
A tests/channels/pjsip/basic_calls/two_parties/nominal/video_unidirectional_to_bidirectional/sipp/bob.xml
A tests/channels/pjsip/basic_calls/two_parties/nominal/video_unidirectional_to_bidirectional/test-config.yaml
6 files changed, 419 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/27/14027/1

diff --git a/tests/channels/pjsip/basic_calls/two_parties/nominal/tests.yaml b/tests/channels/pjsip/basic_calls/two_parties/nominal/tests.yaml
index d376f5a..c1a38eb 100644
--- a/tests/channels/pjsip/basic_calls/two_parties/nominal/tests.yaml
+++ b/tests/channels/pjsip/basic_calls/two_parties/nominal/tests.yaml
@@ -3,3 +3,4 @@
     - test: 'two_servers'
     - test: 'add_remove_sources'
     - test: 'video_bidirectional_to_unidirectional'
+    - test: 'video_unidirectional_to_bidirectional'
diff --git a/tests/channels/pjsip/basic_calls/two_parties/nominal/video_unidirectional_to_bidirectional/configs/ast1/extensions.conf b/tests/channels/pjsip/basic_calls/two_parties/nominal/video_unidirectional_to_bidirectional/configs/ast1/extensions.conf
new file mode 100644
index 0000000..aa80d3c
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/nominal/video_unidirectional_to_bidirectional/configs/ast1/extensions.conf
@@ -0,0 +1,8 @@
+[general]
+
+[globals]
+
+[calling]
+exten => bob,1,NoOp()
+	same => n,Dial(PJSIP/bob)
+	same => n,Hangup()
diff --git a/tests/channels/pjsip/basic_calls/two_parties/nominal/video_unidirectional_to_bidirectional/configs/ast1/pjsip.conf b/tests/channels/pjsip/basic_calls/two_parties/nominal/video_unidirectional_to_bidirectional/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..c82ab09
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/nominal/video_unidirectional_to_bidirectional/configs/ast1/pjsip.conf
@@ -0,0 +1,34 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=alice
+
+[bob]
+type=endpoint
+allow=g722,ulaw,alaw,h264
+context=calling
+direct_media=no
+media_address=127.0.0.1
+aors=bob
+
+[bob]
+type=aor
+max_contacts=1
+contact=sip:bob at 127.0.0.3:5060\;transport=udp
diff --git a/tests/channels/pjsip/basic_calls/two_parties/nominal/video_unidirectional_to_bidirectional/sipp/alice.xml b/tests/channels/pjsip/basic_calls/two_parties/nominal/video_unidirectional_to_bidirectional/sipp/alice.xml
new file mode 100644
index 0000000..2171e2e
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/nominal/video_unidirectional_to_bidirectional/sipp/alice.xml
@@ -0,0 +1,185 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<scenario name="Send Call">
+
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag[call_number]
+      To: <sip:[service]@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: [cseq] INVITE
+      Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=- 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [custom_media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv response="100" optional="true" />
+  <recv response="180" optional="true" />
+  <recv response="183" optional="true" />
+
+  <recv response="200" rtd="true">
+    <!-- Save the To tag. We'll need it when we send REFER -->
+    <action>
+      <ereg regexp="(;tag=.*)"
+          header="To:"
+          search_in="hdr"
+          check_it="true"
+          assign_to="remote_tag"/>
+    </action>
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      Call-ID: [call_id]
+      CSeq: [cseq] ACK
+      Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <pause milliseconds="1000" />
+
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      [last_Via:]2
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      CSeq: [cseq] INVITE
+      Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=- 53655765 2353687638 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [custom_media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+      m=video 6002 RTP/AVP 96
+      a=rtpmap:96 H264/90000
+      a=sendonly
+
+    ]]>
+  </send>
+
+  <recv response="100" optional="true" />
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      [last_Via:]2
+      [last_From:]
+      [last_To:]
+      Call-ID: [call_id]
+      CSeq: [cseq] ACK
+      Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <pause milliseconds="1000" />
+
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      [last_Via:]2
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      CSeq: [cseq] INVITE
+      Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=- 53655765 2353687639 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [custom_media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+      m=video 6002 RTP/AVP 96
+      a=rtpmap:96 H264/90000
+      a=sendrecv
+
+    ]]>
+  </send>
+
+  <recv response="100" optional="true" />
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      [last_Via:]2
+      [last_From:]
+      [last_To:]
+      Call-ID: [call_id]
+      CSeq: [cseq] ACK
+      Contact: <sip:alice@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <pause milliseconds="1000" />
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      [last_Via:]4
+      From: <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag[call_number]
+      To: <sip:[service]@[remote_ip]:[remote_port]>[$remote_tag]
+      Call-ID: [call_id]
+      CSeq: [cseq] BYE
+      Contact: sip:alice@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" crlf="true">
+  </recv>
+
+</scenario>
diff --git a/tests/channels/pjsip/basic_calls/two_parties/nominal/video_unidirectional_to_bidirectional/sipp/bob.xml b/tests/channels/pjsip/basic_calls/two_parties/nominal/video_unidirectional_to_bidirectional/sipp/bob.xml
new file mode 100644
index 0000000..a6a1722
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/nominal/video_unidirectional_to_bidirectional/sipp/bob.xml
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic UAS responder">
+
+  <recv request="INVITE" crlf="true" />
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 180 Ringing
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:bob@[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:bob@[local_ip]:[local_port];transport=[transport]>
+      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 [custom_media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv request="ACK"
+    rtd="true"
+    crlf="true">
+  </recv>
+
+  <recv request="INVITE" crlf="true">
+    <action>
+      <ereg regexp="a=sendonly"
+            search_in="body" check_it="true" assign_to="1"/>
+      <test assign_to="1" variable="1" compare="equal" value=""/>
+    </action>
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:bob@[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687638 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [custom_media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+      m=video 5000 RTP/AVP 99
+      a=rtpmap:99 H264/90000
+      a=recvonly
+
+    ]]>
+  </send>
+
+  <recv request="ACK"
+    rtd="true"
+    crlf="true">
+  </recv>
+
+  <recv request="INVITE" crlf="true">
+    <action>
+      <ereg regexp="a=sendrecv"
+            search_in="body" check_it="true" assign_to="2"/>
+      <test assign_to="2" variable="2" compare="equal" value=""/>
+    </action>
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:bob@[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687639 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [custom_media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+      m=video 5000 RTP/AVP 99
+      a=rtpmap:99 H264/90000
+      a=sendrecv
+
+    ]]>
+  </send>
+
+  <recv request="ACK"
+    rtd="true"
+    crlf="true">
+  </recv>
+
+  <recv request="BYE" />
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+</scenario>
+
diff --git a/tests/channels/pjsip/basic_calls/two_parties/nominal/video_unidirectional_to_bidirectional/test-config.yaml b/tests/channels/pjsip/basic_calls/two_parties/nominal/video_unidirectional_to_bidirectional/test-config.yaml
new file mode 100644
index 0000000..b38020b
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/nominal/video_unidirectional_to_bidirectional/test-config.yaml
@@ -0,0 +1,42 @@
+testinfo:
+    summary:     'Test changing a unidirectional video stream to bidirectional while in a two party call'
+    description: |
+        'A SIPp scenario calls into Asterisk and Asterisk then dials another. Once
+        answered the channels are placed into a bridge. The calling party adds a video
+        stream. The calling party then re-negotiates the stream from unidirectional to
+        bidirectional, so they both send and receive. The test confirms that the called
+        party is reinvited initially to add a unidirectional video stream and then again
+        to turn it into a bidirectional stream. Once completed the calling party hangs
+        up the call.'
+
+properties:
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+        - asterisk : 'app_dial'
+        - asterisk : 'res_pjsip'
+        - sipp :
+            version : 'v3.4.1'
+    tags:
+        - pjsip
+
+test-modules:
+    add-test-to-search-path: 'True'
+    test-object:
+        config-section: test-case-config
+        typename: 'sipp.SIPpTestCase'
+
+test-case-config:
+    memcheck-delay-stop: 7
+    connect-ami: 'True'
+    fail-on-any: False
+    test-iterations:
+        # First iteration
+        -
+            scenarios:
+                # Bob receives call from Alice
+                - { 'key-args': {'scenario': 'bob.xml', '-p': '5060', '-i': '127.0.0.3', '-s': 'alice', '-timeout': '20s', '-mi': '127.0.0.3'},
+                    'ordered-args': ['-timeout_error', '-key', 'custom_media_port', '6004'] }
+                # Alice calls Bob
+                - { 'key-args': {'scenario': 'alice.xml', '-p': '5060', '-i': '127.0.0.2', '-s': 'bob', '-timeout': '20s', '-mi': '127.0.0.2'},
+                    'ordered-args': ['-timeout_error', '-key', 'custom_media_port', '6004'] }

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

Gerrit-Project: testsuite
Gerrit-Branch: 16
Gerrit-Change-Id: Ifa07271fd767195cbe5faa79bff2683737f8d774
Gerrit-Change-Number: 14027
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200325/6a394667/attachment-0001.html>


More information about the asterisk-code-review mailing list