[asterisk-commits] rmudgett: branch rmudgett/srtp r1667 - in /asterisk/team/rmudgett/srtp/tests/...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jun 21 20:19:45 CDT 2011
Author: rmudgett
Date: Tue Jun 21 20:19:42 2011
New Revision: 1667
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=1667
Log:
Add SRTP connection and other test improvements.
Modified:
asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/configs/ast1/extensions.conf
asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/configs/ast1/sip.conf
asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/configs/ast2/extensions.conf
asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/configs/ast2/sip.conf
asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/run-test
Modified: asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/configs/ast1/extensions.conf?view=diff&rev=1667&r1=1666&r2=1667
==============================================================================
--- asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/configs/ast1/extensions.conf (original)
+++ asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/configs/ast1/extensions.conf Tue Jun 21 20:19:42 2011
@@ -5,4 +5,5 @@
[siptest1]
exten => 1000,1,Answer()
+exten => 1000,n,Set(TEST_RESULT=${CHANNEL} secure_media=${CHANNEL(secure_media)})
exten => 1000,n,AGI(agi://127.0.0.1:4573)
Modified: asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/configs/ast1/sip.conf?view=diff&rev=1667&r1=1666&r2=1667
==============================================================================
--- asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/configs/ast1/sip.conf (original)
+++ asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/configs/ast1/sip.conf Tue Jun 21 20:19:42 2011
@@ -7,9 +7,7 @@
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)
-;encryption=no ; 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.
+sipdebug=yes
[authentication]
@@ -23,6 +21,10 @@
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
Modified: asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/configs/ast2/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/configs/ast2/extensions.conf?view=diff&rev=1667&r1=1666&r2=1667
==============================================================================
--- asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/configs/ast2/extensions.conf (original)
+++ asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/configs/ast2/extensions.conf Tue Jun 21 20:19:42 2011
@@ -5,4 +5,5 @@
[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)
Modified: asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/configs/ast2/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/configs/ast2/sip.conf?view=diff&rev=1667&r1=1666&r2=1667
==============================================================================
--- asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/configs/ast2/sip.conf (original)
+++ asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/configs/ast2/sip.conf Tue Jun 21 20:19:42 2011
@@ -7,9 +7,7 @@
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)
-;encryption=no ; 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.
+sipdebug=yes
[authentication]
@@ -23,6 +21,10 @@
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
Modified: asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/run-test?view=diff&rev=1667&r1=1666&r2=1667
==============================================================================
--- asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/run-test (original)
+++ asterisk/team/rmudgett/srtp/tests/channels/SIP/sip_srtp/run-test Tue Jun 21 20:19:42 2011
@@ -25,9 +25,11 @@
class SIPCallTest:
def __init__(self, argv):
- self.chan1_connected = False
- self.chan2_connected = False
- self.srtp_connected = False
+ self.connected_chan1 = False
+ self.connected_chan2 = False
+ self.connected_srtp1 = False
+ self.connected_srtp2 = False
+
self.f = fastagi.FastAGIFactory(self.fastagi_func)
reactor.listenTCP(4573, self.f, 50, '127.0.0.1')
reactor.callWhenRunning(self.run)
@@ -50,21 +52,33 @@
self.ast2.install_configs("%s/configs/ast2" % (testdir))
def fastagi_func(self, agi):
- sequence = fastagi.InSequence()
- def get_channel(c):
- print "Connection received for %s ..." % c
- if c.split("-")[0] == "SIP/127.0.0.1:5061":
+ def get_test_result(val):
+ print "Connection result '%s'" % val
+ #if val.split("-")[0] == "SIP/127.0.0.1:5061":
+ if val.split("-")[0] == "SIP/2000":
# Outgoing call on Ast1
- self.chan1_connected = True
- elif c.split("-")[0] == "SIP/1000":
+ self.connected_chan1 = True
+ if val.split("=")[1] == "1":
+ self.connected_srtp1 = True
+ elif val.split("-")[0] == "SIP/1000":
# Incoming call on Ast2
- self.chan2_connected = True
- agi.getVariable("CHANNEL").addCallback(get_channel)
- #BUGBUG need to check if connected with SRTP
- self.srtp_connected = True
- sequence.append(agi.execute, "Wait", "5")
- sequence.append(agi.hangup)
- sequence.append(agi.finish)
+ self.connected_chan2 = True
+ if val.split("=")[1] == "1":
+ self.connected_srtp2 = True
+
+ agi.getVariable("TEST_RESULT").addCallback(get_test_result)
+
+ #def get_secure_media(val):
+ # print "Secure media is '%s'" % val
+ # if val == "1":
+ # self.srtp_connected = True
+ #agi.getVariable("CHANNEL(secure_media)").addCallback(get_secure_media)
+ #
+ #sequence = fastagi.InSequence()
+ #sequence.append(agi.execute, "Wait", "2")
+ #sequence.append(agi.hangup)
+ #sequence.append(agi.finish)
+ #sequence()
def stop_reactor(self):
print "Stopping Reactor ..."
@@ -86,12 +100,10 @@
reactor.callLater(20, self.stop_reactor)
- self.ast1.cli_exec("sip set debug on")
- self.ast2.cli_exec("sip set debug on")
-
- #self.ast1.cli_exec("originate SIP/2000 extension 1000 at siptest")
- #self.ast1.cli_exec("originate SIP/2000!2000 extension 1000 at siptest")
- self.ast1.cli_exec("originate SIP/2000 at 127.0.0.1:5061 extension 1000 at siptest1")
+ #self.ast1.cli_exec("originate SIP/2000 extension 1000 at siptest1")
+ #self.ast1.cli_exec("originate SIP/2000!2000 extension 1000 at siptest1")
+ #self.ast1.cli_exec("originate SIP/2000 at 127.0.0.1:5061 extension 1000 at siptest1")
+ self.ast1.cli_exec("originate SIP/2000/2000 extension 1000 at siptest1")
def main(argv=None):
@@ -100,7 +112,8 @@
test = SIPCallTest(argv)
reactor.run()
test.stop_asterisk()
- if test.chan1_connected and test.chan2_connected and test.srtp_connected:
+ print "BUGBUG test.connected_chan1:%s test.connected_srtp1:%s test.connected_chan2:%s test.connected_srtp2:%s" % (test.connected_chan1, test.connected_srtp1, test.connected_chan2, test.connected_srtp2)
+ if test.connected_chan1 and test.connected_srtp1 and test.connected_chan2 and test.connected_srtp2:
return 0
return 1
More information about the asterisk-commits
mailing list