[svn-commits] twilson: testsuite/asterisk/trunk r2658 - in /asterisk/trunk/tests/channels/S...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Nov 2 10:24:01 CDT 2011
Author: twilson
Date: Wed Nov 2 10:23:57 2011
New Revision: 2658
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=2658
Log:
Add some realtime SIP tests using res_config_sqlite
Added:
asterisk/trunk/tests/channels/SIP/realtime_nosipregs/
asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/
asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/
asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/extconfig.conf (with props)
asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/extensions.conf (with props)
asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/res_config_sqlite.conf (with props)
asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/sip.conf (with props)
asterisk/trunk/tests/channels/SIP/realtime_nosipregs/nosipreg.sql (with props)
asterisk/trunk/tests/channels/SIP/realtime_nosipregs/realtime.sqlite (with props)
asterisk/trunk/tests/channels/SIP/realtime_nosipregs/run-test (with props)
asterisk/trunk/tests/channels/SIP/realtime_nosipregs/sipp/
asterisk/trunk/tests/channels/SIP/realtime_nosipregs/sipp/uac.xml (with props)
asterisk/trunk/tests/channels/SIP/realtime_nosipregs/test-config.yaml (with props)
asterisk/trunk/tests/channels/SIP/realtime_sipregs/
asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/
asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/
asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/extconfig.conf (with props)
asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/extensions.conf (with props)
asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/res_config_sqlite.conf (with props)
asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/sip.conf (with props)
asterisk/trunk/tests/channels/SIP/realtime_sipregs/realtime.sqlite (with props)
asterisk/trunk/tests/channels/SIP/realtime_sipregs/run-test (with props)
asterisk/trunk/tests/channels/SIP/realtime_sipregs/sipp/
asterisk/trunk/tests/channels/SIP/realtime_sipregs/sipp/uac.xml (with props)
asterisk/trunk/tests/channels/SIP/realtime_sipregs/sipregs.sql (with props)
asterisk/trunk/tests/channels/SIP/realtime_sipregs/test-config.yaml (with props)
Modified:
asterisk/trunk/tests/channels/SIP/tests.yaml
Added: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/extconfig.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/extconfig.conf?view=auto&rev=2658
==============================================================================
--- asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/extconfig.conf (added)
+++ asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/extconfig.conf Wed Nov 2 10:23:57 2011
@@ -1,0 +1,3 @@
+[settings]
+sipusers => sqlite,asterisk,sipfriends
+sippeers => sqlite,asterisk,sipfriends
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/extconfig.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/extconfig.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/extconfig.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/extensions.conf?view=auto&rev=2658
==============================================================================
--- asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/extensions.conf Wed Nov 2 10:23:57 2011
@@ -1,0 +1,10 @@
+[general]
+static=yes
+writeprotect=no
+clearglobalvars=no
+
+[default]
+exten => s,1,Answer
+same => n,NoOp(SIP PEER IS: ${CHANNEL(peername)})
+same => n,ExecIf($[ x${CHANNEL(peername)} != x ]?UserEvent(CallFromPeer,Peername: ${CHANNEL(peername)}))
+same => n,Hangup
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/res_config_sqlite.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/res_config_sqlite.conf?view=auto&rev=2658
==============================================================================
--- asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/res_config_sqlite.conf (added)
+++ asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/res_config_sqlite.conf Wed Nov 2 10:23:57 2011
@@ -1,0 +1,4 @@
+[general]
+dbfile => /tmp/realtime.sqlite
+config_table => ast_config
+cdr_table => ast_cdr
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/res_config_sqlite.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/res_config_sqlite.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/res_config_sqlite.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/sip.conf?view=auto&rev=2658
==============================================================================
--- asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/sip.conf (added)
+++ asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/sip.conf Wed Nov 2 10:23:57 2011
@@ -1,0 +1,2 @@
+[general]
+allowguest=no
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/sip.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/sip.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/configs/ast1/sip.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/nosipreg.sql
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/realtime_nosipregs/nosipreg.sql?view=auto&rev=2658
==============================================================================
--- asterisk/trunk/tests/channels/SIP/realtime_nosipregs/nosipreg.sql (added)
+++ asterisk/trunk/tests/channels/SIP/realtime_nosipregs/nosipreg.sql Wed Nov 2 10:23:57 2011
@@ -1,0 +1,9 @@
+BEGIN TRANSACTION;
+CREATE TABLE sipfriends (name varchar(15) NOT NULL, secret varchar(63) NOT NULL DEFAULT "", type varchar(15) NOT NULL DEFAULT "friend", host varchar(63) NOT NULL DEFAULT "dynamic", ipaddr varchar(63) NOT NULL DEFAULT "", port int unsigned default NULL DEFAULT 5060, insecure varchar(11) NOT NULL DEFAULT "", commented INTEGER NOT NULL DEFAULT 0);
+INSERT INTO sipfriends VALUES('test1','','friend','127.0.0.1','',5061,'',0);
+INSERT INTO sipfriends VALUES('test2','','friend','dynamic','127.0.0.2',5061,'',0);
+INSERT INTO sipfriends VALUES('test3','','friend','127.0.0.3','',666,'port',0);
+INSERT INTO sipfriends VALUES('test4','','friend','dynamic','127.0.0.4',666,'port',0);
+CREATE TABLE sipregs (name varchar(15) NOT NULL, ipaddr varchar(15) NOT NULL DEFAULT "", port int unsigned NOT NULL DEFAULT 5060, defaultuser varchar(15) NOT NULL DEFAULT "", fullcontact varchar(63) NOT NULL DEFAULT "", regserver varchar(63) NOT NULL DEFAULT "", useragent varchar(63) NOT NULL DEFAULT "", insecure varchar(11) NOT NULL DEFAULT "", lastms int unsigned NOT NULL DEFAULT 0, regseconds int unsigned NOT NULL DEFAULT 0, commented INTEGER NOT NULL DEFAULT 0);
+INSERT INTO sipregs VALUES('test1-fail','127.0.0.1',5061,'','','','','',0,0,0);
+COMMIT;
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/nosipreg.sql
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/nosipreg.sql
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/nosipreg.sql
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/realtime.sqlite
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/realtime_nosipregs/realtime.sqlite?view=auto&rev=2658
==============================================================================
Binary file - no diff available.
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/realtime.sqlite
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/realtime_nosipregs/run-test?view=auto&rev=2658
==============================================================================
--- asterisk/trunk/tests/channels/SIP/realtime_nosipregs/run-test (added)
+++ asterisk/trunk/tests/channels/SIP/realtime_nosipregs/run-test Wed Nov 2 10:23:57 2011
@@ -1,0 +1,101 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2011, Digium, Inc.
+Terry Wilson <twilson 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 shutil
+import logging
+
+sys.path.append("lib/python")
+
+logging.basicConfig()
+
+from asterisk.TestCase import TestCase
+from asterisk.sipp import SIPpScenario
+from twisted.internet import reactor
+from starpy import manager
+
+TEST_DIR = os.path.dirname(os.path.realpath(__file__))
+DB_PATH = TEST_DIR + "/realtime.sqlite"
+TMP_DB_PATH = "/tmp/realtime.sqlite"
+logger = logging.getLogger(__name__)
+
+SIPP_SCENARIOS = [
+ {
+ 'scenario' : 'uac.xml', '-p' : '5061', '-i' : '127.0.0.1', '-s' : 's'
+ },
+ {
+ 'scenario' : 'uac.xml', '-p' : '5061', '-i' : '127.0.0.2', '-s' : 's'
+ },
+ {
+ 'scenario' : 'uac.xml', '-p' : '5061', '-i' : '127.0.0.3', '-s' : 's'
+ },
+ {
+ 'scenario' : 'uac.xml', '-p' : '5061', '-i' : '127.0.0.4', '-s' : 's'
+ }
+]
+
+class SIPRealtimeTest(TestCase):
+ def __init__(self):
+ TestCase.__init__(self)
+ self.passed = False
+ self.scenarios_left = {
+ "test1",
+ "test2",
+ "test3",
+ "test4"
+ }
+ self.create_asterisk()
+
+ def run(self):
+ TestCase.run(self)
+ self.create_ami_factory()
+
+ def ami_connect(self, ami):
+ logger.debug("Connected to AMI")
+ ami.registerEvent("UserEvent", self.ami_test)
+ for scenario_def in SIPP_SCENARIOS:
+ scenario = SIPpScenario(TEST_DIR, scenario_def)
+ scenario.run()
+ if scenario.waitAndEvaluate() == False:
+ self.stop_reactor()
+
+ def ami_test(self, ami, event):
+ if event.get("userevent") != "CallFromPeer":
+ return
+
+ logger.debug("Got UserEvent")
+ peername = event.get("peername")
+ if peername == None:
+ return
+ logger.debug("Passed: " + peername)
+ self.reset_timeout()
+ self.scenarios_left.discard(peername)
+ if (len(self.scenarios_left) == 0):
+ self.passed = True
+ self.stop_reactor()
+
+
+def main():
+ shutil.copyfile(DB_PATH, TMP_DB_PATH)
+ test = SIPRealtimeTest()
+ test.start_asterisk()
+ reactor.run()
+ test.stop_asterisk()
+ os.remove(TMP_DB_PATH)
+ if test.passed:
+ return 0
+ return 1
+
+
+if __name__ == "__main__":
+ sys.exit(main())
+
+
+# vim:sw=4:ts=4:expandtab:textwidth=79
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/run-test
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/run-test
------------------------------------------------------------------------------
svn:executable = *
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/run-test
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/run-test
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/sipp/uac.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/realtime_nosipregs/sipp/uac.xml?view=auto&rev=2658
==============================================================================
--- asterisk/trunk/tests/channels/SIP/realtime_nosipregs/sipp/uac.xml (added)
+++ asterisk/trunk/tests/channels/SIP/realtime_nosipregs/sipp/uac.xml Wed Nov 2 10:23:57 2011
@@ -1,0 +1,59 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Simple Call">
+ <send retrans="500">
+ <![CDATA[
+
+ INVITE 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]>
+ Call-ID: [call_id]
+ CSeq: 1 INVITE
+ Contact: sip:sipp@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Performance 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 [media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+ </send>
+
+ <recv response="100" optional="true">
+ </recv>
+
+ <recv response="180" optional="true">
+ </recv>
+
+ <recv response="183" optional="true">
+ </recv>
+
+ <recv response="200" rtd="true">
+ </recv>
+
+ <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
+ Subject: Performance Test
+ Content-Length: 0
+
+ ]]>
+ </send>
+</scenario>
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/sipp/uac.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/sipp/uac.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/sipp/uac.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/realtime_nosipregs/test-config.yaml?view=auto&rev=2658
==============================================================================
--- asterisk/trunk/tests/channels/SIP/realtime_nosipregs/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/SIP/realtime_nosipregs/test-config.yaml Wed Nov 2 10:23:57 2011
@@ -1,0 +1,10 @@
+testinfo:
+ summary: 'Test SIP realtime peer matching'
+ description: |
+ 'Make sure that realtime peers are matched properly'
+properties:
+ minversion: '1.8'
+ dependencies:
+ - python : 'twisted'
+ - python : 'starpy'
+ - asterisk : 'res_config_sqlite'
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/SIP/realtime_nosipregs/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/extconfig.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/extconfig.conf?view=auto&rev=2658
==============================================================================
--- asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/extconfig.conf (added)
+++ asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/extconfig.conf Wed Nov 2 10:23:57 2011
@@ -1,0 +1,4 @@
+[settings]
+sipusers => sqlite,asterisk,sipfriends
+sippeers => sqlite,asterisk,sipfriends
+sipregs => sqlite,asterisk,sipregs
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/extconfig.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/extconfig.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/extconfig.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/extensions.conf?view=auto&rev=2658
==============================================================================
--- asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/extensions.conf Wed Nov 2 10:23:57 2011
@@ -1,0 +1,10 @@
+[general]
+static=yes
+writeprotect=no
+clearglobalvars=no
+
+[default]
+exten => s,1,Answer
+same => n,NoOp(SIP PEER IS: ${CHANNEL(peername)})
+same => n,ExecIf($[ x${CHANNEL(peername)} != x ]?UserEvent(CallFromPeer,Peername: ${CHANNEL(peername)}))
+same => n,Hangup
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/res_config_sqlite.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/res_config_sqlite.conf?view=auto&rev=2658
==============================================================================
--- asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/res_config_sqlite.conf (added)
+++ asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/res_config_sqlite.conf Wed Nov 2 10:23:57 2011
@@ -1,0 +1,4 @@
+[general]
+dbfile => /tmp/realtime.sqlite
+config_table => ast_config
+cdr_table => ast_cdr
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/res_config_sqlite.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/res_config_sqlite.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/res_config_sqlite.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/sip.conf?view=auto&rev=2658
==============================================================================
--- asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/sip.conf (added)
+++ asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/sip.conf Wed Nov 2 10:23:57 2011
@@ -1,0 +1,2 @@
+[general]
+allowguest=no
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/sip.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/sip.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/configs/ast1/sip.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/SIP/realtime_sipregs/realtime.sqlite
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/realtime_sipregs/realtime.sqlite?view=auto&rev=2658
==============================================================================
Binary file - no diff available.
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/realtime.sqlite
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: asterisk/trunk/tests/channels/SIP/realtime_sipregs/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/realtime_sipregs/run-test?view=auto&rev=2658
==============================================================================
--- asterisk/trunk/tests/channels/SIP/realtime_sipregs/run-test (added)
+++ asterisk/trunk/tests/channels/SIP/realtime_sipregs/run-test Wed Nov 2 10:23:57 2011
@@ -1,0 +1,94 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2011, Digium, Inc.
+Terry Wilson <twilson 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 shutil
+import logging
+
+sys.path.append("lib/python")
+
+logging.basicConfig()
+
+from asterisk.TestCase import TestCase
+from asterisk.sipp import SIPpScenario
+from twisted.internet import reactor
+from starpy import manager
+
+
+TEST_DIR = os.path.dirname(os.path.realpath(__file__))
+DB_PATH = TEST_DIR + "/realtime.sqlite"
+TMP_DB_PATH = "/tmp/realtime.sqlite"
+logger = logging.getLogger(__name__)
+
+SIPP_SCENARIOS = [
+ {
+ 'scenario' : 'uac.xml', '-p' : '5061', '-i' : '127.0.0.1', '-s' : 's'
+ },
+ {
+ 'scenario' : 'uac.xml', '-p' : '5061', '-i' : '127.0.0.2', '-s' : 's'
+ }
+]
+
+class SIPRealtimeTest(TestCase):
+ def __init__(self):
+ TestCase.__init__(self)
+ self.passed = False
+ self.scenarios_left = {
+ "test1",
+ "test2",
+ }
+ self.create_asterisk()
+
+ def run(self):
+ TestCase.run(self)
+ self.create_ami_factory()
+
+ def ami_connect(self, ami):
+ logger.debug("Connected to AMI")
+ ami.registerEvent("UserEvent", self.ami_test)
+ for scenario_def in SIPP_SCENARIOS:
+ scenario = SIPpScenario(TEST_DIR, scenario_def)
+ scenario.run()
+ if scenario.waitAndEvaluate() == False:
+ self.stop_reactor()
+
+ def ami_test(self, ami, event):
+ if event.get("userevent") != "CallFromPeer":
+ return
+
+ logger.debug("Got UserEvent")
+ peername = event.get("peername")
+ if peername == None:
+ return
+ logger.debug("Passed: " + peername)
+ self.reset_timeout()
+ self.scenarios_left.discard(peername)
+ if (len(self.scenarios_left) == 0):
+ self.passed = True
+ self.stop_reactor()
+
+
+def main():
+ shutil.copyfile(DB_PATH, TMP_DB_PATH)
+ test = SIPRealtimeTest()
+ test.start_asterisk()
+ reactor.run()
+ test.stop_asterisk()
+ os.remove(TMP_DB_PATH)
+ if test.passed:
+ return 0
+ return 1
+
+
+if __name__ == "__main__":
+ sys.exit(main())
+
+
+# vim:sw=4:ts=4:expandtab:textwidth=79
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/run-test
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/run-test
------------------------------------------------------------------------------
svn:executable = *
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/run-test
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/run-test
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/SIP/realtime_sipregs/sipp/uac.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/realtime_sipregs/sipp/uac.xml?view=auto&rev=2658
==============================================================================
--- asterisk/trunk/tests/channels/SIP/realtime_sipregs/sipp/uac.xml (added)
+++ asterisk/trunk/tests/channels/SIP/realtime_sipregs/sipp/uac.xml Wed Nov 2 10:23:57 2011
@@ -1,0 +1,59 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Simple Call">
+ <send retrans="500">
+ <![CDATA[
+
+ INVITE 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]>
+ Call-ID: [call_id]
+ CSeq: 1 INVITE
+ Contact: sip:sipp@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Performance 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 [media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+
+ ]]>
+ </send>
+
+ <recv response="100" optional="true">
+ </recv>
+
+ <recv response="180" optional="true">
+ </recv>
+
+ <recv response="183" optional="true">
+ </recv>
+
+ <recv response="200" rtd="true">
+ </recv>
+
+ <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
+ Subject: Performance Test
+ Content-Length: 0
+
+ ]]>
+ </send>
+</scenario>
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/sipp/uac.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/sipp/uac.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/sipp/uac.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/SIP/realtime_sipregs/sipregs.sql
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/realtime_sipregs/sipregs.sql?view=auto&rev=2658
==============================================================================
--- asterisk/trunk/tests/channels/SIP/realtime_sipregs/sipregs.sql (added)
+++ asterisk/trunk/tests/channels/SIP/realtime_sipregs/sipregs.sql Wed Nov 2 10:23:57 2011
@@ -1,0 +1,8 @@
+BEGIN TRANSACTION;
+CREATE TABLE sipfriends (name varchar(15) NOT NULL, secret varchar(63) NOT NULL DEFAULT "", type varchar(15) NOT NULL DEFAULT "friend", host varchar(63) NOT NULL DEFAULT "dynamic", ipaddr varchar(63) NOT NULL DEFAULT "", port int unsigned default NULL DEFAULT 5060, insecure varchar(11) NOT NULL DEFAULT "", commented INTEGER NOT NULL DEFAULT 0);
+INSERT INTO sipfriends VALUES('test1','','friend','dynamic','',5060,'',0);
+INSERT INTO sipfriends VALUES('test2','','friend','dynamic','',5060,'port',0);
+CREATE TABLE sipregs (name varchar(15) NOT NULL, ipaddr varchar(15) NOT NULL DEFAULT "", port int unsigned NOT NULL DEFAULT 5060, defaultuser varchar(15) NOT NULL DEFAULT "", fullcontact varchar(63) NOT NULL DEFAULT "", regserver varchar(63) NOT NULL DEFAULT "", useragent varchar(63) NOT NULL DEFAULT "", insecure varchar(11) NOT NULL DEFAULT "", lastms int unsigned NOT NULL DEFAULT 0, regseconds int unsigned NOT NULL DEFAULT 0, commented INTEGER NOT NULL DEFAULT 0);
+INSERT INTO sipregs VALUES('test1','127.0.0.1',5061,'','','','','',0,0,0);
+INSERT INTO sipregs VALUES('test2','127.0.0.2',666,'','','','','',0,0,0);
+COMMIT;
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/sipregs.sql
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/sipregs.sql
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/sipregs.sql
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/SIP/realtime_sipregs/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/realtime_sipregs/test-config.yaml?view=auto&rev=2658
==============================================================================
--- asterisk/trunk/tests/channels/SIP/realtime_sipregs/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/SIP/realtime_sipregs/test-config.yaml Wed Nov 2 10:23:57 2011
@@ -1,0 +1,10 @@
+testinfo:
+ summary: 'Test SIP realtime peer matching with sipregs enabled'
+ description: |
+ 'Make sure that realtime peers are matched properly when sipreg is enabled'
+properties:
+ minversion: '1.8'
+ dependencies:
+ - python : 'twisted'
+ - python : 'starpy'
+ - asterisk : 'res_config_sqlite'
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/SIP/realtime_sipregs/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=2658&r1=2657&r2=2658
==============================================================================
--- asterisk/trunk/tests/channels/SIP/tests.yaml (original)
+++ asterisk/trunk/tests/channels/SIP/tests.yaml Wed Nov 2 10:23:57 2011
@@ -24,3 +24,5 @@
- test: 'message_auth'
- test: 'message_from_call'
- test: 'handle_response_address_incomplete'
+ - test: 'realtime_sipregs'
+ - test: 'realtime_nosipregs'
More information about the svn-commits
mailing list