[asterisk-commits] mjordan: testsuite/asterisk/trunk r2357 - in /asterisk/trunk/tests: apps/ app...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 19 16:10:45 CDT 2011


Author: mjordan
Date: Mon Sep 19 16:10:40 2011
New Revision: 2357

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=2357
Log:
Add SIP / Incomplete handling tests

This adds a test to check for address incomplete handling
for SIP and the Incomplete dialplan application.  These tests
check that the proper hangup code is set in the correct scenarios
and that the dialplan handles waiting for additional DTMF tones
in the appropriate fashion in the presence of chan_sip.

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

Added:
    asterisk/trunk/tests/apps/incomplete/
    asterisk/trunk/tests/apps/incomplete/sip_incomplete/
    asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/
    asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/
    asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/apps/incomplete/sip_incomplete/run-test   (with props)
    asterisk/trunk/tests/apps/incomplete/sip_incomplete/sipp/
    asterisk/trunk/tests/apps/incomplete/sip_incomplete/sipp/receiver1.xml   (with props)
    asterisk/trunk/tests/apps/incomplete/sip_incomplete/sipp/sender1.xml   (with props)
    asterisk/trunk/tests/apps/incomplete/sip_incomplete/test-config.yaml   (with props)
    asterisk/trunk/tests/apps/incomplete/tests.yaml   (with props)
    asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/
    asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/configs/
    asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/configs/ast1/
    asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/configs/ast1/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/run-test   (with props)
    asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/sipp/
    asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/sipp/uas1.xml   (with props)
    asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/test-config.yaml   (with props)
Modified:
    asterisk/trunk/tests/apps/tests.yaml
    asterisk/trunk/tests/channels/SIP/tests.yaml

Added: asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/extensions.conf?view=auto&rev=2357
==============================================================================
--- asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/extensions.conf Mon Sep 19 16:10:40 2011
@@ -1,0 +1,43 @@
+
+[default]
+
+; Note that in this case, the Incomplete application should just be a pass through
+; for the SIP channel.  It should ignore it and immediately forward the 484 response
+; back to the device.  The Incomplete application should return to the dialplan without
+; hanging up on the caller.
+
+exten => 1234,1,NoOp()
+	same => n,Dial(SIP/external,300)
+	same => n,Verbose(1, DIALSTATUS=${DIALSTATUS}, HANGUPCAUSE=${HANGUPCAUSE})
+	same => n,GotoIf($[${HANGUPCAUSE} = 28]?pass:fail)
+    same => n(fail),UserEvent(TestResult,result: fail, status: HANGUPCAUSE had invalid value ${HANGUPCAUSE})
+    same => n,Wait(2)
+    same => n,Hangup()
+    same => n(pass),Incomplete(n)
+    same => n,Verbose(1, No other option dialed and extension allowed to pass Incomplete; failing)
+    same => n,UserEvent(TestResult,result: fail, status: Failed to transition to extension 12345)
+    same => n,Wait(2)
+	same => n,Hangup()
+
+exten => 12345,1,NoOp()
+	same => n,UserEvent(TestResult,result: pass, status: entered into alternate extension 12345)
+    same => n,Wait(2)
+	same => n,Hangup()
+
+exten => t,1,NoOp()
+	same => n,Verbose(1, Entered into timeout)
+	same => n,UserEvent(TestResult,result: fail, status: timedout from Incomplete application)
+	same => n,Wait(2)
+	same => n,Hangup()
+
+exten => i,1,NoOp()
+	same => n,Verbose(1, Entered into invalid)
+	same => n(fail),UserEvent(TestResult,result: fail, status: entered invalid extension when alternate extension 12345 existed in dialplan)
+	same => n,Wait(2)
+	same => n,Hangup()
+
+exten => e,1,NoOp()
+	same => n,Verbose(1, Entered into exception)
+	same => n(fail),UserEvent(TestResult,result: fail, status: entered exception extension when alternate extension 12345 existed in dialplan)
+	same => n,Wait(2)
+	same => n,Hangup()

