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

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">testsuite:  Add test for incoming MWI NOTIFYs<br><br>Change-Id: Ia2ccc72d4e8f7382423c267334284b66cd4306e1<br>---<br>A tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/configs/ast1/cli.conf<br>A tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/configs/ast1/pjsip.conf<br>A tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/sipp/allowed.xml<br>A tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/sipp/not_allowed.xml<br>A tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/test-config.yaml<br>M tests/channels/pjsip/subscriptions/mwi/unsolicited/tests.yaml<br>6 files changed, 165 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/configs/ast1/cli.conf b/tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/configs/ast1/cli.conf<br>new file mode 100644<br>index 0000000..ea5f114<br>--- /dev/null<br>+++ b/tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/configs/ast1/cli.conf<br>@@ -0,0 +1,3 @@<br>+[startup_commands]<br>+core set debug res_pjsip_pubsub 4 = yes<br>+<br>diff --git a/tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/configs/ast1/pjsip.conf b/tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/configs/ast1/pjsip.conf<br>new file mode 100644<br>index 0000000..5fed981<br>--- /dev/null<br>+++ b/tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/configs/ast1/pjsip.conf<br>@@ -0,0 +1,29 @@<br>+[local-transport]<br>+type=transport<br>+bind=127.0.0.1<br>+protocol=udp<br>+<br>+[allowed]<br>+type=endpoint<br>+allow=g722,ulaw,alaw<br>+context=default<br>+aors=allowed<br>+incoming_mwi_mailbox=allowed@default<br>+<br>+[not_allowed]<br>+type=endpoint<br>+allow=g722,ulaw,alaw<br>+context=default<br>+aors=not_allowed<br>+<br>+[allowed]<br>+type = aor<br>+max_contacts = 1<br>+contact = sip:127.0.0.1:5061<br>+<br>+[not_allowed]<br>+type = aor<br>+max_contacts = 1<br>+contact = sip:127.0.0.1:5062<br>+<br>+<br>diff --git a/tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/sipp/allowed.xml b/tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/sipp/allowed.xml<br>new file mode 100644<br>index 0000000..884b453<br>--- /dev/null<br>+++ b/tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/sipp/allowed.xml<br>@@ -0,0 +1,31 @@<br>+<?xml version="1.0" encoding="ISO-8859-1" ?><br>+<!DOCTYPE scenario SYSTEM "sipp.dtd"><br>+<br>+<scenario name="Basic Sipstone UAC"><br>+<br>+    <send retrans="500"><br>+           <![CDATA[<br>+<br>+NOTIFY sip:[service]@[remote_ip]:[remote_port] SIP/2.0<br>+Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]<br>+From: "[service]" <sip:[service]@[local_ip]:[local_port]><br>+To: "[service]" <sip:[service]@[remote_ip]:[remote_port]><br>+Contact: <sip:[service]@[local_ip]:[local_port]><br>+Call-ID: [call_id]<br>+CSeq: 6 NOTIFY<br>+Subscription-State: terminated<br>+Event: message-summary<br>+Allow-Events: presence, dialog, message-summary, refer<br>+Max-Forwards: 70<br>+User-Agent: Asterisk PBX 13.1.0-6.5.2.rl.1500488122.d0054c3<br>+Content-Type: application/simple-message-summary<br>+Content-Length: [len]<br>+<br>+Messages-Waiting: no<br>+Message-Account: sip:[service]@default.com<br>+Voice-Message: 7/2 (3/6)<br>+<br>+]]><br>+      </send><br>+<br>+    <recv response="200" crlf="true"/><br>diff --git a/tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/sipp/not_allowed.xml b/tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/sipp/not_allowed.xml<br>new file mode 100644<br>index 0000000..4f415e1<br>--- /dev/null<br>+++ b/tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/sipp/not_allowed.xml<br>@@ -0,0 +1,31 @@<br>+<?xml version="1.0" encoding="ISO-8859-1" ?><br>+<!DOCTYPE scenario SYSTEM "sipp.dtd"><br>+<br>+<scenario name="Basic Sipstone UAC"><br>+<br>+    <send retrans="500"><br>+                <![CDATA[<br>+<br>+NOTIFY sip:[service]@[remote_ip]:[remote_port] SIP/2.0<br>+Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]<br>+From: "[service]" <sip:[service]@[local_ip]:[local_port]><br>+To: "[service]" <sip:[service]@[remote_ip]:[remote_port]><br>+Contact: <sip:[service]@[local_ip]:[local_port]><br>+Call-ID: [call_id]<br>+CSeq: 6 NOTIFY<br>+Subscription-State: terminated<br>+Event: message-summary<br>+Allow-Events: presence, dialog, message-summary, refer<br>+Max-Forwards: 70<br>+User-Agent: Asterisk PBX 13.1.0-6.5.2.rl.1500488122.d0054c3<br>+Content-Type: application/simple-message-summary<br>+Content-Length: [len]<br>+<br>+Messages-Waiting: no<br>+Message-Account: sip:[service]@default.com<br>+Voice-Message: 7/2 (3/6)<br>+<br>+]]><br>+      </send><br>+<br>+    <recv response="404" crlf="true"/><br>diff --git a/tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/test-config.yaml b/tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/test-config.yaml<br>new file mode 100644<br>index 0000000..d554985<br>--- /dev/null<br>+++ b/tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/test-config.yaml<br>@@ -0,0 +1,70 @@<br>+testinfo:<br>+    summary: 'Ensure that an incoming MWI NOTIFY triggers the proper stasis push'<br>+    description: |<br>+        'This test runs a SIPp scenario that sends an MWI NOTIFY to Asterisk and<br>+        ensures that the proper event is generated with the correct message<br>+        counts and message account when endpoint->incoming_mwi_mailbox is set<br>+        and that no event is generated when endpoint->incoming_mwi_mailbox is<br>+        NOT set.'<br>+<br>+test-modules:<br>+    test-object:<br>+        config-section: sipp-config<br>+        typename: 'sipp.SIPpTestCase'<br>+    modules:<br>+        -<br>+            config-section: ami-action-config<br>+            typename: 'pluggable_modules.EventActionModule'<br>+<br>+sipp-config:<br>+    connect-ami: True<br>+    reactor-timeout: 15<br>+    fail-on-any: True<br>+    stop-after-scenarios: False<br>+    test-iterations:<br>+        -<br>+            scenarios:<br>+#   Kick both sipp scenarios off at the same time since they're hitting different endpoints<br>+                - {'key-args': { 'scenario': 'allowed.xml', '-s': 'allowed', '-p': '5061' }}<br>+                - {'key-args': { 'scenario': 'not_allowed.xml', '-s': 'not_allowed', '-p': '5062' }}<br>+<br>+ami-action-config:<br>+    -<br>+        ami-events:<br>+            conditions:<br>+                match:<br>+                    Event: 'TestEvent'<br>+                    State: 'PUBSUB_INCOMING_MWI_PUBLISH'<br>+                    Endpoint: 'allowed'<br>+            requirements:<br>+                match:<br>+                    Mailbox: 'allowed@default'<br>+                    MessageAccount: 'sip:allowed@default.com'<br>+                    VoiceMessagesNew: '7'<br>+                    VoiceMessagesOld: '2'<br>+                    VoiceMessagesUrgentNew: '3'<br>+                    VoiceMessagesUrgentOld: '6'<br>+            count: 1<br>+    -<br>+        ami-events:<br>+            conditions:<br>+                match:<br>+                    Event: 'TestEvent'<br>+                    State: 'PUBSUB_NO_INCOMING_MWI_MAILBOX'<br>+                    Endpoint: 'not_allowed'<br>+            count: 1<br>+        stop_test:<br>+<br>+properties:<br>+    minversion: [ '13.18.0', '14.7.0', '15.1.0' ]<br>+    dependencies:<br>+        - python: 'twisted'<br>+        - python: 'starpy'<br>+        - asterisk: 'res_pjsip'<br>+        - asterisk: 'res_pjsip_pubsub'<br>+        - asterisk: 'res_pjsip_mwi'<br>+        - asterisk: 'res_mwi_external'<br>+        - asterisk: 'res_mwi_external_ami'<br>+    tags:<br>+        - pjsip<br>+        - mwi_external<br>diff --git a/tests/channels/pjsip/subscriptions/mwi/unsolicited/tests.yaml b/tests/channels/pjsip/subscriptions/mwi/unsolicited/tests.yaml<br>index 29a156c..deb7775 100644<br>--- a/tests/channels/pjsip/subscriptions/mwi/unsolicited/tests.yaml<br>+++ b/tests/channels/pjsip/subscriptions/mwi/unsolicited/tests.yaml<br>@@ -4,3 +4,4 @@<br>     - test: 'initial_notify'<br>     - test: 'notify_after_register'<br>     - test: 'notify_after_register_realtime'<br>+    - test: 'incoming'<br>\ No newline at end of file<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6484">change 6484</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/6484"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: testsuite </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ia2ccc72d4e8f7382423c267334284b66cd4306e1 </div>
<div style="display:none"> Gerrit-Change-Number: 6484 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </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>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>