[Asterisk-code-review] testsuite: Add test for incoming MWI NOTIFYs (testsuite[master])

George Joseph asteriskteam at digium.com
Tue Sep 12 14:00:23 CDT 2017


George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/6484


Change subject: testsuite:  Add test for incoming MWI NOTIFYs
......................................................................

testsuite:  Add test for incoming MWI NOTIFYs

Change-Id: Ia2ccc72d4e8f7382423c267334284b66cd4306e1
---
A tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/configs/ast1/cli.conf
A tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/configs/ast1/pjsip.conf
A tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/sipp/allowed.xml
A tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/sipp/not_allowed.xml
A tests/channels/pjsip/subscriptions/mwi/unsolicited/incoming/test-config.yaml
M tests/channels/pjsip/subscriptions/mwi/unsolicited/tests.yaml
6 files changed, 166 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/84/6484/1

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

-- 
To view, visit https://gerrit.asterisk.org/6484
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia2ccc72d4e8f7382423c267334284b66cd4306e1
Gerrit-Change-Number: 6484
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/20170912/9e46a229/attachment-0001.html>


More information about the asterisk-code-review mailing list