Propchange: asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/manager.general.conf.inc
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/manager.general.conf.inc?view=auto&rev=2357
==============================================================================
--- asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/manager.general.conf.inc (added)
+++ asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/manager.general.conf.inc Mon Sep 19 16:10:40 2011
@@ -1,0 +1,1 @@
+enabled = yes

Propchange: asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/manager.general.conf.inc
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/manager.general.conf.inc
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/manager.general.conf.inc
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/sip.conf?view=auto&rev=2357
==============================================================================
--- asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/sip.conf (added)
+++ asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/sip.conf Mon Sep 19 16:10:40 2011
@@ -1,0 +1,17 @@
+[general]
+directmedia=no
+
+;This is the inbound peer that
+;will attempt to call the external
+;peer
+[inbound]
+type=friend
+host=127.0.0.1
+port=5061
+
+;This is the peer dialed for
+;all outbound calls
+[external]
+type=friend
+host=127.0.0.1
+port=5062

Propchange: asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/apps/incomplete/sip_incomplete/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/apps/incomplete/sip_incomplete/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/incomplete/sip_incomplete/run-test?view=auto&rev=2357
==============================================================================
--- asterisk/trunk/tests/apps/incomplete/sip_incomplete/run-test (added)
+++ asterisk/trunk/tests/apps/incomplete/sip_incomplete/run-test Mon Sep 19 16:10:40 2011
@@ -1,0 +1,100 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2011, Digium, Inc.
+Matt Jordan <mjordan at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import sys
+import os
+import logging
+
+sys.path.append("lib/python")
+
+from asterisk.asterisk import Asterisk
+from asterisk.TestCase import TestCase
+from asterisk.sipp import SIPpScenario
+from twisted.internet import reactor
+
+logger = logging.getLogger(__name__)
+TEST_DIR = os.path.dirname(os.path.realpath(__file__))
+
+Sender_Scenario = {
+        'scenario' : 'sender1.xml',
+        '-p' : '5061'
+}
+Receiver_Scenario = {
+        'scenario' : 'receiver1.xml',
+        '-p' : '5062'
+    }
+
+class SipIncompleteTest(TestCase):
+    def __init__(self):
+        TestCase.__init__(self)
+        self.create_asterisk(1)
+        self.receiverTest = SIPpScenario(TEST_DIR, Receiver_Scenario)
+        self.senderTest = SIPpScenario(TEST_DIR, Sender_Scenario)
+
+    def ami_connect(self, ami):
+        TestCase.ami_connect(self, ami)
+
+        self.ast[ami.id].cli_exec("sip set debug on")
+        ami.registerEvent('UserEvent', self.user_event)
+
+        logger.debug("Starting SIP scenarios")
+        self.receiverTest.run()
+        self.senderTest.run()
+
+    def user_event(self, ami, event):
+        if event['userevent'] != 'TestResult':
+            return
+
+        if event['result'] == "pass":
+            self.passed = True
+            logger.info("Test successfully exited")
+        else:
+            logger.warn("Test did not successfully exit:")
+            logger.warn("result: %s" % (event['result'],))
+            logger.warn("status: %s" % (event['status'],))
+            self.passed = False
+
+        self.stop_reactor()
+
+    def stop_asterisk(self):
+        TestCase.stop_asterisk(self)
+
+        """ Wait for SIPp to exit """
+        logger.debug("Waiting for SIPp to end")
+        result = self.senderTest.waitAndEvaluate()
+        result = result and self.receiverTest.waitAndEvaluate()
+        if not result:
+            self.passed = False
+
+    def run(self):
+        TestCase.run(self)
+        logger.debug("Creating AMI factory")
+        self.create_ami_factory(1)
+
+
+def main():
+    test = SipIncompleteTest()
+
+    test.start_asterisk()
+
+    reactor.run()
+
+    test.stop_asterisk()
+
+    if test.passed:
+        return 0
+    else:
+        return 1
+
+
+if __name__ == "__main__":
+    sys.exit(main())
+
+
+# vim:sw=4:ts=4:expandtab:textwidth=79

