[asterisk-commits] mmichelson: branch mmichelson/phone-testsuite r3164 - in /asterisk/team/mmich...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Mar 28 14:33:08 CDT 2012
Author: mmichelson
Date: Wed Mar 28 14:33:04 2012
New Revision: 3164
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3164
Log:
Adds 4 tests for custom SIP presence.
1. Nominal:
Subscribe to presence.
Change presence.
Make sure subscriber is notified.
2. Multiple:
Subscribe to presence.
Change presence twice.
Make sure subscriber is notified of both changes.
3. Resubscribe:
Subscribe to presence.
Change presence state.
Make sure subscriber is notified.
Unsubscribe from presence.
Change presence state.
Re-subscribe to presence.
Unsubscribe from presence.
4. Non-Digium:
Subscribe to presence from non-Digium device.
Change presence state.
Change device state.
Make sure subscriber is notified of device state change.
Unsubscribe from presence.
These tests pass in the sense that the SIPp scenarios pass. The
tests do not currently ensure that correct information is actually
sent. That is the next step.
Added:
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/configs/
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/configs/ast1/
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/run-test (with props)
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/sipp/
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/sipp/multiple.xml
- copied, changed from r3141, asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/sipp/scen2.txt
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/test-config.yaml (with props)
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/configs/
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/configs/ast1/
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/configs/ast1/extensions.conf (with props)
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/configs/ast1/sip.conf (with props)
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/run-test
- copied, changed from r3157, asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/run-test
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/sipp/
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/sipp/nominal.xml
- copied, changed from r3141, asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/sipp/scen1.txt
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/test-config.yaml
- copied unchanged from r3157, asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/test-config.yaml
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/configs/
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/configs/ast1/
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/run-test (with props)
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/sipp/
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/sipp/bob.xml (with props)
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/test-config.yaml (with props)
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/configs/
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/configs/ast1/
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/configs/ast1/extensions.conf (with props)
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/configs/ast1/sip.conf (with props)
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/run-test (with props)
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/sipp/
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/sipp/initial.xml
- copied, changed from r3141, asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/sipp/scen3.txt
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/sipp/resubscribe.xml (with props)
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/test-config.yaml (with props)
Removed:
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/run-test
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/sipp/
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/test-config.yaml
Modified:
asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/tests.yaml
Added: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/run-test?view=auto&rev=3164
==============================================================================
--- asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/run-test (added)
+++ asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/run-test Wed Mar 28 14:33:04 2012
@@ -1,0 +1,71 @@
+#!/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 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' : 'multiple.xml',
+ '-p' : '5061',
+ '-s' : 'bob',
+}
+
+class MultipleStateChange(TestCase):
+ def __init__(self):
+ TestCase.__init__(self)
+ self.create_asterisk()
+ self.sipTest = SIPpScenario(TEST_DIR, SIPP_SCENARIO)
+ self.passed = False
+
+ def sippComplete(self, result):
+ self.passed = True
+ reactor.stop()
+
+ def originateComplete(self, result):
+ df = self.ami[0].originate(channel = "Local/available at default",
+ application = "Echo")
+ df.addErrback(self.handleOriginateFailure)
+
+ def runSippTest(self):
+ df = self.sipTest.run(self)
+ df.addCallback(self.sippComplete)
+
+ df = self.ami[0].originate(channel = "Local/away at default", application = "Echo")
+ df.addErrback(self.handleOriginateFailure)
+ df.addCallback(self.originateComplete)
+
+ def ami_connect(self, ami):
+ print("AMI CONNECT")
+ self.ast[ami.id].cli_exec("sip set debug on")
+ self.runSippTest()
+
+ def run(self):
+ TestCase.run(self)
+ print("TEST RUNNING")
+ self.create_ami_factory()
+
+def main():
+ test = MultipleStateChange()
+ reactor.run()
+ if not test.passed:
+ return 1
+ return 0
+
+if __name__ == "__main__":
+ sys.exit(main() or 0)
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/run-test
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/run-test
------------------------------------------------------------------------------
svn:executable = *
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/run-test
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/run-test
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/sipp/multiple.xml (from r3141, asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/sipp/scen2.txt)
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/sipp/multiple.xml?view=diff&rev=3164&p1=asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/sipp/scen2.txt&r1=3141&p2=asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/sipp/multiple.xml&r2=3164
==============================================================================
--- asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/sipp/scen2.txt (original)
+++ asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/sipp/multiple.xml Wed Mar 28 14:33:04 2012
@@ -52,10 +52,6 @@
<!-- against stateful SIP proxies/B2BUAs. -->
<recv response="200" rtd="true">
</recv>
-
- <!-- This delay can be customized by the -d command-line option -->
- <!-- or by adding a 'milliseconds = "value"' option here. -->
- <pause/>
<!-- Initial NOTIFY upon subscribing -->
<recv request="NOTIFY" crlf="true" />
@@ -117,9 +113,9 @@
SUBSCRIBE 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]>
+ To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
Call-ID: [call_id]
- CSeq: [cseq+1] SUBSCRIBE
+ CSeq: [cseq] SUBSCRIBE
Contact: sip:sipp@[local_ip]:[local_port]
Max-Forwards: 70
Subject: Performance Test
@@ -134,6 +130,24 @@
<recv response="200" crlf="true" />
+ <!-- NOTIFY terminating subscription -->
+ <recv request="NOTIFY" crlf="true" />
+
+ <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>
+
<!-- definition of the response time repartition table (unit is ms) -->
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
Added: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/test-config.yaml?view=auto&rev=3164
==============================================================================
--- asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/test-config.yaml (added)
+++ asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/test-config.yaml Wed Mar 28 14:33:04 2012
@@ -1,0 +1,11 @@
+testinfo:
+ summary: 'Test Reception of Digium custom presence'
+ description: |
+ 'Subscribe to presence and get notified of multiple presence changes'
+
+properties:
+ minversion: '11'
+ dependencies:
+ - app : 'sipp'
+ tags:
+ - SIP
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/multiple_state_change/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/configs/ast1/extensions.conf?view=auto&rev=3164
==============================================================================
--- asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/configs/ast1/extensions.conf (added)
+++ asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/configs/ast1/extensions.conf Wed Mar 28 14:33:04 2012
@@ -1,0 +1,12 @@
+[default]
+
+exten => bob,hint,SIP/bob,CustomPresence:bob
+exten => bob,1,Noop
+
+exten => away,1,Answer
+same => n,Set(PRESENCE_STATE(CustomPresence:bob)=away,down the hall,Quarterly financial meeting)
+same => n,Hangup
+
+exten => available,1,Answer
+same => n,Set(PRESENCE_STATE(CustomPresence:bob)=available)
+same => n,Hangup
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/configs/ast1/sip.conf?view=auto&rev=3164
==============================================================================
--- asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/configs/ast1/sip.conf (added)
+++ asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/configs/ast1/sip.conf Wed Mar 28 14:33:04 2012
@@ -1,0 +1,12 @@
+[general]
+allowsubscribe=yes
+
+[sipp]
+type=peer
+context=default
+host=127.0.0.1
+port=5061
+allowsubscribe=yes
+
+[bob]
+type=peer
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/configs/ast1/sip.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/configs/ast1/sip.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/configs/ast1/sip.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/run-test (from r3157, asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/run-test)
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/run-test?view=diff&rev=3164&p1=asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/run-test&r1=3157&p2=asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/run-test&r2=3164
==============================================================================
--- asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/run-test (original)
+++ asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/run-test Wed Mar 28 14:33:04 2012
@@ -20,31 +20,46 @@
logger = logging.getLogger(__name__)
TEST_DIR = os.path.dirname(os.path.realpath(__file__))
-SIPP_SCENARIOS = [
- {'scenario' : 'scen1.xml',},
- {'scenario' : 'scen2.xml',},
- {'scenario' : 'scen3.xml',},
- {'scenario' : 'scen4.xml',},
-]
+SIPP_SCENARIO = {
+ 'scenario' : 'nominal.xml',
+ '-p' : '5061',
+ '-s' : 'bob',
+}
-class SIPCustomPresence(TestCase):
+class NominalStateChange(TestCase):
def __init__(self):
TestCase.__init__(self)
- self.create_asterisk
+ self.create_asterisk()
+ self.sipTest = SIPpScenario(TEST_DIR, SIPP_SCENARIO)
+ self.passed = False
+
+ def sippComplete(self, result):
+ self.passed = True
+ reactor.stop()
+
+ def runSippTest(self):
+ df = self.sipTest.run(self)
+ df.addCallback(self.sippComplete)
+
+ df = self.ami[0].originate(channel = "Local/away at default", application = "Echo")
+ df.addErrback(self.handleOriginateFailure)
def ami_connect(self, ami):
+ print("AMI CONNECT")
+ self.ast[ami.id].cli_exec("sip set debug on")
+ self.runSippTest()
def run(self):
TestCase.run(self)
+ print("TEST RUNNING")
self.create_ami_factory()
-def main()
- test = SIPCustomPresence()
+def main():
+ test = NominalStateChange()
reactor.run()
- if test.passed:
- return 0
- else:
+ if not test.passed:
return 1
+ return 0
if __name__ == "__main__":
- sys.exit(main())
+ sys.exit(main() or 0)
Copied: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/sipp/nominal.xml (from r3141, asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/sipp/scen1.txt)
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/sipp/nominal.xml?view=diff&rev=3164&p1=asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/sipp/scen1.txt&r1=3141&p2=asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/sipp/nominal.xml&r2=3164
==============================================================================
--- asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/sipp/scen1.txt (original)
+++ asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/nominal_state_change/sipp/nominal.xml Wed Mar 28 14:33:04 2012
@@ -53,10 +53,6 @@
<recv response="200" rtd="true">
</recv>
- <!-- This delay can be customized by the -d command-line option -->
- <!-- or by adding a 'milliseconds = "value"' option here. -->
- <pause/>
-
<!-- Initial NOTIFY upon subscribing -->
<recv request="NOTIFY" crlf="true" />
@@ -66,7 +62,7 @@
SIP/2.0 200 OK
[last_Via:]
[last_From:]
- [last_To:];tag=[pid]SIPpTag01[call_number]
+ [last_To:]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
@@ -84,7 +80,7 @@
SIP/2.0 200 OK
[last_Via:]
[last_From:]
- [last_To:];tag=[pid]SIPpTag01[call_number]
+ [last_To:]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
@@ -99,9 +95,9 @@
SUBSCRIBE 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]>
+ To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
Call-ID: [call_id]
- CSeq: [cseq+1] SUBSCRIBE
+ CSeq: [cseq] SUBSCRIBE
Contact: sip:sipp@[local_ip]:[local_port]
Max-Forwards: 70
Subject: Performance Test
@@ -116,6 +112,24 @@
<recv response="200" crlf="true" />
+ <!-- NOTIFY terminating subscription -->
+ <recv request="NOTIFY" crlf="true" />
+
+ <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>
+
<!-- definition of the response time repartition table (unit is ms) -->
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
Added: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/run-test?view=auto&rev=3164
==============================================================================
--- asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/run-test (added)
+++ asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/run-test Wed Mar 28 14:33:04 2012
@@ -1,0 +1,87 @@
+#!/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 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_SUBSCRIBE = {
+ 'scenario' : 'subscribe.xml',
+ '-p' : '5061',
+ '-s' : 'bob',
+}
+
+BOB_SCENARIO = {
+ 'scenario' : 'bob.xml',
+ '-p' : '5062',
+}
+
+class NominalStateChange(TestCase):
+ def __init__(self):
+ TestCase.__init__(self)
+ self.create_asterisk()
+ self.sipTest = SIPpScenario(TEST_DIR, SIPP_SUBSCRIBE)
+ self.bobTest = SIPpScenario(TEST_DIR, BOB_SCENARIO)
+ self.passed = False
+
+ def testComplete(self, result):
+ self.passed = True
+ reactor.stop()
+
+ def sippComplete(self, result):
+ # The first sipp scenario completed. Now to hang up bob's channel
+ self.ami[0].hangup("SIP/bob-00000000").addCallback(self.testComplete)
+
+ def originateComplete(self, ami, event):
+ # We successfully set presence, now let's change device state
+ # so the SIPp test can conclude
+ if not event.get("userevent") == "Presence":
+ return
+
+ df = ami.originate(channel = "Local/callbob at default", application
+ = "Echo")
+ df.addErrback(self.handleOriginateFailure)
+
+ def runSippTest(self):
+ self.bobTest.run(self)
+ df = self.sipTest.run(self)
+ df.addCallback(self.sippComplete)
+
+ df = self.ami[0].originate(channel = "Local/away at default", application = "Echo")
+ df.addErrback(self.handleOriginateFailure)
+
+ def ami_connect(self, ami):
+ print("AMI CONNECT")
+ self.ast[ami.id].cli_exec("sip set debug on")
+ self.ami[0].registerEvent("UserEvent", self.originateComplete)
+ self.runSippTest()
+
+ def run(self):
+ TestCase.run(self)
+ print("TEST RUNNING")
+ self.create_ami_factory()
+
+def main():
+ test = NominalStateChange()
+ reactor.run()
+ if not test.passed:
+ return 1
+ return 0
+
+if __name__ == "__main__":
+ sys.exit(main() or 0)
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/run-test
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/run-test
------------------------------------------------------------------------------
svn:executable = *
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/run-test
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/run-test
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/sipp/bob.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/sipp/bob.xml?view=auto&rev=3164
==============================================================================
--- asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/sipp/bob.xml (added)
+++ asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/sipp/bob.xml Wed Mar 28 14:33:04 2012
@@ -1,0 +1,100 @@
+<?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">
+ </recv>
+
+ <!-- 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 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-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"
+ optional="true"
+ rtd="true"
+ crlf="true">
+ </recv>
+
+ <recv request="BYE">
+ </recv>
+
+ <send>
+ <![CDATA[
+
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <!-- Keep the call open for a while in case the 200 is lost to be -->
+ <!-- able to retransmit it if we receive the BYE again. -->
+ <timewait milliseconds="4000"/>
+
+
+ <!-- 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/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/sipp/bob.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/sipp/bob.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/sipp/bob.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/test-config.yaml?view=auto&rev=3164
==============================================================================
--- asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/test-config.yaml (added)
+++ asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/test-config.yaml Wed Mar 28 14:33:04 2012
@@ -1,0 +1,11 @@
+testinfo:
+ summary: 'Test Reception of Digium custom presence'
+ description: |
+ 'Subscribe to presence and get notified of presence changes'
+
+properties:
+ minversion: '11'
+ dependencies:
+ - app : 'sipp'
+ tags:
+ - SIP
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/non_digium_state_change/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/configs/ast1/extensions.conf?view=auto&rev=3164
==============================================================================
--- asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/configs/ast1/extensions.conf (added)
+++ asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/configs/ast1/extensions.conf Wed Mar 28 14:33:04 2012
@@ -1,0 +1,12 @@
+[default]
+
+exten => bob,hint,SIP/bob,CustomPresence:bob
+exten => bob,1,Noop
+
+exten => away,1,Answer
+same => n,Set(PRESENCE_STATE(CustomPresence:bob)=away,down the hall,Quarterly financial meeting)
+same => n,Hangup
+
+exten => available,1,Answer
+same => n,Set(PRESENCE_STATE(CustomPresence:bob)=available)
+same => n,Hangup
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/configs/ast1/sip.conf?view=auto&rev=3164
==============================================================================
--- asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/configs/ast1/sip.conf (added)
+++ asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/configs/ast1/sip.conf Wed Mar 28 14:33:04 2012
@@ -1,0 +1,12 @@
+[general]
+allowsubscribe=yes
+
+[sipp]
+type=peer
+context=default
+host=127.0.0.1
+port=5061
+allowsubscribe=yes
+
+[bob]
+type=peer
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/configs/ast1/sip.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/configs/ast1/sip.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/configs/ast1/sip.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/run-test?view=auto&rev=3164
==============================================================================
--- asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/run-test (added)
+++ asterisk/team/mmichelson/phone-testsuite/tests/channels/SIP/sip_custom_presence/resubscribe/run-test Wed Mar 28 14:33:04 2012
@@ -1,0 +1,87 @@
+#!/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 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_INITIAL = {
+ 'scenario' : 'initial.xml',
+ '-p' : '5061',
+ '-s' : 'bob',
+}
+
+SIPP_SCENARIO_RESUBSCRIBE = {
+ 'scenario' : 'resubscribe.xml',
+ '-p' : '5061',
+ '-s' : 'bob',
+}
+
+class Resubscribe(TestCase):
+ def __init__(self):
+ TestCase.__init__(self)
+ self.create_asterisk()
+ self.sipTestInitial = SIPpScenario(TEST_DIR, SIPP_SCENARIO_INITIAL)
+ self.sipTestResubscribe = SIPpScenario(TEST_DIR, SIPP_SCENARIO_RESUBSCRIBE)
+ self.passed = False
+ self.alreadyEvaluatedTestEvent = False
+
+ def sippComplete(self, result):
+ # Okay, we now know that the subscription is terminated. Now let's
+ # originate that second call to change the state to 'available'
+ df = self.ami[0].originate(channel = "Local/available at default",
+ application = "Echo")
+ df.addErrback(self.handleOriginateFailure)
+ df.addCallback(self.originateComplete)
+
+ def sippResubscribeComplete(self, result):
+ self.passed = True
+ reactor.stop()
+
+ def originateComplete(self, result):
+ # The state has changed to "available". Now start the other
+ # SIPP scenario and make sure it gets notified as we expect
+ df = self.sipTestResubscribe.run(self)
+ df.addCallback(self.sippResubscribeComplete)
+
+ def runSippTest(self):
+ df = self.sipTestInitial.run(self)
+ df.addCallback(self.sippComplete)
+
+ df = self.ami[0].originate(channel = "Local/away at default", application = "Echo")
+ df.addErrback(self.handleOriginateFailure)
+
+ def ami_connect(self, ami):
+ print("AMI CONNECT")
+ self.ast[ami.id].cli_exec("sip set debug on")
+ self.runSippTest()
+
+ def run(self):
+ TestCase.run(self)
[... 322 lines stripped ...]
More information about the asterisk-commits
mailing list