[asterisk-commits] kmoore: testsuite/asterisk/trunk r3540 - in /asterisk/trunk: lib/python/aster...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Nov 26 08:46:44 CST 2012


Author: kmoore
Date: Mon Nov 26 08:46:36 2012
New Revision: 3540

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3540
Log:
Add four basic session timers tests

These tests ensure that Asterisk will refresh the session or tear it
down when appropriate in UAS and UAC modes according to session timers.

Review: https://reviewboard.asterisk.org/r/2180/
(closes issue SWP-5054)
Patch-by: Kinsey Moore <kmoore at digium.com>

Added:
    asterisk/trunk/tests/channels/SIP/session_timers/
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/configs/
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/configs/ast1/
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/originator.py   (with props)
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/sipp/
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/sipp/uas-no-hangup.xml   (with props)
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/configs/
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/configs/ast1/
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/originator.py   (with props)
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/sipp/
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/sipp/uas-no-hangup.xml   (with props)
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/configs/
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/configs/ast1/
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/sipp/
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/sipp/uac-no-hangup.xml   (with props)
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_teardown/
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_teardown/configs/
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_teardown/configs/ast1/
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_teardown/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_teardown/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_teardown/sipp/
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_teardown/sipp/uac-no-hangup.xml   (with props)
    asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_teardown/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/SIP/session_timers/tests.yaml   (with props)
Modified:
    asterisk/trunk/lib/python/asterisk/SimpleTestCase.py
    asterisk/trunk/lib/python/asterisk/TestCase.py
    asterisk/trunk/lib/python/asterisk/sipp.py
    asterisk/trunk/tests/channels/SIP/tests.yaml

Modified: asterisk/trunk/lib/python/asterisk/SimpleTestCase.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/SimpleTestCase.py?view=diff&rev=3540&r1=3539&r2=3540
==============================================================================
--- asterisk/trunk/lib/python/asterisk/SimpleTestCase.py (original)
+++ asterisk/trunk/lib/python/asterisk/SimpleTestCase.py Mon Nov 26 08:46:36 2012
@@ -34,7 +34,7 @@
         test_path Optional path to the location of the test directory
         test_config Optional yaml loaded object containing config information
         '''
-        TestCase.__init__(self, test_path)
+        TestCase.__init__(self, test_path, test_config=test_config)
         self.create_asterisk()
 
         self._test_runs = []

Modified: asterisk/trunk/lib/python/asterisk/TestCase.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/TestCase.py?view=diff&rev=3540&r1=3539&r2=3540
==============================================================================
--- asterisk/trunk/lib/python/asterisk/TestCase.py (original)
+++ asterisk/trunk/lib/python/asterisk/TestCase.py Mon Nov 26 08:46:36 2012
@@ -40,7 +40,7 @@
     other utilities.
     """
 
-    def __init__(self, test_path = ''):
+    def __init__(self, test_path = '', test_config=None):
         """
         Create a new instance of a TestCase.  Must be called by inheriting
         classes.
@@ -48,6 +48,7 @@
         Parameters:
         test_path Optional parameter that specifies the path where this test
             resides
+        test_config Loaded YAML test configuration
         """
 
         if not len(test_path):
@@ -74,6 +75,10 @@
         self._stop_callbacks = []
         self._ami_callbacks = []
 
+        """ Pull additional configuration from YAML config if possible """
+        if test_config and 'reactor-timeout' in test_config:
+            self.reactor_timeout = test_config['reactor-timeout']
+
         os.makedirs(self.testlogdir)
 
         """ Set up logging """

Modified: asterisk/trunk/lib/python/asterisk/sipp.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/sipp.py?view=diff&rev=3540&r1=3539&r2=3540
==============================================================================
--- asterisk/trunk/lib/python/asterisk/sipp.py (original)
+++ asterisk/trunk/lib/python/asterisk/sipp.py Mon Nov 26 08:46:36 2012
@@ -48,7 +48,7 @@
         test_path path to the location of the test directory
         test_config yaml loaded object containing config information
         '''
-        super(SIPpTestCase, self).__init__(test_path)
+        super(SIPpTestCase, self).__init__(test_path, test_config=test_config)
 
         if not test_config:
             raise ValueError('SIPpTestObject requires a test config')

