[asterisk-commits] rmudgett: branch rmudgett/srtp r1677 - in /asterisk/team/rmudgett/srtp/tests/...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jun 23 19:30:10 CDT 2011
Author: rmudgett
Date: Thu Jun 23 19:30:07 2011
New Revision: 1677
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=1677
Log:
Add test to ensure that a call initiated after CHANNEL(secure_bridge_media) is set uses SRTP.
Added:
asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/
asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/
asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast1/
asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast1/extensions.conf (with props)
asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast1/sip.conf (with props)
asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast2/
asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast2/extensions.conf (with props)
asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast2/sip.conf (with props)
asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/run-test (with props)
asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/test-config.yaml (with props)
Modified:
asterisk/team/rmudgett/srtp/tests/channels/SIP/tests.yaml
Added: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast1/extensions.conf?view=auto&rev=1677
==============================================================================
--- asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast1/extensions.conf (added)
+++ asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast1/extensions.conf Thu Jun 23 19:30:07 2011
@@ -1,0 +1,10 @@
+[general]
+
+[globals]
+
+[siptest1]
+
+exten => 1000,1,Set(CHANNEL(secure_bridge_media)=1)
+exten => 1000,n,Set(TEST_RESULT=${CHANNEL} secure_media=${CHANNEL(secure_media)})
+exten => 1000,n,AGI(agi://127.0.0.1:4573)
+exten => 1000,n,Dial(SIP/2000/2000)
Propchange: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:keywords = 'Author Date Id Revision'
Propchange: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast1/sip.conf?view=auto&rev=1677
==============================================================================
--- asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast1/sip.conf (added)
+++ asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast1/sip.conf Thu Jun 23 19:30:07 2011
@@ -1,0 +1,49 @@
+[general]
+context = siptest1
+allowoverlap=no ; Disable overlap dialing support. (Default is yes)
+
+udpbindaddr=127.0.0.1:5060 ; IP address to bind UDP listen socket to (0.0.0.0 binds to all)
+ ; Optionally add a port number, 192.168.1.1:5062 (default is port 5060)
+tcpenable=no ; Enable server for incoming TCP connections (default is no)
+tcpbindaddr=0.0.0.0 ; IP address for TCP server to bind to (0.0.0.0 binds to all interfaces)
+
+sipdebug=yes
+
+[authentication]
+
+[sip-trunk](!)
+dtmfmode=rfc2833
+type=friend
+sendrpid=yes
+trustrpid=yes
+canreinvite=yes
+insecure=invite ; Do not require authentication of incoming INVITEs
+
+nat=no
+directmedia=no
+
+;encryption=yes ; Whether to offer SRTP encrypted media (and only SRTP encrypted media)
+ ; on outgoing calls to a peer. Calls will fail with HANGUPCAUSE=58 if
+ ; the peer does not support SRTP. Defaults to no.
+
+[my-codecs](!) ; a template for my preferred codecs
+disallow=all
+;allow=ilbc
+;allow=g729
+;allow=gsm
+;allow=g723
+allow=ulaw
+
+[1000](sip-trunk,my-codecs)
+callerid="Ast1Name" <1000>
+
+host=127.0.0.1 ; we have a static but private IP address
+ ; No registration allowed
+port=5060
+
+[2000](sip-trunk,my-codecs)
+callerid="Ast2Name" <2000>
+
+host=127.0.0.1 ; we have a static but private IP address
+ ; No registration allowed
+port=5061
Propchange: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast1/sip.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast1/sip.conf
------------------------------------------------------------------------------
svn:keywords = 'Author Date Id Revision'
Propchange: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast1/sip.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast2/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast2/extensions.conf?view=auto&rev=1677
==============================================================================
--- asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast2/extensions.conf (added)
+++ asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast2/extensions.conf Thu Jun 23 19:30:07 2011
@@ -1,0 +1,11 @@
+[general]
+
+[globals]
+
+[siptest2]
+
+exten => 2000,1,Answer()
+exten => 2000,n,Set(TEST_RESULT=${CHANNEL} secure_media=${CHANNEL(secure_media)})
+exten => 2000,n,AGI(agi://127.0.0.1:4573)
+;; Give the other side a chance to get its test result
+;exten => 2000,n,Wait(5)
Propchange: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast2/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast2/extensions.conf
------------------------------------------------------------------------------
svn:keywords = 'Author Date Id Revision'
Propchange: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast2/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast2/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast2/sip.conf?view=auto&rev=1677
==============================================================================
--- asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast2/sip.conf (added)
+++ asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast2/sip.conf Thu Jun 23 19:30:07 2011
@@ -1,0 +1,50 @@
+[general]
+context = siptest2
+allowoverlap=no ; Disable overlap dialing support. (Default is yes)
+
+udpbindaddr=127.0.0.1:5061 ; IP address to bind UDP listen socket to (0.0.0.0 binds to all)
+ ; Optionally add a port number, 192.168.1.1:5062 (default is port 5060)
+tcpenable=no ; Enable server for incoming TCP connections (default is no)
+tcpbindaddr=0.0.0.0 ; IP address for TCP server to bind to (0.0.0.0 binds to all interfaces)
+
+sipdebug=yes
+
+[authentication]
+
+[sip-trunk](!)
+dtmfmode=rfc2833
+type=friend
+sendrpid=yes
+trustrpid=yes
+canreinvite=yes
+insecure=invite ; Do not require authentication of incoming INVITEs
+
+nat=no
+directmedia=no
+
+encryption=yes ; Whether to offer SRTP encrypted media (and only SRTP encrypted media)
+ ; on outgoing calls to a peer. Calls will fail with HANGUPCAUSE=58 if
+ ; the peer does not support SRTP. Defaults to no.
+
+[my-codecs](!) ; a template for my preferred codecs
+disallow=all
+;allow=ilbc
+;allow=g729
+;allow=gsm
+;allow=g723
+allow=ulaw
+
+[1000](sip-trunk,my-codecs)
+callerid="Ast1Name" <1000>
+
+host=127.0.0.1 ; we have a static but private IP address
+ ; No registration allowed
+port=5060
+
+[2000](sip-trunk,my-codecs)
+callerid="Ast2Name" <2000>
+
+host=127.0.0.1 ; we have a static but private IP address
+ ; No registration allowed
+port=5061
+
Propchange: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast2/sip.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast2/sip.conf
------------------------------------------------------------------------------
svn:keywords = 'Author Date Id Revision'
Propchange: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/configs/ast2/sip.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/run-test?view=auto&rev=1677
==============================================================================
--- asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/run-test (added)
+++ asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/run-test Thu Jun 23 19:30:07 2011
@@ -1,0 +1,90 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2011, Digium, Inc.
+Richard Mudgett <rmudgett 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 time
+from twisted.internet import reactor, defer
+
+sys.path.append("lib/python")
+from asterisk.TestCase import TestCase
+
+class SIPCallTest(TestCase):
+ def __init__(self, argv):
+ TestCase.__init__(self, argv)
+
+ self.connected_chan1 = False
+ self.connected_chan2 = False
+ self.connected_srtp1 = False
+ self.connected_srtp2 = False
+
+ # Safe Reactor timeout values on my own machine could be as low as 1.
+ self.reactor_timeout = 10
+
+ # Create one AGI server
+ # Will call fastagi_connect() once an AGI connection is established.
+ self.create_fastagi_factory()
+
+ # Create two Asterisk instances ...
+ self.create_asterisk(2)
+
+ # This is called when the reactor has started running.
+ def run(self):
+ TestCase.run(self)
+
+ print "Initiating test call"
+ self.ast[0].cli_exec("console dial 1000 at siptest1")
+
+ # This is called by each Asterisk instance if the call gets connected.
+ def fastagi_connect(self, agi):
+ def get_test_result(val):
+ print "Connection result '%s'" % val
+ if val.split("-")[0] == "SIP/2000":
+ # Outgoing call on Ast1
+ self.connected_chan1 = True
+ if val.split("=")[1] == "1":
+ self.connected_srtp1 = True
+ elif val.split("-")[0] == "SIP/1000":
+ # Incoming call on Ast2
+ self.connected_chan2 = True
+ if val.split("=")[1] == "1":
+ self.connected_srtp2 = True
+ else:
+ print "Don't know which side is connected."
+
+ agi.getVariable("TEST_RESULT").addCallback(get_test_result)
+
+ def stop_asterisk(self):
+ TestCase.stop_asterisk(self)
+
+ # Determine if the test passed
+ print "self.connected_chan1:%s" % (self.connected_chan1)
+ print "self.connected_srtp1:%s" % (self.connected_srtp1)
+ print "self.connected_chan2:%s" % (self.connected_chan2)
+ print "self.connected_srtp2:%s" % (self.connected_srtp2)
+ if self.connected_chan1 and self.connected_srtp1 and self.connected_chan2 and self.connected_srtp2:
+ print "Test passed"
+ self.passed = True
+
+def main(argv=None):
+ if argv is None:
+ argv = sys.argv
+ test = SIPCallTest(argv)
+ test.start_asterisk()
+ reactor.run()
+ test.stop_asterisk()
+ if test.passed:
+ return 0
+ return 1
+
+if __name__ == "__main__":
+ sys.exit(main() or 0)
+
+
+# vim:sw=4:ts=4:expandtab:textwidth=79
Propchange: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/run-test
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/run-test
------------------------------------------------------------------------------
svn:executable = *
Propchange: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/run-test
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/run-test
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/test-config.yaml?view=auto&rev=1677
==============================================================================
--- asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/test-config.yaml (added)
+++ asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/test-config.yaml Thu Jun 23 19:30:07 2011
@@ -1,0 +1,10 @@
+testinfo:
+ summary: 'Test CHANNEL(secure_bridge_media)'
+ description: |
+ 'Ensure that a call initiated after CHANNEL(secure_bridge_media) is set uses SRTP.'
+
+properties:
+ minversion: '1.8'
+ dependencies:
+ - python : 'twisted'
+ - python : 'starpy'
Propchange: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = 'Author Date Id Revision'
Propchange: asterisk/team/rmudgett/srtp/tests/channels/SIP/secure_bridge_media/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: asterisk/team/rmudgett/srtp/tests/channels/SIP/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/rmudgett/srtp/tests/channels/SIP/tests.yaml?view=diff&rev=1677&r1=1676&r2=1677
==============================================================================
--- asterisk/team/rmudgett/srtp/tests/channels/SIP/tests.yaml (original)
+++ asterisk/team/rmudgett/srtp/tests/channels/SIP/tests.yaml Thu Jun 23 19:30:07 2011
@@ -17,6 +17,7 @@
- test: 'sip_srtp'
- test: 'noload_res_srtp'
- test: 'noload_res_srtp_attempt_srtp'
+ - test: 'secure_bridge_media'
- test: 'message_disabled'
- test: 'message_unauth'
- test: 'message_auth'
More information about the asterisk-commits
mailing list