[Asterisk-code-review] Add tests for app sendtext with Basic and Enhanced Messaging (testsuite[13.21])
George Joseph
asteriskteam at digium.com
Wed May 23 08:46:39 CDT 2018
George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/9039
Change subject: Add tests for app_sendtext with Basic and Enhanced Messaging
......................................................................
Add tests for app_sendtext with Basic and Enhanced Messaging
tests/apps/sendtext/basic:
Using chan_sip check that a MESSAGE can be sent and that the body
is preserved.
tests/apps/sendtext/enhanced:
Using chan_pjsip checl that a MESSAGE can be sent and that the
From display text, To display text, Content-Type and body are
all present and correct.
Change-Id: I3fa71b09815c5a796b32a6559bd914c4b8733840
(cherry picked from commit 40f13abea5f41a0998f2bce01dbee6775ec063b2)
---
A tests/apps/sendtext/basic/configs/ast1/extensions.conf
A tests/apps/sendtext/basic/configs/ast1/sip.conf
A tests/apps/sendtext/basic/sipp/message_recv.xml
A tests/apps/sendtext/basic/test-config.yaml
A tests/apps/sendtext/enhanced/configs/ast1/extensions.conf
A tests/apps/sendtext/enhanced/configs/ast1/pjsip.conf
A tests/apps/sendtext/enhanced/sipp/message_recv.xml
A tests/apps/sendtext/enhanced/test-config.yaml
A tests/apps/sendtext/tests.yaml
M tests/apps/tests.yaml
10 files changed, 287 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/39/9039/1
diff --git a/tests/apps/sendtext/basic/configs/ast1/extensions.conf b/tests/apps/sendtext/basic/configs/ast1/extensions.conf
new file mode 100644
index 0000000..71a0ce6
--- /dev/null
+++ b/tests/apps/sendtext/basic/configs/ast1/extensions.conf
@@ -0,0 +1,9 @@
+[general]
+
+[default]
+exten = sendtext,1,Answer()
+same = n,Set(SENDTEXT_BODY={"foo":666, "bar":"666"})
+; The body supplied in the parameter should be ignored.
+same = n,SendText({"abc":1, "def":"ghi"})
+same = n,Echo()
+same = n,Hangup()
diff --git a/tests/apps/sendtext/basic/configs/ast1/sip.conf b/tests/apps/sendtext/basic/configs/ast1/sip.conf
new file mode 100644
index 0000000..1d3f646
--- /dev/null
+++ b/tests/apps/sendtext/basic/configs/ast1/sip.conf
@@ -0,0 +1,17 @@
+[general]
+allowguest=no
+bindaddr=127.0.0.1
+sipdebug=yes
+directmedia=no
+
+[alice]
+type=peer
+context=default
+disallow=all
+allow=ulaw
+qualify=no
+insecure=port,invite
+nat=force_rport
+host=127.0.0.1
+port=5061
+
diff --git a/tests/apps/sendtext/basic/sipp/message_recv.xml b/tests/apps/sendtext/basic/sipp/message_recv.xml
new file mode 100644
index 0000000..fa08169
--- /dev/null
+++ b/tests/apps/sendtext/basic/sipp/message_recv.xml
@@ -0,0 +1,85 @@
+<?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>
+
+ <recv request="MESSAGE" timeout="5000">
+ <action>
+ <ereg regexp="\{\"foo\":666, \"bar\":\"666\"\}" 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>
+
+ <pause milliseconds="2000"/>
+
+ <send>
+ <![CDATA[
+ BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+ [last_Via:]
+ From: "Alice" <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>
\ No newline at end of file
diff --git a/tests/apps/sendtext/basic/test-config.yaml b/tests/apps/sendtext/basic/test-config.yaml
new file mode 100644
index 0000000..aa903a9
--- /dev/null
+++ b/tests/apps/sendtext/basic/test-config.yaml
@@ -0,0 +1,25 @@
+testinfo:
+ summary: 'Test SendText with Basic Messaging'
+ description: |
+ Make a call and check that a MESSAGE is sent to the caller with the
+ appropriate content.
+
+properties:
+ dependencies:
+ - app : 'sipp'
+ - asterisk : 'app_sendtext'
+ - asterisk : 'chan_sip'
+ tags:
+ - sip
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': { 'scenario': 'message_recv.xml', '-p': '5061', '-s': 'alice' },
+ 'ordered-args': [ '-set', 'extn', 'sendtext' ] }
diff --git a/tests/apps/sendtext/enhanced/configs/ast1/extensions.conf b/tests/apps/sendtext/enhanced/configs/ast1/extensions.conf
new file mode 100644
index 0000000..e600589
--- /dev/null
+++ b/tests/apps/sendtext/enhanced/configs/ast1/extensions.conf
@@ -0,0 +1,12 @@
+[general]
+
+[default]
+exten = sendtext,1,Answer()
+same = n,Set(SENDTEXT_FROM_DISPLAYNAME=From Someone Else)
+same = n,Set(SENDTEXT_TO_DISPLAYNAME=To Someone Else)
+same = n,Set(SENDTEXT_CONTENT_TYPE=text/json)
+same = n,Set(SENDTEXT_BODY={"foo":666, "bar":"666"})
+; The body supplied in the parameter should be ignored.
+same = n,SendText({"abc":1, "def":"ghi"})
+same = n,Echo()
+same = n,Hangup()
diff --git a/tests/apps/sendtext/enhanced/configs/ast1/pjsip.conf b/tests/apps/sendtext/enhanced/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..b578de0
--- /dev/null
+++ b/tests/apps/sendtext/enhanced/configs/ast1/pjsip.conf
@@ -0,0 +1,19 @@
+[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
diff --git a/tests/apps/sendtext/enhanced/sipp/message_recv.xml b/tests/apps/sendtext/enhanced/sipp/message_recv.xml
new file mode 100644
index 0000000..a1e10af
--- /dev/null
+++ b/tests/apps/sendtext/enhanced/sipp/message_recv.xml
@@ -0,0 +1,88 @@
+<?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>
+
+ <recv request="MESSAGE" timeout="5000">
+ <action>
+ <ereg regexp="From Someone Else" search_in="hdr" header="From:" check_it="true" assign_to="dummy"/>
+ <ereg regexp="To Someone Else" search_in="hdr" header="To:" check_it="true" assign_to="dummy"/>
+ <ereg regexp="text/json" search_in="hdr" header="Content-Type:" check_it="true" assign_to="dummy"/>
+ <ereg regexp="\{\"foo\":666, \"bar\":\"666\"\}" 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>
+
+ <pause milliseconds="2000"/>
+
+ <send>
+ <![CDATA[
+ BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+ [last_Via:]
+ From: "Alice" <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>
\ No newline at end of file
diff --git a/tests/apps/sendtext/enhanced/test-config.yaml b/tests/apps/sendtext/enhanced/test-config.yaml
new file mode 100644
index 0000000..a3243b6
--- /dev/null
+++ b/tests/apps/sendtext/enhanced/test-config.yaml
@@ -0,0 +1,27 @@
+testinfo:
+ summary: 'Test SendText with Enhanced Messaging'
+ description: |
+ Make a call and check that a MESSAGE is sent to the caller with the
+ appropriate content.
+
+properties:
+ dependencies:
+ - app : 'sipp'
+ - asterisk : 'app_sendtext'
+ - asterisk : 'chan_pjsip'
+ - asterisk : 'res_pjsip'
+ - asterisk : 'res_pjsip_messaging'
+ tags:
+ - pjsip
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': { 'scenario': 'message_recv.xml', '-p': '5061', '-s': 'alice' },
+ 'ordered-args': [ '-set', 'extn', 'sendtext' ] }
diff --git a/tests/apps/sendtext/tests.yaml b/tests/apps/sendtext/tests.yaml
new file mode 100644
index 0000000..83dfbe4
--- /dev/null
+++ b/tests/apps/sendtext/tests.yaml
@@ -0,0 +1,4 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+ - test: 'basic'
+ - test: 'enhanced'
diff --git a/tests/apps/tests.yaml b/tests/apps/tests.yaml
index 19163d4..c4cd96a 100644
--- a/tests/apps/tests.yaml
+++ b/tests/apps/tests.yaml
@@ -22,3 +22,4 @@
- test: 'channel_redirect'
- dir: 'disa'
- dir: 'authenticate'
+ - dir: 'sendtext'
--
To view, visit https://gerrit.asterisk.org/9039
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: testsuite
Gerrit-Branch: 13.21
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3fa71b09815c5a796b32a6559bd914c4b8733840
Gerrit-Change-Number: 9039
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/b844bf47/attachment-0001.html>
More information about the asterisk-code-review
mailing list