Added: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/configs/ast1/extensions.conf?view=auto&rev=3540
==============================================================================
--- asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/configs/ast1/extensions.conf Mon Nov 26 08:46:36 2012
@@ -1,0 +1,2 @@
+[default]
+exten => s,1,Dial(sip/endpoint)

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/configs/ast1/sip.conf?view=auto&rev=3540
==============================================================================
--- asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/configs/ast1/sip.conf (added)
+++ asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/configs/ast1/sip.conf Mon Nov 26 08:46:36 2012
@@ -1,0 +1,13 @@
+[general]
+canreinvite=no
+
+[endpoint]
+context=default
+type=friend
+host=127.0.0.1
+port=5066
+insecure=invite
+disallow=all
+allow=ulaw
+session-timers=accept
+session-refresher=uas

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/originator.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/originator.py?view=auto&rev=3540
==============================================================================
--- asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/originator.py (added)
+++ asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/originator.py Mon Nov 26 08:46:36 2012
@@ -1,0 +1,48 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2012, Digium, Inc.
+Mark Michelson <mmichelson at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import sys
+import logging
+
+sys.path.append("lib/python")
+
+LOGGER = logging.getLogger(__name__)
+
+class Originator(object):
+    def __init__(self, module_config, test_object):
+        self.ami = None
+        test_object.register_ami_observer(self.ami_connect)
+        test_object.register_scenario_started_observer(self.scenario_started)
+        self.test_object = test_object
+        self.current_destination = 0
+        return
+
+    def ami_connect(self, ami):
+        LOGGER.info("AMI connected")
+        self.ami = ami
+        return
+
+    def success(self, result):
+        LOGGER.info("Originate Successful")
+        return result
+
+    def originate_call(self):
+
+        LOGGER.info("Originating call")
+
+        self.ami.originate(channel = 'Local/s at default',
+                application = 'Echo').addCallback(self.success)
+
+    def scenario_started(self, result):
+        def failure(result):
+            self.test_object.set_passed(False)
+            return result
+
+        self.originate_call()
+        return result

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/originator.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/originator.py
------------------------------------------------------------------------------
    svn:executable = *

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/originator.py
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/originator.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/sipp/uas-no-hangup.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/sipp/uas-no-hangup.xml?view=auto&rev=3540
==============================================================================
--- asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/sipp/uas-no-hangup.xml (added)
+++ asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/sipp/uas-no-hangup.xml Mon Nov 26 08:46:36 2012
@@ -1,0 +1,160 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<!-- This program is free software; you can redistribute it and/or      -->
+<!-- modify it under the terms of the GNU General Public License as     -->
+<!-- published by the Free Software Foundation; either version 2 of the -->
+<!-- License, or (at your option) any later version.                    -->
+<!--                                                                    -->
+<!-- This program is distributed in the hope that it will be useful,    -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of     -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      -->
+<!-- GNU General Public License for more details.                       -->
+<!--                                                                    -->
+<!-- You should have received a copy of the GNU General Public License  -->
+<!-- along with this program; if not, write to the                      -->
+<!-- Free Software Foundation, Inc.,                                    -->
+<!-- 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA             -->
+<!--                                                                    -->
+<!--                 Sipp default 'uas' scenario.                       -->
+<!--                                                                    -->
+
+<scenario name="UAS for timer testing">
+  <Global variables="remote_tag" />
+  <recv request="INVITE" crlf="true">
+      <!-- Save the from tag. We'll need it when we send our BYE -->
+      <action>
+          <ereg regexp=".*timer.*"
+              header="Supported:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="1"/>
+          <ereg regexp=".*(;tag=.*)"
+              header="From:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_tag"/>
+      </action>
+  </recv>
+  <Reference variables="1" />
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 180 Ringing
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Require: timer
+      Session-Expires: 90;refresher=uac
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv request="ACK"
+        rtd="true"
+        crlf="true">
+  </recv>
+
+  <recv request="INVITE" crlf="true">
+      <!-- Save the from tag. We'll need it when we send our BYE -->
+      <action>
+          <ereg regexp=".*timer.*"
+              header="Supported:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="1"/>
+          <ereg regexp=".*(;tag=.*)"
+              header="From:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_tag"/>
+      </action>
+  </recv>
+  <Reference variables="1" />
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Require: timer
+      Session-Expires: 90;refresher=uac
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv request="ACK"
+        rtd="true"
+        crlf="true">
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag01[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>[$remote_tag]
+      [last_Call-ID:]
+      CSeq: [cseq] BYE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200">
+  </recv>
+
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/sipp/uas-no-hangup.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/sipp/uas-no-hangup.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/sipp/uas-no-hangup.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/test-config.yaml?view=auto&rev=3540
==============================================================================
--- asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/test-config.yaml Mon Nov 26 08:46:36 2012
@@ -1,0 +1,33 @@
+testinfo:
+    summary:     'Basic SIP timers test (outbound UAC refresh)'
+    description: |
+        "This test verifies that timers function properly by ensuring that Asterisk refreshes properly as a UAC when requested to on outbound calls."
+
+properties:
+    minversion: '1.8.0'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+        - custom : 'ipv6'
+        - app : 'sipp'
+    tags:
+        - SIP
+        - timers
+
+test-modules:
+    add-test-to-search-path: 'True'
+    test-object:
+        config-section: sipp-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            typename: 'originator.Originator'
+
+sipp-config:
+    reactor-timeout: 70
+    fail-on-any: True
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'uas-no-hangup.xml', '-p': '5066', '-send_timeout': '50000', '-recv_timeout': '50000', '-timeout': '60000'},
+                    'ordered-args': ['-timeout_error'] }

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_refresh/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/configs/ast1/extensions.conf?view=auto&rev=3540
==============================================================================
--- asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/configs/ast1/extensions.conf Mon Nov 26 08:46:36 2012
@@ -1,0 +1,2 @@
+[default]
+exten => s,1,Dial(sip/endpoint)

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/configs/ast1/sip.conf?view=auto&rev=3540
==============================================================================
--- asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/configs/ast1/sip.conf (added)
+++ asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/configs/ast1/sip.conf Mon Nov 26 08:46:36 2012
@@ -1,0 +1,13 @@
+[general]
+canreinvite=no
+
+[endpoint]
+context=default
+type=friend
+host=127.0.0.1
+port=5066
+insecure=invite
+disallow=all
+allow=ulaw
+session-timers=accept
+session-refresher=uas

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/originator.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/originator.py?view=auto&rev=3540
==============================================================================
--- asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/originator.py (added)
+++ asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/originator.py Mon Nov 26 08:46:36 2012
@@ -1,0 +1,48 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2012, Digium, Inc.
+Mark Michelson <mmichelson at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import sys
+import logging
+
+sys.path.append("lib/python")
+
+LOGGER = logging.getLogger(__name__)
+
+class Originator(object):
+    def __init__(self, module_config, test_object):
+        self.ami = None
+        test_object.register_ami_observer(self.ami_connect)
+        test_object.register_scenario_started_observer(self.scenario_started)
+        self.test_object = test_object
+        self.current_destination = 0
+        return
+
+    def ami_connect(self, ami):
+        LOGGER.info("AMI connected")
+        self.ami = ami
+        return
+
+    def success(self, result):
+        LOGGER.info("Originate Successful")
+        return result
+
+    def originate_call(self):
+
+        LOGGER.info("Originating call")
+
+        self.ami.originate(channel = 'Local/s at default',
+                application = 'Echo').addCallback(self.success)
+
+    def scenario_started(self, result):
+        def failure(result):
+            self.test_object.set_passed(False)
+            return result
+
+        self.originate_call()
+        return result

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/originator.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/originator.py
------------------------------------------------------------------------------
    svn:executable = *

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/originator.py
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/originator.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/sipp/uas-no-hangup.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/sipp/uas-no-hangup.xml?view=auto&rev=3540
==============================================================================
--- asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/sipp/uas-no-hangup.xml (added)
+++ asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/sipp/uas-no-hangup.xml Mon Nov 26 08:46:36 2012
@@ -1,0 +1,113 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<!-- This program is free software; you can redistribute it and/or      -->
+<!-- modify it under the terms of the GNU General Public License as     -->
+<!-- published by the Free Software Foundation; either version 2 of the -->
+<!-- License, or (at your option) any later version.                    -->
+<!--                                                                    -->
+<!-- This program is distributed in the hope that it will be useful,    -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of     -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      -->
+<!-- GNU General Public License for more details.                       -->
+<!--                                                                    -->
+<!-- You should have received a copy of the GNU General Public License  -->
+<!-- along with this program; if not, write to the                      -->
+<!-- Free Software Foundation, Inc.,                                    -->
+<!-- 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA             -->
+<!--                                                                    -->
+<!--                 Sipp default 'uas' scenario.                       -->
+<!--                                                                    -->
+
+<scenario name="UAS for timer testing">
+  <Global variables="remote_tag" />
+  <recv request="INVITE" crlf="true">
+      <!-- Save the from tag. We'll need it when we send our BYE -->
+      <action>
+          <ereg regexp=".*timer.*"
+              header="Supported:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="1"/>
+          <ereg regexp=".*(;tag=.*)"
+              header="From:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_tag"/>
+      </action>
+  </recv>
+  <Reference variables="1" />
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 180 Ringing
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Require: timer
+      Session-Expires: 90;refresher=uas
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv request="ACK"
+        rtd="true"
+        crlf="true">
+  </recv>
+
+
+  <!-- Expect a BYE after the timer has elapsed and we haven't sent a refresh -->
+  <recv request="BYE"
+        rtd="true"
+        crlf="true" />
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/sipp/uas-no-hangup.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/sipp/uas-no-hangup.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/sipp/uas-no-hangup.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/test-config.yaml?view=auto&rev=3540
==============================================================================
--- asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/test-config.yaml Mon Nov 26 08:46:36 2012
@@ -1,0 +1,33 @@
+testinfo:
+    summary:     'Basic SIP timers test (outbound UAS refresh)'
+    description: |
+        "This test verifies that timers function properly by tearing down an outbound call that requests UAS refresh and fails to refresh."
+
+properties:
+    minversion: '1.8.0'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+        - custom : 'ipv6'
+        - app : 'sipp'
+    tags:
+        - SIP
+        - timers
+
+test-modules:
+    add-test-to-search-path: 'True'
+    test-object:
+        config-section: sipp-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            typename: 'originator.Originator'
+
+sipp-config:
+    reactor-timeout: 120
+    fail-on-any: True
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'uas-no-hangup.xml', '-p': '5066', '-send_timeout': '100000', '-recv_timeout': '100000', '-timeout': '110000'},
+                    'ordered-args': ['-timeout_error'] }

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uac_teardown/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/configs/ast1/extensions.conf?view=auto&rev=3540
==============================================================================
--- asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/configs/ast1/extensions.conf Mon Nov 26 08:46:36 2012
@@ -1,0 +1,4 @@
+[default]
+exten => endpoint,1,NoOp()
+exten => endpoint,n,Answer()
+exten => endpoint,n,Echo()

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/configs/ast1/sip.conf?view=auto&rev=3540
==============================================================================
--- asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/configs/ast1/sip.conf (added)
+++ asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/configs/ast1/sip.conf Mon Nov 26 08:46:36 2012
@@ -1,0 +1,14 @@
+[general]
+canreinvite=no
+pedantic=no
+
+[endpoint]
+context=default
+type=friend
+host=127.0.0.1
+port=5066
+insecure=invite
+disallow=all
+allow=ulaw
+session-timers=accept
+session-refresher=uas

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/sipp/uac-no-hangup.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/sipp/uac-no-hangup.xml?view=auto&rev=3540
==============================================================================
--- asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/sipp/uac-no-hangup.xml (added)
+++ asterisk/trunk/tests/channels/SIP/session_timers/basic_uas_refresh/sipp/uac-no-hangup.xml Mon Nov 26 08:46:36 2012
@@ -1,0 +1,175 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<!-- This program is free software; you can redistribute it and/or      -->
+<!-- modify it under the terms of the GNU General Public License as     -->
+<!-- published by the Free Software Foundation; either version 2 of the -->
+<!-- License, or (at your option) any later version.                    -->
+<!--                                                                    -->
+<!-- This program is distributed in the hope that it will be useful,    -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of     -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      -->
+<!-- GNU General Public License for more details.                       -->
+<!--                                                                    -->
+<!-- You should have received a copy of the GNU General Public License  -->
+<!-- along with this program; if not, write to the                      -->
+<!-- Free Software Foundation, Inc.,                                    -->
+<!-- 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA             -->
+<!--                                                                    -->
+<!--                 Sipp default 'uas' scenario.                       -->
+<!--                                                                    -->
+
+<scenario name="UAC for timer testing">
+  <Global variables="remote_tag" />
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:endpoint@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Supported: timer
+      Session-Expires: 90;refresher=uas
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="181"
+        optional="true">
+  </recv>
+
+  <recv response="180" optional="true">
+  </recv>
+
+  <recv response="183" optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+    <action>
+      <ereg regexp=".*timer.*"
+              header="Supported:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="1"/>
+      <ereg regexp=".*90;refresher=uas.*"
+              header="Session-Expires:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="1"/>
+    </action>
+  </recv>
+  <Reference variables="1" />
+
+  <send>
+    <![CDATA[
+
+      ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv request="INVITE" crlf="true">
+      <!-- Save the from tag. We'll need it when we send our BYE -->
+      <action>
+          <ereg regexp=".*timer.*"
+              header="Supported:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="1"/>

[... 412 lines stripped ...]



More information about the asterisk-commits mailing list