[svn-commits] file: testsuite/asterisk/trunk r5217 - in /asterisk/trunk/tests/channels/pjsi...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jul 7 10:53:14 CDT 2014


Author: file
Date: Mon Jul  7 10:53:08 2014
New Revision: 5217

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5217
Log:
Add tests for dialog-info+xml support within PJSIP.

Review: https://reviewboard.asterisk.org/r/3712/

Added:
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/configs/
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/dialog_info_xml.py   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/sipp/
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/sipp/subscribe.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/test-config.yaml   (with props)
Modified:
    asterisk/trunk/tests/channels/pjsip/subscriptions/presence/tests.yaml

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/configs/ast1/extensions.conf?view=auto&rev=5217
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/configs/ast1/extensions.conf Mon Jul  7 10:53:08 2014
@@ -1,0 +1,2 @@
+[default]
+exten => presence,hint,Custom:presence

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/configs/ast1/pjsip.conf?view=auto&rev=5217
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/configs/ast1/pjsip.conf Mon Jul  7 10:53:08 2014
@@ -1,0 +1,7 @@
+[main-transport]
+type=transport
+bind = 127.0.0.1
+
+[alice]
+type=endpoint
+context=default

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/dialog_info_xml.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/dialog_info_xml.py?view=auto&rev=5217
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/dialog_info_xml.py (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/dialog_info_xml.py Mon Jul  7 10:53:08 2014
@@ -1,0 +1,38 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2014, Digium, Inc.
+Joshua Colp <jcolp at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+
+class DialogInfoXML(object):
+    def __init__(self, module_config, test_object):
+        self.ami = None
+        # Device state defaults to NOT_INUSE.
+        self.device_state = "NOTINUSE"
+        test_object.register_ami_observer(self.ami_connect)
+
+    def test_event(self, ami, event):
+        if event.get("state") != "SUBSCRIPTION_STATE_SET":
+            return
+
+        if self.device_state == "NOTINUSE":
+            self.device_state = "RINGING"
+        elif self.device_state == "RINGING":
+            self.device_state = "INUSE"
+        elif self.device_state == "INUSE":
+            self.device_state = "ONHOLD"
+
+        message = {
+            'Action': 'SetVar',
+            'Variable': 'DEVICE_STATE(Custom:presence)',
+            'Value': self.device_state
+        }
+        self.ami.sendMessage(message)
+
+    def ami_connect(self, ami):
+        self.ami = ami
+        self.ami.registerEvent("TestEvent", self.test_event)

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/dialog_info_xml.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/dialog_info_xml.py
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/dialog_info_xml.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/sipp/subscribe.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/sipp/subscribe.xml?view=auto&rev=5217
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/sipp/subscribe.xml (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/sipp/subscribe.xml Mon Jul  7 10:53:08 2014
@@ -1,0 +1,137 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Subscribe">
+  <send retrans="500">
+    <![CDATA[
+      SUBSCRIBE sip:presence@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: "alice" <sip:alice@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: <sip:presence@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 SUBSCRIBE
+      Contact: "alice" <sip:alice@[local_ip]:[local_port]>
+      Expires: 3600
+      Max-Forwards: 70
+      Event: dialog
+      Accept: application/dialog-info+xml
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" rtd="true" />
+
+  <recv request="NOTIFY" crlf="true">
+    <action>
+      <ereg regexp="<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"0\" state=\"full\" entity=\"sip:presence at 127.0.0.1\">
+ <dialog id=\"presence\">
+  <state>terminated</state>
+ </dialog>
+</dialog-info>" check_it="true" search_in="body" assign_to="body" />
+    </action>
+  </recv>
+
+  <Reference variables="body" />
+
+  <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>
+
+  <recv request="NOTIFY" crlf="true">
+    <action>
+      <ereg regexp="<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"1\" state=\"full\" entity=\"sip:presence at 127.0.0.1\">
+ <dialog id=\"presence\">
+  <state>early</state>
+ </dialog>
+</dialog-info>" check_it="true" search_in="body" assign_to="body" />
+    </action>
+  </recv>
+
+  <Reference variables="body" />
+
+  <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>
+
+  <recv request="NOTIFY" crlf="true">
+    <action>
+      <ereg regexp="<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"1\" state=\"full\" entity=\"sip:presence at 127.0.0.1\">
+ <dialog id=\"presence\">
+  <state>confirmed</state>
+ </dialog>
+</dialog-info>" check_it="true" search_in="body" assign_to="body" />
+    </action>
+  </recv>
+
+  <Reference variables="body" />
+
+  <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>
+
+  <recv request="NOTIFY" crlf="true">
+    <action>
+      <ereg regexp="<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"3\" state=\"full\" entity=\"sip:presence at 127.0.0.1\">
+ <dialog id=\"presence\">
+  <state>confirmed</state>
+  <local>
+   <target uri=\"sip:presence at 127.0.0.1\">
+    <param pname=\"\+sip.rendering\" pvalue=\"no\" />
+   </target>
+  </local>
+ </dialog>
+</dialog-info>" check_it="true" search_in="body" assign_to="body" />
+    </action>
+  </recv>
+
+  <Reference variables="body" />
+
+  <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>
+</scenario>

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/sipp/subscribe.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/sipp/subscribe.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/sipp/subscribe.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/test-config.yaml?view=auto&rev=5217
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/test-config.yaml Mon Jul  7 10:53:08 2014
@@ -1,0 +1,35 @@
+testinfo:
+    summary: 'Ensure that dialog-info+xml subscriptions receive the correct NOTIFY body.'
+    description: |
+        'A SIPp test runs that expects to receive NOTIFY messages with certain dialog-info+xml
+        body contents. If these aren't received the test fails.'
+
+properties:
+    minversion: '12.4.0'
+    dependencies:
+        - sipp :
+            version : 'v3.0'
+        - python: 'twisted'
+        - python: 'starpy'
+        - asterisk: 'res_pjsip'
+        - asterisk: 'res_pjsip_exten_state'
+        - asterisk: 'res_pjsip_dialog_info_body_generator'
+    tags:
+        - pjsip
+
+test-modules:
+    add-test-to-search-path: 'True'
+    test-object:
+        config-section: sipp-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            typename: 'dialog_info_xml.DialogInfoXML'
+
+sipp-config:
+    reactor-timeout: 30
+    fail-on-any: True
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'subscribe.xml', '-p': '5061'} }

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/dialog_info_xml/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/trunk/tests/channels/pjsip/subscriptions/presence/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/presence/tests.yaml?view=diff&rev=5217&r1=5216&r2=5217
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/presence/tests.yaml (original)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/presence/tests.yaml Mon Jul  7 10:53:08 2014
@@ -9,3 +9,4 @@
     - test: 'devstate_repeat'
     - test: 'presencestate_repeat'
     - test: 'presencestate_repeat_okay'
+    - test: 'dialog_info_xml'




More information about the svn-commits mailing list