<p>George Joseph <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/9039">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Jenkins2: Verified
  George Joseph: Looks good to me, approved; Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Add tests for app_sendtext with Basic and Enhanced Messaging<br><br>tests/apps/sendtext/basic:<br>  Using chan_sip check that a MESSAGE can be sent and that the body<br>  is preserved.<br><br>tests/apps/sendtext/enhanced:<br>  Using chan_pjsip checl that a MESSAGE can be sent and that the<br>  From display text, To display text, Content-Type and body are<br>  all present and correct.<br><br>Change-Id: I3fa71b09815c5a796b32a6559bd914c4b8733840<br>(cherry picked from commit 40f13abea5f41a0998f2bce01dbee6775ec063b2)<br>---<br>A tests/apps/sendtext/basic/configs/ast1/extensions.conf<br>A tests/apps/sendtext/basic/configs/ast1/sip.conf<br>A tests/apps/sendtext/basic/sipp/message_recv.xml<br>A tests/apps/sendtext/basic/test-config.yaml<br>A tests/apps/sendtext/enhanced/configs/ast1/extensions.conf<br>A tests/apps/sendtext/enhanced/configs/ast1/pjsip.conf<br>A tests/apps/sendtext/enhanced/sipp/message_recv.xml<br>A tests/apps/sendtext/enhanced/test-config.yaml<br>A tests/apps/sendtext/tests.yaml<br>M tests/apps/tests.yaml<br>10 files changed, 287 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/tests/apps/sendtext/basic/configs/ast1/extensions.conf b/tests/apps/sendtext/basic/configs/ast1/extensions.conf<br>new file mode 100644<br>index 0000000..71a0ce6<br>--- /dev/null<br>+++ b/tests/apps/sendtext/basic/configs/ast1/extensions.conf<br>@@ -0,0 +1,9 @@<br>+[general]<br>+<br>+[default]<br>+exten = sendtext,1,Answer()<br>+same = n,Set(SENDTEXT_BODY={"foo":666, "bar":"666"})<br>+; The body supplied in the parameter should be ignored.<br>+same = n,SendText({"abc":1, "def":"ghi"})<br>+same = n,Echo()<br>+same = n,Hangup()<br>diff --git a/tests/apps/sendtext/basic/configs/ast1/sip.conf b/tests/apps/sendtext/basic/configs/ast1/sip.conf<br>new file mode 100644<br>index 0000000..1d3f646<br>--- /dev/null<br>+++ b/tests/apps/sendtext/basic/configs/ast1/sip.conf<br>@@ -0,0 +1,17 @@<br>+[general]<br>+allowguest=no<br>+bindaddr=127.0.0.1<br>+sipdebug=yes<br>+directmedia=no<br>+<br>+[alice]<br>+type=peer<br>+context=default<br>+disallow=all<br>+allow=ulaw<br>+qualify=no<br>+insecure=port,invite<br>+nat=force_rport<br>+host=127.0.0.1<br>+port=5061<br>+<br>diff --git a/tests/apps/sendtext/basic/sipp/message_recv.xml b/tests/apps/sendtext/basic/sipp/message_recv.xml<br>new file mode 100644<br>index 0000000..fa08169<br>--- /dev/null<br>+++ b/tests/apps/sendtext/basic/sipp/message_recv.xml<br>@@ -0,0 +1,85 @@<br>+<?xml version="1.0" encoding="ISO-8859-1" ?><br>+<!DOCTYPE scenario SYSTEM "sipp.dtd"><br>+<br>+<scenario name="INVITE to echo with SDP in initial INVITE"><br>+<br>+    <Global variables="extn" /><br>+<br>+    <send><br>+    <![CDATA[<br>+      INVITE sip:[$extn]@[remote_ip]:[remote_port] SIP/2.0<br>+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]<br>+      From: "Alice" <sip:[service]@[local_ip]:[local_port]>;tag=SIPPID-[pid]-[call_number]<br>+      To: conf <sip:[$extn]@[remote_ip]:[remote_port]><br>+      Call-ID: [call_id]<br>+      CSeq: [cseq] INVITE<br>+      Contact: "Alice" <sip:[service]@[local_ip]:[local_port];transport=[transport]><br>+      Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, PRACK, REGISTER, REFER, MESSAGE<br>+      Content-Type: application/sdp<br>+      Content-Length: [len]<br>+<br>+      v=0<br>+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]<br>+      s=-<br>+      c=IN IP[media_ip_type] [media_ip]<br>+      t=0 0<br>+      m=audio 6000 RTP/AVP 0<br>+      a=rtpmap:0 PCMU/8000<br>+    ]]><br>+    </send><br>+<br>+    <recv response="100" optional="true" /><br>+    <recv response="200" /><br>+<br>+    <send><br>+    <![CDATA[<br>+      ACK sip:[$extn]@[remote_ip]:[remote_port] SIP/2.0<br>+      [last_Via:]<br>+      [last_From:]<br>+      [last_To:]<br>+      [last_Call-ID:]<br>+      CSeq: [cseq] ACK<br>+      [last_Contact:]<br>+      [last_Allow:]<br>+      Content-Length: 0<br>+    ]]><br>+    </send><br>+<br>+    <recv request="MESSAGE" timeout="5000"><br>+        <action><br>+            <ereg regexp="\{\"foo\":666, \"bar\":\"666\"\}" search_in="body" check_it="true" assign_to="dummy"/><br>+        </action><br>+    </recv><br>+<br>+    <send><br>+    <![CDATA[<br>+      SIP/2.0 202 Accepted<br>+      [last_Via:]<br>+      [last_From:]<br>+      [last_To:]<br>+      [last_Call-ID:]<br>+      [last_CSeq:]<br>+      Allow: INVITE, ACK, MESSAGE, BYE<br>+      Content-Length: 0<br>+    ]]><br>+    </send><br>+<br>+    <pause milliseconds="2000"/><br>+<br>+    <send><br>+    <![CDATA[<br>+      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0<br>+      [last_Via:]<br>+      From: "Alice" <sip:[service]@[local_ip]:[local_port]>;tag=SIPPID-[pid]-[call_number]<br>+      To: conf <sip:[$extn]@[remote_ip]:[remote_port]>[peer_tag_param]<br>+      [last_Call-ID:]<br>+      CSeq: [cseq+1] BYE<br>+      [last_Contact:]<br>+      Content-Length: 0<br>+    ]]><br>+    </send><br>+<br>+    <recv response="200" /><br>+<br>+    <Reference variables="dummy" /><br>+</scenario><br>\ No newline at end of file<br>diff --git a/tests/apps/sendtext/basic/test-config.yaml b/tests/apps/sendtext/basic/test-config.yaml<br>new file mode 100644<br>index 0000000..aa903a9<br>--- /dev/null<br>+++ b/tests/apps/sendtext/basic/test-config.yaml<br>@@ -0,0 +1,25 @@<br>+testinfo:<br>+    summary: 'Test SendText with Basic Messaging'<br>+    description: |<br>+        Make a call and check that a MESSAGE is sent to the caller with the<br>+        appropriate content.<br>+<br>+properties:<br>+    dependencies:<br>+        - app : 'sipp'<br>+        - asterisk : 'app_sendtext'<br>+        - asterisk : 'chan_sip'<br>+    tags:<br>+        - sip<br>+<br>+test-modules:<br>+    test-object:<br>+        config-section: test-object-config<br>+        typename: 'sipp.SIPpTestCase'<br>+<br>+test-object-config:<br>+    test-iterations:<br>+        -<br>+            scenarios:<br>+               - { 'key-args': { 'scenario': 'message_recv.xml', '-p': '5061', '-s': 'alice' },<br>+                   'ordered-args': [ '-set', 'extn', 'sendtext' ] }<br>diff --git a/tests/apps/sendtext/enhanced/configs/ast1/extensions.conf b/tests/apps/sendtext/enhanced/configs/ast1/extensions.conf<br>new file mode 100644<br>index 0000000..e600589<br>--- /dev/null<br>+++ b/tests/apps/sendtext/enhanced/configs/ast1/extensions.conf<br>@@ -0,0 +1,12 @@<br>+[general]<br>+<br>+[default]<br>+exten = sendtext,1,Answer()<br>+same = n,Set(SENDTEXT_FROM_DISPLAYNAME=>From Someone Else)<br>+same = n,Set(SENDTEXT_TO_DISPLAYNAME=To Someone Else)<br>+same = n,Set(SENDTEXT_CONTENT_TYPE=text/json)<br>+same = n,Set(SENDTEXT_BODY={"foo":666, "bar":"666"})<br>+; The body supplied in the parameter should be ignored.<br>+same = n,SendText({"abc":1, "def":"ghi"})<br>+same = n,Echo()<br>+same = n,Hangup()<br>diff --git a/tests/apps/sendtext/enhanced/configs/ast1/pjsip.conf b/tests/apps/sendtext/enhanced/configs/ast1/pjsip.conf<br>new file mode 100644<br>index 0000000..b578de0<br>--- /dev/null<br>+++ b/tests/apps/sendtext/enhanced/configs/ast1/pjsip.conf<br>@@ -0,0 +1,19 @@<br>+[local]<br>+type=transport<br>+protocol=udp<br>+bind=0.0.0.0<br>+<br>+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br>+<br>+[alice]<br>+type=aor<br>+contact=sip:alice@127.0.0.1:5061<br>+max_contacts=1<br>+<br>+[alice]<br>+type=endpoint<br>+context=default<br>+aors=alice<br>+direct_media=no<br>+disallow=all<br>+allow=ulaw<br>diff --git a/tests/apps/sendtext/enhanced/sipp/message_recv.xml b/tests/apps/sendtext/enhanced/sipp/message_recv.xml<br>new file mode 100644<br>index 0000000..a1e10af<br>--- /dev/null<br>+++ b/tests/apps/sendtext/enhanced/sipp/message_recv.xml<br>@@ -0,0 +1,88 @@<br>+<?xml version="1.0" encoding="ISO-8859-1" ?><br>+<!DOCTYPE scenario SYSTEM "sipp.dtd"><br>+<br>+<scenario name="INVITE to echo with SDP in initial INVITE"><br>+<br>+    <Global variables="extn" /><br>+<br>+    <send><br>+    <![CDATA[<br>+      INVITE sip:[$extn]@[remote_ip]:[remote_port] SIP/2.0<br>+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]<br>+      From: "Alice" <sip:[service]@[local_ip]:[local_port]>;tag=SIPPID-[pid]-[call_number]<br>+      To: conf <sip:[$extn]@[remote_ip]:[remote_port]><br>+      Call-ID: [call_id]<br>+      CSeq: [cseq] INVITE<br>+      Contact: "Alice" <sip:[service]@[local_ip]:[local_port];transport=[transport]><br>+      Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, PRACK, REGISTER, REFER, MESSAGE<br>+      Content-Type: application/sdp<br>+      Content-Length: [len]<br>+<br>+      v=0<br>+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]<br>+      s=-<br>+      c=IN IP[media_ip_type] [media_ip]<br>+      t=0 0<br>+      m=audio 6000 RTP/AVP 0<br>+      a=rtpmap:0 PCMU/8000<br>+    ]]><br>+    </send><br>+<br>+    <recv response="100" optional="true" /><br>+    <recv response="200" /><br>+<br>+    <send><br>+    <![CDATA[<br>+      ACK sip:[$extn]@[remote_ip]:[remote_port] SIP/2.0<br>+      [last_Via:]<br>+      [last_From:]<br>+      [last_To:]<br>+      [last_Call-ID:]<br>+      CSeq: [cseq] ACK<br>+      [last_Contact:]<br>+      [last_Allow:]<br>+      Content-Length: 0<br>+    ]]><br>+    </send><br>+<br>+    <recv request="MESSAGE" timeout="5000"><br>+        <action><br>+            <ereg regexp="From Someone Else" search_in="hdr" header="From:" check_it="true" assign_to="dummy"/><br>+            <ereg regexp="To Someone Else" search_in="hdr" header="To:" check_it="true" assign_to="dummy"/><br>+            <ereg regexp="text/json" search_in="hdr" header="Content-Type:" check_it="true" assign_to="dummy"/><br>+            <ereg regexp="\{\"foo\":666, \"bar\":\"666\"\}" search_in="body" check_it="true" assign_to="dummy"/><br>+        </action><br>+    </recv><br>+<br>+    <send><br>+    <![CDATA[<br>+      SIP/2.0 202 Accepted<br>+      [last_Via:]<br>+      [last_From:]<br>+      [last_To:]<br>+      [last_Call-ID:]<br>+      [last_CSeq:]<br>+      Allow: INVITE, ACK, MESSAGE, BYE<br>+      Content-Length: 0<br>+    ]]><br>+    </send><br>+<br>+    <pause milliseconds="2000"/><br>+<br>+    <send><br>+    <![CDATA[<br>+      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0<br>+      [last_Via:]<br>+      From: "Alice" <sip:[service]@[local_ip]:[local_port]>;tag=SIPPID-[pid]-[call_number]<br>+      To: conf <sip:[$extn]@[remote_ip]:[remote_port]>[peer_tag_param]<br>+      [last_Call-ID:]<br>+      CSeq: [cseq+1] BYE<br>+      [last_Contact:]<br>+      Content-Length: 0<br>+    ]]><br>+    </send><br>+<br>+    <recv response="200" /><br>+<br>+    <Reference variables="dummy" /><br>+</scenario><br>\ No newline at end of file<br>diff --git a/tests/apps/sendtext/enhanced/test-config.yaml b/tests/apps/sendtext/enhanced/test-config.yaml<br>new file mode 100644<br>index 0000000..a3243b6<br>--- /dev/null<br>+++ b/tests/apps/sendtext/enhanced/test-config.yaml<br>@@ -0,0 +1,27 @@<br>+testinfo:<br>+    summary: 'Test SendText with Enhanced Messaging'<br>+    description: |<br>+        Make a call and check that a MESSAGE is sent to the caller with the<br>+        appropriate content.<br>+<br>+properties:<br>+    dependencies:<br>+        - app : 'sipp'<br>+        - asterisk : 'app_sendtext'<br>+        - asterisk : 'chan_pjsip'<br>+        - asterisk : 'res_pjsip'<br>+        - asterisk : 'res_pjsip_messaging'<br>+    tags:<br>+        - pjsip<br>+<br>+test-modules:<br>+    test-object:<br>+        config-section: test-object-config<br>+        typename: 'sipp.SIPpTestCase'<br>+<br>+test-object-config:<br>+    test-iterations:<br>+        -<br>+            scenarios:<br>+               - { 'key-args': { 'scenario': 'message_recv.xml', '-p': '5061', '-s': 'alice' },<br>+                   'ordered-args': [ '-set', 'extn', 'sendtext' ] }<br>diff --git a/tests/apps/sendtext/tests.yaml b/tests/apps/sendtext/tests.yaml<br>new file mode 100644<br>index 0000000..83dfbe4<br>--- /dev/null<br>+++ b/tests/apps/sendtext/tests.yaml<br>@@ -0,0 +1,4 @@<br>+# Enter tests here in the order they should be considered for execution:<br>+tests:<br>+    - test: 'basic'<br>+    - test: 'enhanced'<br>diff --git a/tests/apps/tests.yaml b/tests/apps/tests.yaml<br>index 19163d4..c4cd96a 100644<br>--- a/tests/apps/tests.yaml<br>+++ b/tests/apps/tests.yaml<br>@@ -22,3 +22,4 @@<br>     - test: 'channel_redirect'<br>     - dir: 'disa'<br>     - dir: 'authenticate'<br>+    - dir: 'sendtext'<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9039">change 9039</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/9039"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: testsuite </div>
<div style="display:none"> Gerrit-Branch: 13.21 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I3fa71b09815c5a796b32a6559bd914c4b8733840 </div>
<div style="display:none"> Gerrit-Change-Number: 9039 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>