[Asterisk-code-review] pjsip/message: Add test for passing message through confbridge (testsuite[13.21])
George Joseph
asteriskteam at digium.com
Wed May 23 08:44:20 CDT 2018
George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/9037
Change subject: pjsip/message: Add test for passing message through confbridge
......................................................................
pjsip/message: Add test for passing message through confbridge
Alice and Bob call a confbridge. Alice waits a few seconds to make sure
Bob is in the bridge then sends an in-dialog MESSAGE with a text/html
body. Bob gets the MESSAGE and verifies that Content-Type was preserved
and that the body is intact.
Change-Id: Icde9beeb210ba42be5d9bc391f0e3ab6c11c3479
(cherry picked from commit 3fd342d085a38c8ff86da415c87ad230a2583ed1)
---
A tests/channels/pjsip/message/message_confbridge/configs/ast1/confbridge.conf
A tests/channels/pjsip/message/message_confbridge/configs/ast1/extensions.conf
A tests/channels/pjsip/message/message_confbridge/configs/ast1/pjsip.conf
A tests/channels/pjsip/message/message_confbridge/sipp/message_recv.xml
A tests/channels/pjsip/message/message_confbridge/sipp/message_send.xml
A tests/channels/pjsip/message/message_confbridge/test-config.yaml
M tests/channels/pjsip/message/tests.yaml
7 files changed, 284 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/37/9037/1
diff --git a/tests/channels/pjsip/message/message_confbridge/configs/ast1/confbridge.conf b/tests/channels/pjsip/message/message_confbridge/configs/ast1/confbridge.conf
new file mode 100644
index 0000000..c92b171
--- /dev/null
+++ b/tests/channels/pjsip/message/message_confbridge/configs/ast1/confbridge.conf
@@ -0,0 +1,40 @@
+[general]
+
+[user_profile]
+type = user
+admin = no
+pin = 1111
+marked = yes
+startmuted = no
+announce_user_count = yes
+announce_user_count_all = 1
+announce_join_leave = yes
+
+[user_menu]
+type = menu
+1 = toggle_mute
+2 = leave_conference
+
+[admin_profile]
+type = user
+admin = yes
+pin = 2222
+marked = yes
+startmuted = yes
+announce_user_count = yes
+announce_user_count_all = 1
+announce_join_leave = yes
+
+[admin_menu]
+type = menu
+1 = toggle_mute
+2 = admin_toggle_conference_lock
+3 = leave_conference
+
+
+[default_bridge]
+type = bridge
+
+[default_user]
+type = user
+
diff --git a/tests/channels/pjsip/message/message_confbridge/configs/ast1/extensions.conf b/tests/channels/pjsip/message/message_confbridge/configs/ast1/extensions.conf
new file mode 100644
index 0000000..75494f4
--- /dev/null
+++ b/tests/channels/pjsip/message/message_confbridge/configs/ast1/extensions.conf
@@ -0,0 +1,6 @@
+[general]
+
+[default]
+exten = confbridge,1,Answer()
+same = n,ConfBridge(default_bridge)
+
diff --git a/tests/channels/pjsip/message/message_confbridge/configs/ast1/pjsip.conf b/tests/channels/pjsip/message/message_confbridge/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..df91cee
--- /dev/null
+++ b/tests/channels/pjsip/message/message_confbridge/configs/ast1/pjsip.conf
@@ -0,0 +1,34 @@
+[local]
+type=transport
+protocol=udp
+bind=0.0.0.0
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+[alice]
+type=aor
+contact=sip:alice at 127.0.0.1:5061
+max_contacts=1
+
+[alice]
+type=endpoint
+context=default
+aors=alice
+direct_media=no
+disallow=all
+allow=ulaw
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+[bob]
+type=aor
+contact=sip:bob at 127.0.0.1:5062
+max_contacts=1
+
+[bob]
+type=endpoint
+context=default
+aors=bob
+direct_media=no
+disallow=all
+allow=ulaw
diff --git a/tests/channels/pjsip/message/message_confbridge/sipp/message_recv.xml b/tests/channels/pjsip/message/message_confbridge/sipp/message_recv.xml
new file mode 100644
index 0000000..5af8837
--- /dev/null
+++ b/tests/channels/pjsip/message/message_confbridge/sipp/message_recv.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to echo with SDP in initial INVITE">
+
+ <Global variables="extn" />
+
+ <send>
+ <![CDATA[
+ INVITE sip:[$extn]@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: "Bob" <sip:[service]@[local_ip]:[local_port]>;tag=SIPPID-[pid]-[call_number]
+ To: conf <sip:[$extn]@[remote_ip]:[remote_port]>
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact: "Bob" <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+ Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, PRACK, REGISTER, REFER, MESSAGE
+ 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 response="200" />
+
+ <send>
+ <![CDATA[
+ ACK sip:[$extn]@[remote_ip]:[remote_port] SIP/2.0
+ [last_Via:]
+ [last_From:]
+ [last_To:]
+ [last_Call-ID:]
+ CSeq: [cseq] ACK
+ [last_Contact:]
+ [last_Allow:]
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <recv request="MESSAGE" timeout="15000">
+ <action>
+ <ereg regexp="text/html" search_in="hdr" header="Content-Type:" check_it="true" assign_to="dummy"/>
+ <ereg regexp="<head><body>this is a test</body></html>" search_in="body" check_it="true" assign_to="dummy"/>
+ </action>
+ </recv>
+
+ <send>
+ <![CDATA[
+ SIP/2.0 202 Accepted
+ [last_Via:]
+ [last_From:]
+ [last_To:]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Allow: INVITE, ACK, MESSAGE, BYE
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <send>
+ <![CDATA[
+ BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+ [last_Via:]
+ From: "Bob" <sip:[service]@[local_ip]:[local_port]>;tag=SIPPID-[pid]-[call_number]
+ To: conf <sip:[$extn]@[remote_ip]:[remote_port]>[peer_tag_param]
+ [last_Call-ID:]
+ CSeq: [cseq+1] BYE
+ [last_Contact:]
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <recv response="200" />
+
+ <Reference variables="dummy" />
+</scenario>
diff --git a/tests/channels/pjsip/message/message_confbridge/sipp/message_send.xml b/tests/channels/pjsip/message/message_confbridge/sipp/message_send.xml
new file mode 100644
index 0000000..0f64b9f
--- /dev/null
+++ b/tests/channels/pjsip/message/message_confbridge/sipp/message_send.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to echo with SDP in initial INVITE">
+
+ <Global variables="extn" />
+
+ <send>
+ <![CDATA[
+ INVITE sip:[$extn]@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: "Alice" <sip:[service]@[local_ip]:[local_port]>;tag=SIPPID-[pid]-[call_number]
+ To: conf <sip:[$extn]@[remote_ip]:[remote_port]>
+ Call-ID: [call_id]
+ CSeq: [cseq] INVITE
+ Contact: "Alice" <sip:[service]@[local_ip]:[local_port];transport=[transport]>
+ Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, PRACK, REGISTER, REFER, MESSAGE
+ 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 response="200"/>
+
+ <send>
+ <![CDATA[
+ ACK sip:[$extn]@[remote_ip]:[remote_port] SIP/2.0
+ [last_Via:]
+ [last_From:]
+ [last_To:]
+ [last_Call-ID:]
+ CSeq: [cseq] ACK
+ [last_Contact:]
+ [last_Allow:]
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <!-- Give the other scenario a chance to join the bridge -->
+ <pause milliseconds="5000" />
+
+ <send>
+ <![CDATA[
+ MESSAGE sip:[$extn]@[remote_ip]:[remote_port] SIP/2.0
+ [last_Via:]
+ [last_From:]
+ [last_To:]
+ [last_Call-ID:]
+ CSeq: [cseq+1] MESSAGE
+ [last_Contact:]
+ [last_Allow:]
+ Content-Type: text/html
+ Content-Length: [len]
+
+ <head><body>this is a test</body></html>
+ ]]>
+ </send>
+
+ <recv response="202" />
+
+ <pause milliseconds="2000"/>
+
+ <send>
+ <![CDATA[
+ BYE sip:[$extn]@[remote_ip]:[remote_port] SIP/2.0
+ [last_Via:]
+ [last_From:]
+ [last_To:]
+ [last_Call-ID:]
+ CSeq: [cseq+1] BYE
+ [last_Contact:]
+ Content-Length: 0
+ ]]>
+ </send>
+
+ <recv response="200" />
+
+</scenario>
diff --git a/tests/channels/pjsip/message/message_confbridge/test-config.yaml b/tests/channels/pjsip/message/message_confbridge/test-config.yaml
new file mode 100644
index 0000000..8501f72
--- /dev/null
+++ b/tests/channels/pjsip/message/message_confbridge/test-config.yaml
@@ -0,0 +1,32 @@
+testinfo:
+ summary: 'Test sending an in dialog MESSAGE to a confbridge.'
+ description: |
+ Alice and Bob call a confbridge. Alice waits a few seconds to make sure
+ Bob is in the bridge then sends an in-dialog MESSAGE with a text/html
+ body. Bob gets the MESSAGE and verifies that Content-Type was preserved
+ and that the body is intact.
+
+properties:
+ dependencies:
+ - app : 'sipp'
+ - asterisk : 'res_pjsip'
+ - asterisk : 'res_pjsip_messaging'
+ - asterisk : 'bridge_softmix'
+ - asterisk : 'app_confbridge'
+ tags:
+ - pjsip
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+ reactor-timeout: 20
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': { 'scenario': 'message_recv.xml', '-p': '5061', '-s': 'alice' },
+ 'ordered-args': [ '-set', 'extn', 'confbridge' ] }
+ - { 'key-args': { 'scenario': 'message_send.xml', '-p': '5062', '-s': 'bob' },
+ 'ordered-args': [ '-set', 'extn', 'confbridge' ] }
diff --git a/tests/channels/pjsip/message/tests.yaml b/tests/channels/pjsip/message/tests.yaml
index ff65d54..ab504d9 100644
--- a/tests/channels/pjsip/message/tests.yaml
+++ b/tests/channels/pjsip/message/tests.yaml
@@ -9,3 +9,4 @@
- test: 'message_retrans'
- test: 'message_send_ami'
- test: 'message_to_uri'
+ - test: 'message_confbridge'
--
To view, visit https://gerrit.asterisk.org/9037
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: testsuite
Gerrit-Branch: 13.21
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icde9beeb210ba42be5d9bc391f0e3ab6c11c3479
Gerrit-Change-Number: 9037
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180523/61fe1dab/attachment.html>
More information about the asterisk-code-review
mailing list