[Asterisk-code-review] mwi devstate: Add test for res mwi devstate (testsuite[13])

George Joseph asteriskteam at digium.com
Thu Feb 21 12:45:58 CST 2019


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


Change subject: mwi_devstate:  Add test for res_mwi_devstate
......................................................................

mwi_devstate:  Add test for res_mwi_devstate

ASTERISK-28301

Change-Id: Ia3d84b1261dc7492e433a7a7cc0c858dd125f557
---
A tests/channels/pjsip/subscriptions/mwi/mwi_devstate/configs/ast1/extensions.conf
A tests/channels/pjsip/subscriptions/mwi/mwi_devstate/configs/ast1/pjsip.conf
A tests/channels/pjsip/subscriptions/mwi/mwi_devstate/sipp/subscribe.xml
A tests/channels/pjsip/subscriptions/mwi/mwi_devstate/test-config.yaml
M tests/channels/pjsip/subscriptions/mwi/tests.yaml
5 files changed, 209 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/32/11032/1

diff --git a/tests/channels/pjsip/subscriptions/mwi/mwi_devstate/configs/ast1/extensions.conf b/tests/channels/pjsip/subscriptions/mwi/mwi_devstate/configs/ast1/extensions.conf
new file mode 100644
index 0000000..d7c3b22
--- /dev/null
+++ b/tests/channels/pjsip/subscriptions/mwi/mwi_devstate/configs/ast1/extensions.conf
@@ -0,0 +1,7 @@
+
+; This is how FreePBX does the voicemail hints.
+[app-dialvm]
+exten = alice,hint,MWI:alice at default
+
+[default]
+include = app-dialvm
diff --git a/tests/channels/pjsip/subscriptions/mwi/mwi_devstate/configs/ast1/pjsip.conf b/tests/channels/pjsip/subscriptions/mwi/mwi_devstate/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..d780db6
--- /dev/null
+++ b/tests/channels/pjsip/subscriptions/mwi/mwi_devstate/configs/ast1/pjsip.conf
@@ -0,0 +1,26 @@
+[local]
+type=transport
+protocol=udp
+bind=0.0.0.0
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+[endpoint_t](!)
+type=endpoint
+transport=local
+context=default
+aors=user1
+direct_media=no
+disallow=all
+allow=ulaw
+
+[aor_t](!)
+type=aor
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+[user1](aor_t)
+contact=sip:user1 at 127.0.0.1:5061
+
+[user1](endpoint_t)
+aors=user1
diff --git a/tests/channels/pjsip/subscriptions/mwi/mwi_devstate/sipp/subscribe.xml b/tests/channels/pjsip/subscriptions/mwi/mwi_devstate/sipp/subscribe.xml
new file mode 100644
index 0000000..d2c5876
--- /dev/null
+++ b/tests/channels/pjsip/subscriptions/mwi/mwi_devstate/sipp/subscribe.xml
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Subscribe MWI Presence">
+    <send retrans="500">
+        <![CDATA[
+        SUBSCRIBE sip:alice@[remote_ip]:[remote_port] SIP/2.0
+        Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch]
+        From: "user1" <sip:user1@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+        To: <sip:alice@[remote_ip]:[remote_port]>
+        Contact: <sip:user1@[local_ip]:[local_port]>
+        Call-ID: [call_id]
+        CSeq: [cseq] SUBSCRIBE
+        Max-Forwards: 70
+        Event: presence
+        Expires: 150
+        Supported: replaces, 100rel, timer, norefersub
+        Accept: application/pidf+xml, application/xpidf+xml, application/simple-message-summary
+        Allow-Events: presence, message-summary, refer
+        Content-Length: 0
+
+        ]]>
+    </send>
+
+    <recv response="200" rtd="true" />
+
+    <!-- Initial NOTIFY upon subscribing -->
+    <recv request="NOTIFY" crlf="true">
+        <action>
+            <ereg regexp=".*Unavailable.*closed.*" search_in="body" check_it="true" assign_to="0"/>
+        </action>
+    </recv>
+
+    <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+    </send>
+
+
+    <!-- NOTIFY upon MWI state change -->
+    <recv request="NOTIFY" crlf="true">
+        <action>
+            <ereg regexp=".*On the phone.*open.*" search_in="body" check_it="true" assign_to="0"/>
+        </action>
+    </recv>
+
+    <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+    </send>
+
+    <send retrans="500">
+        <![CDATA[
+        SUBSCRIBE sip:alice@[remote_ip]:[remote_port] SIP/2.0
+        Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch]
+        From: "user1" <sip:user1@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+        To: <sip:alice@[remote_ip]:[remote_port]>[peer_tag_param]
+        Contact: <sip:user1@[local_ip]:[local_port]>
+        Call-ID: [call_id]
+        CSeq: [cseq] SUBSCRIBE
+        Max-Forwards: 70
+        Event: presence
+        Expires: 0
+        Supported: replaces, 100rel, timer, norefersub
+        Accept: application/pidf+xml, application/xpidf+xml, application/simple-message-summary
+        Allow-Events: presence, message-summary, refer
+        Content-Length: 0
+
+        ]]>
+    </send>
+
+    <recv response="200" rtd="true" />
+
+    <!-- Final NOTIFY -->
+    <recv request="NOTIFY" crlf="true">
+        <action>
+            <ereg regexp=".*On the phone.*open.*" search_in="body" check_it="true" assign_to="0"/>
+        </action>
+    </recv>
+
+    <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+    </send>
+
+    <Reference variables="0"/>
+</scenario>
diff --git a/tests/channels/pjsip/subscriptions/mwi/mwi_devstate/test-config.yaml b/tests/channels/pjsip/subscriptions/mwi/mwi_devstate/test-config.yaml
new file mode 100644
index 0000000..6d4569f
--- /dev/null
+++ b/tests/channels/pjsip/subscriptions/mwi/mwi_devstate/test-config.yaml
@@ -0,0 +1,58 @@
+testinfo:
+    summary: 'Test res_mwi_devstate'
+    description: |
+        Tests the ability to subscribe to a voice mailbox with a presence event
+        instead of message-summary. This feature is provided by res_mwi_devstate
+        but the test also requires res_mwi_external_ami to set mailbox state.
+
+properties:
+    dependencies:
+        - buildoption: 'TEST_FRAMEWORK'
+        - sipp :
+            version : 'v3.0'
+        - asterisk : 'res_pjsip'
+        - asterisk : 'res_mwi_external'
+        - asterisk : 'res_mwi_external_ami'
+        - asterisk : 'res_mwi_devstate'
+
+    tags:
+        - pjsip
+        - mwi_external
+
+test-modules:
+    test-object:
+        config-section: sipp-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: 'ami-config'
+            typename: 'pluggable_modules.EventActionModule'
+
+sipp-config:
+    connect-ami: True
+    reactor-timeout: 15
+    fail-on-any: True
+    stop-after-scenarios: True
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'subscribe.xml', '-p': '5061'} }
+
+ami-config:
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'TestEvent'
+                    State: 'SUBSCRIPTION_ESTABLISHED'
+            requirements:
+                match:
+                    AppFile: 'res_pjsip_pubsub.c'
+            count: 1
+        ami-actions:
+            action:
+                Action: 'MWIUpdate'
+                ActionID: '12345'
+                Mailbox: 'alice at default'
+                OldMessages: '0'
+                NewMessages: '1'
diff --git a/tests/channels/pjsip/subscriptions/mwi/tests.yaml b/tests/channels/pjsip/subscriptions/mwi/tests.yaml
index 2769c1e..70b24dd 100644
--- a/tests/channels/pjsip/subscriptions/mwi/tests.yaml
+++ b/tests/channels/pjsip/subscriptions/mwi/tests.yaml
@@ -3,6 +3,7 @@
     - dir: 'unsolicited'
     - test: 'missing_aor'
     - test: 'mwi_aggregate'
+    - test: 'mwi_devstate'
     - test: 'no_accept_header'
     - test: 'sub_setup_teardown'
     - test: 'sub_setup_teardown_drop_options'

-- 
To view, visit https://gerrit.asterisk.org/11032
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia3d84b1261dc7492e433a7a7cc0c858dd125f557
Gerrit-Change-Number: 11032
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/20190221/ae1962c1/attachment-0001.html>


More information about the asterisk-code-review mailing list