[Asterisk-code-review] pjsip: Add test for changing video stream to unidirectional. (testsuite[17])
Friendly Automation
asteriskteam at digium.com
Wed Mar 25 07:26:20 CDT 2020
Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/testsuite/+/13986 )
Change subject: pjsip: Add test for changing video stream to unidirectional.
......................................................................
pjsip: Add test for changing video stream to unidirectional.
This test establishes a two-party call and then adds video.
Once video is added one party decides to only become a
receiver of video. The test ensures that the other party
receives a re-INVITE so that it is only a sender of video
to Asterisk.
ASTERISK-28783
Change-Id: I20ec1c9111952fada3ff2fcd124a28a334eb5efd
---
M tests/channels/pjsip/basic_calls/two_parties/nominal/tests.yaml
A tests/channels/pjsip/basic_calls/two_parties/nominal/video_bidirectional_to_unidirectional/configs/ast1/extensions.conf
A tests/channels/pjsip/basic_calls/two_parties/nominal/video_bidirectional_to_unidirectional/configs/ast1/pjsip.conf
A tests/channels/pjsip/basic_calls/two_parties/nominal/video_bidirectional_to_unidirectional/sipp/alice.xml
A tests/channels/pjsip/basic_calls/two_parties/nominal/video_bidirectional_to_unidirectional/sipp/bob.xml
A tests/channels/pjsip/basic_calls/two_parties/nominal/video_bidirectional_to_unidirectional/test-config.yaml
6 files changed, 417 insertions(+), 0 deletions(-)
Approvals:
George Joseph: Looks good to me, but someone else must approve
Benjamin Keith Ford: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved
Friendly Automation: Approved for Submit
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 6a6fd71..d376f5a 100644
--- a/tests/channels/pjsip/basic_calls/two_parties/nominal/tests.yaml
+++ b/tests/channels/pjsip/basic_calls/two_parties/nominal/tests.yaml
@@ -2,3 +2,4 @@
- dir: 'alice_initiated'
- test: 'two_servers'
- test: 'add_remove_sources'
+ - test: 'video_bidirectional_to_unidirectional'
diff --git a/tests/channels/pjsip/basic_calls/two_parties/nominal/video_bidirectional_to_unidirectional/configs/ast1/extensions.conf b/tests/channels/pjsip/basic_calls/two_parties/nominal/video_bidirectional_to_unidirectional/configs/ast1/extensions.conf
new file mode 100644
index 0000000..aa80d3c
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/nominal/video_bidirectional_to_unidirectional/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_bidirectional_to_unidirectional/configs/ast1/pjsip.conf b/tests/channels/pjsip/basic_calls/two_parties/nominal/video_bidirectional_to_unidirectional/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..c82ab09
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/nominal/video_bidirectional_to_unidirectional/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_bidirectional_to_unidirectional/sipp/alice.xml b/tests/channels/pjsip/basic_calls/two_parties/nominal/video_bidirectional_to_unidirectional/sipp/alice.xml
new file mode 100644
index 0000000..fa1a758
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/nominal/video_bidirectional_to_unidirectional/sipp/alice.xml
@@ -0,0 +1,184 @@
+<?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
+
+ ]]>
+ </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=recvonly
+
+ ]]>
+ </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_bidirectional_to_unidirectional/sipp/bob.xml b/tests/channels/pjsip/basic_calls/two_parties/nominal/video_bidirectional_to_unidirectional/sipp/bob.xml
new file mode 100644
index 0000000..0461dad
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/nominal/video_bidirectional_to_unidirectional/sipp/bob.xml
@@ -0,0 +1,148 @@
+<?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="m=video [0-9]{1,5} RTP/AVP 99+..*"
+ 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
+
+ ]]>
+ </send>
+
+ <recv request="ACK"
+ rtd="true"
+ crlf="true">
+ </recv>
+
+ <recv request="INVITE" crlf="true">
+ <action>
+ <ereg regexp="a=recvonly"
+ 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=sendonly
+
+ ]]>
+ </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_bidirectional_to_unidirectional/test-config.yaml b/tests/channels/pjsip/basic_calls/two_parties/nominal/video_bidirectional_to_unidirectional/test-config.yaml
new file mode 100644
index 0000000..4dba78c
--- /dev/null
+++ b/tests/channels/pjsip/basic_calls/two_parties/nominal/video_bidirectional_to_unidirectional/test-config.yaml
@@ -0,0 +1,42 @@
+testinfo:
+ summary: 'Test changing a bidirectional video stream to unidirectional 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 bidirectional to
+ unidirectional, so they are only a receiver. The test confirms that the called
+ party is reinvited initially to add a bidirectional video stream and then again
+ to turn it into a unidirectional stream with video going to Asterisk. 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/+/13986
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: testsuite
Gerrit-Branch: 17
Gerrit-Change-Id: I20ec1c9111952fada3ff2fcd124a28a334eb5efd
Gerrit-Change-Number: 13986
Gerrit-PatchSet: 2
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200325/63c415ec/attachment-0001.html>
More information about the asterisk-code-review
mailing list