Propchange: asterisk/trunk/tests/apps/incomplete/sip_incomplete/run-test
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/incomplete/sip_incomplete/run-test
------------------------------------------------------------------------------
    svn:executable = *

Propchange: asterisk/trunk/tests/apps/incomplete/sip_incomplete/run-test
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/apps/incomplete/sip_incomplete/run-test
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/apps/incomplete/sip_incomplete/sipp/receiver1.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/incomplete/sip_incomplete/sipp/receiver1.xml?view=auto&rev=2357
==============================================================================
--- asterisk/trunk/tests/apps/incomplete/sip_incomplete/sipp/receiver1.xml (added)
+++ asterisk/trunk/tests/apps/incomplete/sip_incomplete/sipp/receiver1.xml Mon Sep 19 16:10:40 2011
@@ -1,0 +1,48 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Incomplete Address Responder">
+
+    <recv request="INVITE" crlf="true" />
+
+	<!-- Simulate an attempt to reach the extension that was dialed in -->
+	<!-- The INVITE.  After 500 ms, send back a 484 Number incomplete -->
+
+    <send>
+        <![CDATA[
+
+        SIP/2.0 100 Trying
+        [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>
+
+    <pause milliseconds="500" />
+
+    <send>
+        <![CDATA[
+
+        SIP/2.0 484 Number incomplete
+        [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>
+
+    <recv request="ACK"
+        rtd="true"
+        crlf="true">
+    </recv>
+
+</scenario>

Propchange: asterisk/trunk/tests/apps/incomplete/sip_incomplete/sipp/receiver1.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/incomplete/sip_incomplete/sipp/receiver1.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/apps/incomplete/sip_incomplete/sipp/receiver1.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/apps/incomplete/sip_incomplete/sipp/sender1.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/incomplete/sip_incomplete/sipp/sender1.xml?view=auto&rev=2357
==============================================================================
--- asterisk/trunk/tests/apps/incomplete/sip_incomplete/sipp/sender1.xml (added)
+++ asterisk/trunk/tests/apps/incomplete/sip_incomplete/sipp/sender1.xml Mon Sep 19 16:10:40 2011
@@ -1,0 +1,133 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Incomplete Address Sender">
+
+  <!-- The initial call attempts to dial extension 1234.  This -->
+  <!-- will communicate with the receiver1 SIPp scenario, which -->
+  <!-- will return 484 Address Incomplete.  The sender will then -->
+  <!-- attempt again with 12345, which should cause the test to -->
+  <!-- complete successfully -->
+
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:1234@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: inbound <sip:wienerschnitzel@[local_ip]:[local_port]>;tag=[call_number]
+      To: 1234 <1234@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: sip:kartoffelsalat@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      User-Agent: Channel Param Test
+      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 6000 RTP/AVP 0 101
+      a=rtpmap:0 PCMU/8000
+      a=rtpmap:101 telephone-event/8000
+      m=video 6002 RTP/AVP 34
+      a=rtpmap:34 H263/90000
+
+    ]]>
+  </send>
+
+  <recv response="100" optional="true">
+  </recv>
+
+  <recv response="484" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:1234@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: inbound <sip:wienerschnitzel@[local_ip]:[local_port]>;tag=[call_number]
+      To: 1234 <sip:1234@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: sip:kartoffelsalat@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <!-- Pause to simulate the caller figuring out the next digit to dial -->
+  <pause milliseconds="750" />
+
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:12345@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: inbound <sip:wienerschnitzel@[local_ip]:[local_port]>;tag=[call_number]
+      To: 12345 <12345@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: sip:kartoffelsalat@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      User-Agent: Channel Param Test
+      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 6000 RTP/AVP 0 101
+      a=rtpmap:0 PCMU/8000
+      a=rtpmap:101 telephone-event/8000
+      m=video 6002 RTP/AVP 34
+      a=rtpmap:34 H263/90000
+
+    ]]>
+  </send>
+
+  <recv response="100" optional="true">
+  </recv>
+
+  <recv response="180" optional="true">
+  </recv>
+
+  <recv response="183" optional="true">
+  </recv>
+
+  <recv response="603" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:test@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:wienerschnitzel@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: sip:kartoffelsalat@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <!-- definition of the response time repartition table (unit is ms)   -->
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <!-- definition of the call length repartition table (unit is ms)     -->
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>

Propchange: asterisk/trunk/tests/apps/incomplete/sip_incomplete/sipp/sender1.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/incomplete/sip_incomplete/sipp/sender1.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/apps/incomplete/sip_incomplete/sipp/sender1.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/apps/incomplete/sip_incomplete/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/incomplete/sip_incomplete/test-config.yaml?view=auto&rev=2357
==============================================================================
--- asterisk/trunk/tests/apps/incomplete/sip_incomplete/test-config.yaml (added)
+++ asterisk/trunk/tests/apps/incomplete/sip_incomplete/test-config.yaml Mon Sep 19 16:10:40 2011
@@ -1,0 +1,16 @@
+testinfo:
+    summary: 'Test for SIP channel handling the Incomplete application notifications'
+    description: |
+        The test exercises SIP handling of the 484 Address Incomplete response in the presence
+        of the Incomplete application.  The Incomplete application will queue up a control frame
+        that notifies the SIP channel driver that it is waiting for more digits.  The SIP channel
+        driver will interpret that to mean that it should inform the dialing device that the address
+        was incomplete, at which point it will attempt to dial a new extension.  The test succeeds
+        if the new extension is dialed; it fails if any other extension is reached or if the new
+        extension is not dialed.
+
+properties:
+    minversion: '1.8'
+    dependencies:
+        - sipp :
+            version : 'v3.0'

Propchange: asterisk/trunk/tests/apps/incomplete/sip_incomplete/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/incomplete/sip_incomplete/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/apps/incomplete/sip_incomplete/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/apps/incomplete/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/incomplete/tests.yaml?view=auto&rev=2357
==============================================================================
--- asterisk/trunk/tests/apps/incomplete/tests.yaml (added)
+++ asterisk/trunk/tests/apps/incomplete/tests.yaml Mon Sep 19 16:10:40 2011
@@ -1,0 +1,4 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - test: 'sip_incomplete'
+

Propchange: asterisk/trunk/tests/apps/incomplete/tests.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/apps/incomplete/tests.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/apps/incomplete/tests.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/trunk/tests/apps/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/apps/tests.yaml?view=diff&rev=2357&r1=2356&r2=2357
==============================================================================
--- asterisk/trunk/tests/apps/tests.yaml (original)
+++ asterisk/trunk/tests/apps/tests.yaml Mon Sep 19 16:10:40 2011
@@ -4,3 +4,4 @@
     - test: 'directory_context_operator_exit'
     - test: 'directory_attendant_exit'
     - dir: 'voicemail'
+    - dir: 'incomplete'

Added: asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/configs/ast1/extensions.conf?view=auto&rev=2357
==============================================================================
--- asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/configs/ast1/extensions.conf Mon Sep 19 16:10:40 2011
@@ -1,0 +1,36 @@
+
+[default]
+
+exten => 1234,1,NoOp()
+	same => n,Dial(SIP/peer,300)
+	same => n,Verbose(1, DIALSTATUS=${DIALSTATUS}, HANGUPCAUSE=${HANGUPCAUSE})
+	same => n,GotoIf($[${HANGUPCAUSE} = 28]?pass:fail)
+    same => n(fail),UserEvent(TestResult,result: fail, status: HANGUPCAUSE had invalid value ${HANGUPCAUSE})
+    same => n,Wait(2)
+    same => n,Hangup()
+    same => n(pass),UserEvent(TestResult,result: pass, status: HANGUPCAUSE had valid value ${HANGUPCAUSE})
+    same => n,Wait(2)
+	same => n,Hangup()
+
+exten => 12345,1,NoOp()
+	same => n(fail),UserEvent(TestResult,result: fail, status: entered into alternate extension 12345 without being instructed to do so)
+    same => n,Wait(2)
+	same => n,Hangup()
+
+exten => t,1,NoOp()
+	same => n,Verbose(1, Entered into timeout)
+	same => n,UserEvent(TestResult,result: fail, status: HANGUPCAUSE had valid value ${HANGUPCAUSE} and we timed out due to Incomplete logic)
+	same => n,Wait(2)
+	same => n,Hangup()
+
+exten => i,1,NoOp()
+	same => n,Verbose(1, Entered into invalid)
+	same => n(fail),UserEvent(TestResult,result: fail, status: entered invalid extension when alternate extension 12345 existed in dialplan)
+	same => n,Wait(2)
+	same => n,Hangup()
+
+exten => e,1,NoOp()
+	same => n,Verbose(1, Entered into exception)
+	same => n(fail),UserEvent(TestResult,result: fail, status: entered exception extension when alternate extension 12345 existed in dialplan)
+	same => n,Wait(2)
+	same => n,Hangup()

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

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

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

Added: asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/configs/ast1/manager.general.conf.inc
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/configs/ast1/manager.general.conf.inc?view=auto&rev=2357
==============================================================================
--- asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/configs/ast1/manager.general.conf.inc (added)
+++ asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/configs/ast1/manager.general.conf.inc Mon Sep 19 16:10:40 2011
@@ -1,0 +1,1 @@
+enabled = yes

Propchange: asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/configs/ast1/manager.general.conf.inc
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/configs/ast1/manager.general.conf.inc
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/configs/ast1/manager.general.conf.inc
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/configs/ast1/sip.conf?view=auto&rev=2357
==============================================================================
--- asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/configs/ast1/sip.conf (added)
+++ asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/configs/ast1/sip.conf Mon Sep 19 16:10:40 2011
@@ -1,0 +1,9 @@
+[general]
+directmedia=no
+
+;This is the peer dialed for
+;all outbound calls
+[peer]
+type=friend
+host=127.0.0.1
+port=5061

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

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

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

Added: asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/run-test?view=auto&rev=2357
==============================================================================
--- asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/run-test (added)
+++ asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/run-test Mon Sep 19 16:10:40 2011
@@ -1,0 +1,105 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2011, Digium, Inc.
+Matt Jordan <mjordan at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import sys
+import os
+import logging
+
+sys.path.append("lib/python")
+
+from asterisk.asterisk import Asterisk
+from asterisk.TestCase import TestCase
+from asterisk.sipp import SIPpScenario
+from twisted.internet import reactor
+
+logger = logging.getLogger(__name__)
+TEST_DIR = os.path.dirname(os.path.realpath(__file__))
+
+SIPP_SCENARIO = {
+        'scenario' : 'uas1.xml',
+        '-p' : '5061'
+    }
+
+class HandleResponseAddressIncomplete(TestCase):
+    def __init__(self):
+        TestCase.__init__(self)
+        self.create_asterisk(1)
+        self.sipTest = SIPpScenario(TEST_DIR, SIPP_SCENARIO)
+
+
+    def ami_connect(self, ami):
+        TestCase.ami_connect(self, ami)
+
+        self.ast[ami.id].cli_exec("sip set debug on")
+        ami.registerEvent('UserEvent', self.user_event)
+
+        logger.debug("Starting SIP scenario")
+        result = self.sipTest.run()
+
+        logger.debug("Originating call from local channel to SIPp peer")
+        df = ami.originate("Local/1234 at default", "default", "1234", 1, None, "CallId", None, None, None, {}, True)
+        df.addErrback(self.handleOriginateFailure)
+
+    def handleOriginateFailure(self, reason):
+        logger.error("Error sending originate:")
+        logger.error(reason.getTraceback())
+        self.stop_reactor()
+
+        return reason
+
+    def user_event(self, ami, event):
+        if event['userevent'] != 'TestResult':
+            return
+
+        if event['result'] == "pass":
+            self.passed = True
+            logger.info("Test successfully exited")
+        else:
+            logger.warn("Test did not successfully exit:")
+            logger.warn("result: %s" % (event['result'],))
+            logger.warn("status: %s" % (event['status'],))
+            self.passed = False
+
+        self.stop_reactor()
+
+    def stop_asterisk(self):
+        TestCase.stop_asterisk(self)
+
+        """ Wait for SIPp to exit """
+        logger.debug("Waiting for SIPp to end")
+        result = self.sipTest.waitAndEvaluate()
+        if not result:
+            self.passed = False
+
+    def run(self):
+        TestCase.run(self)
+        logger.debug("Creating AMI factory")
+        self.create_ami_factory(1)
+
+
+def main():
+    test = HandleResponseAddressIncomplete()
+
+    test.start_asterisk()
+
+    reactor.run()
+
+    test.stop_asterisk()
+
+    if test.passed:
+        return 0
+    else:
+        return 1
+
+
+if __name__ == "__main__":
+    sys.exit(main())
+
+
+# vim:sw=4:ts=4:expandtab:textwidth=79

Propchange: asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/run-test
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/run-test
------------------------------------------------------------------------------
    svn:executable = *

Propchange: asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/run-test
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/run-test
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/sipp/uas1.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/sipp/uas1.xml?view=auto&rev=2357
==============================================================================
--- asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/sipp/uas1.xml (added)
+++ asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/sipp/uas1.xml Mon Sep 19 16:10:40 2011
@@ -1,0 +1,76 @@
+<?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="Basic UAS responder">
+    <!-- By adding rrs="true" (Record Route Sets), the route sets         -->
+    <!-- are saved and used for following messages sent. Useful to test   -->
+    <!-- against stateful SIP proxies/B2BUAs.                             -->
+    <recv request="INVITE" crlf="true" />
+
+    <!-- The '[last_*]' keyword is replaced automatically by the          -->
+    <!-- specified header if it was present in the last message received  -->
+    <!-- (except if it was a retransmission). If the header was not       -->
+    <!-- present or if no message has been received, the '[last_*]'       -->
+    <!-- keyword is discarded, and all bytes until the end of the line    -->
+    <!-- are also discarded.                                              -->
+    <!--                                                                  -->
+    <!-- If the specified header was present several times in the         -->
+    <!-- message, all occurences are concatenated (CRLF seperated)        -->
+    <!-- to be used in place of the '[last_*]' keyword.                   -->
+
+    <send>
+        <![CDATA[
+
+        SIP/2.0 100 Trying
+        [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>
+
+    <pause milliseconds="500" />
+
+    <send>
+        <![CDATA[
+
+        SIP/2.0 484 Number incomplete
+        [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>
+
+    <recv request="ACK"
+        rtd="true"
+        crlf="true">
+    </recv>
+
+</scenario>

Propchange: asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/sipp/uas1.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/sipp/uas1.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/sipp/uas1.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/test-config.yaml?view=auto&rev=2357
==============================================================================
--- asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/SIP/handle_response_address_incomplete/test-config.yaml Mon Sep 19 16:10:40 2011
@@ -1,0 +1,12 @@
+testinfo:
+    summary: 'Test that asterisk properly handles a 484 Number Incomplete response'
+    description: |
+        This test checks proper handling of SIP response 484 Address Incomplete.  The
+        dialplan should forward the response back to the dialing device without
+        automatically triggering the Incomplete application logic.
+
+properties:
+    minversion: '1.8'
+    dependencies:
+        - sipp :
+            version : 'v3.0'

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

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

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

Modified: asterisk/trunk/tests/channels/SIP/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/tests.yaml?view=diff&rev=2357&r1=2356&r2=2357
==============================================================================
--- asterisk/trunk/tests/channels/SIP/tests.yaml (original)
+++ asterisk/trunk/tests/channels/SIP/tests.yaml Mon Sep 19 16:10:40 2011
@@ -23,3 +23,4 @@
     - test: 'message_unauth'
     - test: 'message_auth'
     - test: 'message_from_call'
+    - test: 'handle_response_address_incomplete'




More information about the asterisk-commits mailing list