[svn-commits] mnicholson: testsuite/asterisk/trunk r1680 - in /asterisk/trunk/tests/fax: ./...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jun 30 13:27:03 CDT 2011


Author: mnicholson
Date: Thu Jun 30 13:26:58 2011
New Revision: 1680

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=1680
Log:
11 tests for new fax gateway functionality

Added:
    asterisk/trunk/tests/fax/gateway_g711_t38/
    asterisk/trunk/tests/fax/gateway_g711_t38/configs/
    asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast1/
    asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast1/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/
    asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/extensions.conf   (with props)
    asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/sip.conf   (with props)
    asterisk/trunk/tests/fax/gateway_g711_t38/run-test   (with props)
    asterisk/trunk/tests/fax/gateway_g711_t38/send.tiff   (with props)
    asterisk/trunk/tests/fax/gateway_g711_t38/test-config.yaml   (with props)
    asterisk/trunk/tests/fax/gateway_mix1/
    asterisk/trunk/tests/fax/gateway_mix1/configs/
    asterisk/trunk/tests/fax/gateway_mix1/configs/ast1/
    asterisk/trunk/tests/fax/gateway_mix1/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/fax/gateway_mix1/configs/ast1/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/fax/gateway_mix1/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/
    asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/extensions.conf   (with props)
    asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/sip.conf   (with props)
    asterisk/trunk/tests/fax/gateway_mix1/run-test   (with props)
    asterisk/trunk/tests/fax/gateway_mix1/send.tiff   (with props)
    asterisk/trunk/tests/fax/gateway_mix1/test-config.yaml   (with props)
    asterisk/trunk/tests/fax/gateway_mix2/
    asterisk/trunk/tests/fax/gateway_mix2/configs/
    asterisk/trunk/tests/fax/gateway_mix2/configs/ast1/
    asterisk/trunk/tests/fax/gateway_mix2/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/fax/gateway_mix2/configs/ast1/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/fax/gateway_mix2/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/fax/gateway_mix2/configs/ast2/
    asterisk/trunk/tests/fax/gateway_mix2/configs/ast2/extensions.conf   (with props)
    asterisk/trunk/tests/fax/gateway_mix2/configs/ast2/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/fax/gateway_mix2/configs/ast2/sip.conf   (with props)
    asterisk/trunk/tests/fax/gateway_mix2/run-test   (with props)
    asterisk/trunk/tests/fax/gateway_mix2/send.tiff   (with props)
    asterisk/trunk/tests/fax/gateway_mix2/test-config.yaml   (with props)
    asterisk/trunk/tests/fax/gateway_mix3/
    asterisk/trunk/tests/fax/gateway_mix3/configs/
    asterisk/trunk/tests/fax/gateway_mix3/configs/ast1/
    asterisk/trunk/tests/fax/gateway_mix3/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/fax/gateway_mix3/configs/ast1/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/fax/gateway_mix3/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/fax/gateway_mix3/configs/ast2/
    asterisk/trunk/tests/fax/gateway_mix3/configs/ast2/extensions.conf   (with props)
    asterisk/trunk/tests/fax/gateway_mix3/configs/ast2/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/fax/gateway_mix3/configs/ast2/sip.conf   (with props)
    asterisk/trunk/tests/fax/gateway_mix3/run-test   (with props)
    asterisk/trunk/tests/fax/gateway_mix3/send.tiff   (with props)
    asterisk/trunk/tests/fax/gateway_mix3/test-config.yaml   (with props)
    asterisk/trunk/tests/fax/gateway_mix4/
    asterisk/trunk/tests/fax/gateway_mix4/configs/
    asterisk/trunk/tests/fax/gateway_mix4/configs/ast1/
    asterisk/trunk/tests/fax/gateway_mix4/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/fax/gateway_mix4/configs/ast1/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/fax/gateway_mix4/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/fax/gateway_mix4/configs/ast2/
    asterisk/trunk/tests/fax/gateway_mix4/configs/ast2/extensions.conf   (with props)
    asterisk/trunk/tests/fax/gateway_mix4/configs/ast2/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/fax/gateway_mix4/configs/ast2/sip.conf   (with props)
    asterisk/trunk/tests/fax/gateway_mix4/run-test   (with props)
    asterisk/trunk/tests/fax/gateway_mix4/send.tiff   (with props)
    asterisk/trunk/tests/fax/gateway_mix4/test-config.yaml   (with props)
    asterisk/trunk/tests/fax/gateway_native_t38/
    asterisk/trunk/tests/fax/gateway_native_t38/configs/
    asterisk/trunk/tests/fax/gateway_native_t38/configs/ast1/
    asterisk/trunk/tests/fax/gateway_native_t38/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/fax/gateway_native_t38/configs/ast1/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/fax/gateway_native_t38/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/fax/gateway_native_t38/configs/ast2/
    asterisk/trunk/tests/fax/gateway_native_t38/configs/ast2/extensions.conf   (with props)
    asterisk/trunk/tests/fax/gateway_native_t38/configs/ast2/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/fax/gateway_native_t38/configs/ast2/sip.conf   (with props)
    asterisk/trunk/tests/fax/gateway_native_t38/run-test   (with props)
    asterisk/trunk/tests/fax/gateway_native_t38/send.tiff   (with props)
    asterisk/trunk/tests/fax/gateway_native_t38/test-config.yaml   (with props)
    asterisk/trunk/tests/fax/gateway_native_t38_ced/
    asterisk/trunk/tests/fax/gateway_native_t38_ced/configs/
    asterisk/trunk/tests/fax/gateway_native_t38_ced/configs/ast1/
    asterisk/trunk/tests/fax/gateway_native_t38_ced/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/fax/gateway_native_t38_ced/configs/ast1/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/fax/gateway_native_t38_ced/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/fax/gateway_native_t38_ced/configs/ast2/
    asterisk/trunk/tests/fax/gateway_native_t38_ced/configs/ast2/extensions.conf   (with props)
    asterisk/trunk/tests/fax/gateway_native_t38_ced/configs/ast2/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/fax/gateway_native_t38_ced/configs/ast2/sip.conf   (with props)
    asterisk/trunk/tests/fax/gateway_native_t38_ced/run-test   (with props)
    asterisk/trunk/tests/fax/gateway_native_t38_ced/send.tiff   (with props)
    asterisk/trunk/tests/fax/gateway_native_t38_ced/test-config.yaml   (with props)
    asterisk/trunk/tests/fax/gateway_no_t38/
    asterisk/trunk/tests/fax/gateway_no_t38/configs/
    asterisk/trunk/tests/fax/gateway_no_t38/configs/ast1/
    asterisk/trunk/tests/fax/gateway_no_t38/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/fax/gateway_no_t38/configs/ast1/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/fax/gateway_no_t38/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/fax/gateway_no_t38/configs/ast2/
    asterisk/trunk/tests/fax/gateway_no_t38/configs/ast2/extensions.conf   (with props)
    asterisk/trunk/tests/fax/gateway_no_t38/configs/ast2/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/fax/gateway_no_t38/configs/ast2/sip.conf   (with props)
    asterisk/trunk/tests/fax/gateway_no_t38/run-test   (with props)
    asterisk/trunk/tests/fax/gateway_no_t38/send.tiff   (with props)
    asterisk/trunk/tests/fax/gateway_no_t38/test-config.yaml   (with props)
    asterisk/trunk/tests/fax/gateway_t38_g711/
    asterisk/trunk/tests/fax/gateway_t38_g711/configs/
    asterisk/trunk/tests/fax/gateway_t38_g711/configs/ast1/
    asterisk/trunk/tests/fax/gateway_t38_g711/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/fax/gateway_t38_g711/configs/ast1/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/fax/gateway_t38_g711/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/fax/gateway_t38_g711/configs/ast2/
    asterisk/trunk/tests/fax/gateway_t38_g711/configs/ast2/extensions.conf   (with props)
    asterisk/trunk/tests/fax/gateway_t38_g711/configs/ast2/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/fax/gateway_t38_g711/configs/ast2/sip.conf   (with props)
    asterisk/trunk/tests/fax/gateway_t38_g711/run-test   (with props)
    asterisk/trunk/tests/fax/gateway_t38_g711/send.tiff   (with props)
    asterisk/trunk/tests/fax/gateway_t38_g711/test-config.yaml   (with props)
    asterisk/trunk/tests/fax/gateway_timeout1/
    asterisk/trunk/tests/fax/gateway_timeout1/configs/
    asterisk/trunk/tests/fax/gateway_timeout1/configs/ast1/
    asterisk/trunk/tests/fax/gateway_timeout1/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/fax/gateway_timeout1/configs/ast1/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/fax/gateway_timeout1/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/fax/gateway_timeout1/configs/ast2/
    asterisk/trunk/tests/fax/gateway_timeout1/configs/ast2/extensions.conf   (with props)
    asterisk/trunk/tests/fax/gateway_timeout1/configs/ast2/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/fax/gateway_timeout1/configs/ast2/sip.conf   (with props)
    asterisk/trunk/tests/fax/gateway_timeout1/run-test   (with props)
    asterisk/trunk/tests/fax/gateway_timeout1/send.tiff   (with props)
    asterisk/trunk/tests/fax/gateway_timeout1/test-config.yaml   (with props)
    asterisk/trunk/tests/fax/gateway_timeout2/
    asterisk/trunk/tests/fax/gateway_timeout2/configs/
    asterisk/trunk/tests/fax/gateway_timeout2/configs/ast1/
    asterisk/trunk/tests/fax/gateway_timeout2/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/fax/gateway_timeout2/configs/ast1/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/fax/gateway_timeout2/configs/ast1/sip.conf   (with props)
    asterisk/trunk/tests/fax/gateway_timeout2/configs/ast2/
    asterisk/trunk/tests/fax/gateway_timeout2/configs/ast2/extensions.conf   (with props)
    asterisk/trunk/tests/fax/gateway_timeout2/configs/ast2/manager.general.conf.inc   (with props)
    asterisk/trunk/tests/fax/gateway_timeout2/configs/ast2/sip.conf   (with props)
    asterisk/trunk/tests/fax/gateway_timeout2/run-test   (with props)
    asterisk/trunk/tests/fax/gateway_timeout2/send.tiff   (with props)
    asterisk/trunk/tests/fax/gateway_timeout2/test-config.yaml   (with props)
Modified:
    asterisk/trunk/tests/fax/tests.yaml

Added: asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast1/extensions.conf?view=auto&rev=1680
==============================================================================
--- asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast1/extensions.conf Thu Jun 30 13:26:58 2011
@@ -1,0 +1,14 @@
+[receivefax]
+exten => 1234,1,noop
+exten => 1234,n,ReceiveFax(${ASTDATADIR}/receive.tiff)
+
+exten => h,1,noop
+exten => h,n,UserEvent(FaxStatus,operation: receive,status: ${FAXOPT(status)},statusstr: ${FAXOPT(statusstr)},error: ${FAXOPT(error)})
+
+[sendfax]
+exten => 1234,1,noop
+exten => 1234,n,SendFax(${ASTDATADIR}/send.tiff)
+
+exten => h,1,noop
+exten => h,n,UserEvent(FaxStatus,operation: send,status: ${FAXOPT(status)},statusstr: ${FAXOPT(statusstr)},error: ${FAXOPT(error)})
+

Propchange: asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast1/manager.general.conf.inc
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast1/manager.general.conf.inc?view=auto&rev=1680
==============================================================================
--- asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast1/manager.general.conf.inc (added)
+++ asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast1/manager.general.conf.inc Thu Jun 30 13:26:58 2011
@@ -1,0 +1,2 @@
+enabled = yes
+bindaddr = 127.0.0.1

Propchange: asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast1/manager.general.conf.inc
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast1/sip.conf?view=auto&rev=1680
==============================================================================
--- asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast1/sip.conf (added)
+++ asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast1/sip.conf Thu Jun 30 13:26:58 2011
@@ -1,0 +1,25 @@
+[general]
+bindaddr = 127.0.0.1
+
+[ast2-g711]
+type = friend
+fromuser = ast1-g711
+context = receivefax
+host = 127.0.0.2
+t38pt_udptl = no
+disallow = all
+allow = ulaw
+qualify = no
+insecure = invite
+
+[ast2-t38]
+type = friend
+fromuser = ast1-t38
+context = receivefax
+host = 127.0.0.2
+t38pt_udptl = yes
+disallow = all
+allow = gsm
+qualify = no
+insecure = invite
+

Propchange: asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/extensions.conf?view=auto&rev=1680
==============================================================================
--- asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/extensions.conf (added)
+++ asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/extensions.conf Thu Jun 30 13:26:58 2011
@@ -1,0 +1,8 @@
+[gatewayfax]
+exten => 1234,1,noop
+exten => 1234,n,Set(FAXOPT(gateway)=yes)
+exten => 1234,n,Dial(sip/ast1-t38/1234)
+
+exten => h,1,noop
+exten => h,n,UserEvent(FaxStatus,operation: gateway,status: ${FAXOPT(status)},statusstr: ${FAXOPT(statusstr)},error: ${FAXOPT(error)})
+

Propchange: asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/manager.general.conf.inc
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/manager.general.conf.inc?view=auto&rev=1680
==============================================================================
--- asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/manager.general.conf.inc (added)
+++ asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/manager.general.conf.inc Thu Jun 30 13:26:58 2011
@@ -1,0 +1,2 @@
+enabled = yes
+bindaddr = 127.0.0.2

Propchange: asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/manager.general.conf.inc
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/manager.general.conf.inc
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/manager.general.conf.inc
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/sip.conf?view=auto&rev=1680
==============================================================================
--- asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/sip.conf (added)
+++ asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/sip.conf Thu Jun 30 13:26:58 2011
@@ -1,0 +1,25 @@
+[general]
+bindaddr = 127.0.0.2
+
+[ast1-g711]
+type = friend
+fromuser = ast2-g711
+context = gatewayfax
+host = 127.0.0.1
+t38pt_udptl = no
+disallow = all
+allow = ulaw
+qualify = no
+insecure = invite
+
+[ast1-t38]
+type = friend
+fromuser = ast2-t38
+context = gatewayfax
+host = 127.0.0.1
+t38pt_udptl = yes
+disallow = all
+allow = gsm
+qualify = no
+insecure = invite
+

Propchange: asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/sip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/sip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/fax/gateway_g711_t38/configs/ast2/sip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/fax/gateway_g711_t38/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/fax/gateway_g711_t38/run-test?view=auto&rev=1680
==============================================================================
--- asterisk/trunk/tests/fax/gateway_g711_t38/run-test (added)
+++ asterisk/trunk/tests/fax/gateway_g711_t38/run-test Thu Jun 30 13:26:58 2011
@@ -1,0 +1,114 @@
+#!/usr/bin/env python
+# vim: sw=3 et:
+'''
+Copyright (C) 2011, Digium, Inc.
+Matthew Nicholson <mnicholson 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 re
+import shutil
+
+from twisted.internet import reactor
+
+sys.path.append("lib/python")
+from asterisk.asterisk import Asterisk
+from asterisk.TestCase import TestCase
+
+class GatewayTest(TestCase):
+   event_count = 0
+   success_count = 0
+   reactor_timeout = 120
+
+   def __init__(self, argv):
+      TestCase.__init__(self, argv)
+      self.create_asterisk(2)
+
+      # copy the tiff file we are going to send to a good known location
+      shutil.copy("%s/send.tiff" % (os.path.dirname(argv[0]),), "%s/var/lib/asterisk/" % (self.ast[0].base,))
+
+   def ami_connect(self, ami):
+      TestCase.ami_connect(self, ami)
+
+      if ami.id == 0:
+
+         print "sending a call from ast1 to ast2"
+
+         ami.registerEvent('UserEvent', self.fax_result)
+         df = ami.originate("sip/ast2-g711/1234", "sendfax", "1234", 1)
+
+         def handle_failure(reason):
+            print "error sending originate:"
+            print reason.getTraceback()
+            self.stop_reactor()
+
+            return reason
+
+         df.addErrback(handle_failure)
+      else:
+         ami.registerEvent('UserEvent', self.fax_gateway_result)
+
+   def fax_gateway_result(self, ami, event):
+      if event['userevent'] != 'FaxStatus':
+         return
+
+      self.event_count += 1
+
+      if event['status'] == "SUCCESS":
+         print "successful gateway operation"
+         self.success_count += 1
+      else:
+         print "gateway error:"
+         print "status: %s" % (event['status'],)
+         print "error: %s" % (event['error'],)
+         print "statusstr: %s" % (event['statusstr'],)
+
+      self.are_we_there_yet()
+
+   def fax_result(self, ami, event):
+      if event['userevent'] != 'FaxStatus':
+         return
+
+      self.event_count += 1
+
+      if event['status'] == "SUCCESS":
+         print "successful %s through gateway" % (event['operation'],)
+         self.success_count += 1
+      else:
+         print "error sending fax through gateway:"
+         print "operation: %s" % (event['operation'],)
+         print "status: %s" % (event['status'],)
+         print "error: %s" % (event['error'],)
+         print "statusstr: %s" % (event['statusstr'],)
+
+      self.are_we_there_yet()
+
+   def are_we_there_yet(self):
+      if self.event_count == 3:
+         if self.success_count == 3:
+            self.passed = True
+         self.stop_reactor()
+
+   def run(self):
+      TestCase.run(self)
+      self.create_ami_factory(2)
+
+
+def main(argv = sys.argv):
+   test = GatewayTest(argv)
+   test.start_asterisk()
+   reactor.run()
+   test.stop_asterisk()
+
+   if not test.passed:
+      return 1
+
+   return 0
+
+if __name__ == "__main__":
+   sys.exit(main() or 0)
+

Propchange: asterisk/trunk/tests/fax/gateway_g711_t38/run-test
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/fax/gateway_g711_t38/run-test
------------------------------------------------------------------------------
    svn:executable = *

Propchange: asterisk/trunk/tests/fax/gateway_g711_t38/run-test
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/fax/gateway_g711_t38/run-test
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/fax/gateway_g711_t38/send.tiff
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/fax/gateway_g711_t38/send.tiff?view=auto&rev=1680
==============================================================================
Binary file - no diff available.

Propchange: asterisk/trunk/tests/fax/gateway_g711_t38/send.tiff
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: asterisk/trunk/tests/fax/gateway_g711_t38/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/fax/gateway_g711_t38/test-config.yaml?view=auto&rev=1680
==============================================================================
--- asterisk/trunk/tests/fax/gateway_g711_t38/test-config.yaml (added)
+++ asterisk/trunk/tests/fax/gateway_g711_t38/test-config.yaml Thu Jun 30 13:26:58 2011
@@ -1,0 +1,25 @@
+testinfo:
+    summary: 'Test the fax gateway.'
+    description: |
+        This test verifies proper gateway functionality when the sending side
+        is g711 and the receiving side is t38. Two asterisk instances are
+        started and a call is made from ast1 to ast2. Ast2 will start a fax
+        gateway and send the call back to ast1. Ast2 runs SendFax() on the
+        sending side and ReceiveFax() on the receiving side. If the fax is
+        successful, the test passes.
+
+        The call flow looks like this:
+         |send        |
+         |g711    g711|
+         |----------->|
+         |     gateway|
+         |t38      t38|
+         |<-----------|
+        \|receive     |/
+
+properties:
+    minversion: '1.10'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+        - custom : 'fax'

Propchange: asterisk/trunk/tests/fax/gateway_g711_t38/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/fax/gateway_g711_t38/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/fax/gateway_g711_t38/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/fax/gateway_mix1/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/fax/gateway_mix1/configs/ast1/extensions.conf?view=auto&rev=1680
==============================================================================
--- asterisk/trunk/tests/fax/gateway_mix1/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/fax/gateway_mix1/configs/ast1/extensions.conf Thu Jun 30 13:26:58 2011
@@ -1,0 +1,14 @@
+[receivefax]
+exten => 1234,1,noop
+exten => 1234,n,ReceiveFax(${ASTDATADIR}/receive.tiff)
+
+exten => h,1,noop
+exten => h,n,UserEvent(FaxStatus,operation: receive,status: ${FAXOPT(status)},statusstr: ${FAXOPT(statusstr)},error: ${FAXOPT(error)})
+
+[sendfax]
+exten => 1234,1,noop
+exten => 1234,n,SendFax(${ASTDATADIR}/send.tiff)
+
+exten => h,1,noop
+exten => h,n,UserEvent(FaxStatus,operation: send,status: ${FAXOPT(status)},statusstr: ${FAXOPT(statusstr)},error: ${FAXOPT(error)})
+

Propchange: asterisk/trunk/tests/fax/gateway_mix1/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/fax/gateway_mix1/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/fax/gateway_mix1/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/fax/gateway_mix1/configs/ast1/manager.general.conf.inc
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/fax/gateway_mix1/configs/ast1/manager.general.conf.inc?view=auto&rev=1680
==============================================================================
--- asterisk/trunk/tests/fax/gateway_mix1/configs/ast1/manager.general.conf.inc (added)
+++ asterisk/trunk/tests/fax/gateway_mix1/configs/ast1/manager.general.conf.inc Thu Jun 30 13:26:58 2011
@@ -1,0 +1,2 @@
+enabled = yes
+bindaddr = 127.0.0.1

Propchange: asterisk/trunk/tests/fax/gateway_mix1/configs/ast1/manager.general.conf.inc
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: asterisk/trunk/tests/fax/gateway_mix1/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/fax/gateway_mix1/configs/ast1/sip.conf?view=auto&rev=1680
==============================================================================
--- asterisk/trunk/tests/fax/gateway_mix1/configs/ast1/sip.conf (added)
+++ asterisk/trunk/tests/fax/gateway_mix1/configs/ast1/sip.conf Thu Jun 30 13:26:58 2011
@@ -1,0 +1,25 @@
+[general]
+bindaddr = 127.0.0.1
+
+[ast2-g711]
+type = friend
+fromuser = ast1-t38
+context = receivefax
+host = 127.0.0.2
+t38pt_udptl = no
+disallow = all
+allow = ulaw
+qualify = no
+insecure = invite
+
+[ast2-t38]
+type = friend
+fromuser = ast1-t38
+context = receivefax
+host = 127.0.0.2
+t38pt_udptl = yes
+disallow = all
+allow = ulaw
+qualify = no
+insecure = invite
+

Propchange: asterisk/trunk/tests/fax/gateway_mix1/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/fax/gateway_mix1/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/fax/gateway_mix1/configs/ast1/sip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/extensions.conf?view=auto&rev=1680
==============================================================================
--- asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/extensions.conf (added)
+++ asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/extensions.conf Thu Jun 30 13:26:58 2011
@@ -1,0 +1,8 @@
+[gatewayfax]
+exten => 1234,1,noop
+exten => 1234,n,Set(FAXOPT(gateway)=yes)
+exten => 1234,n,Dial(sip/ast1-t38/1234)
+
+exten => h,1,noop
+exten => h,n,UserEvent(FaxStatus,operation: gateway,status: ${FAXOPT(status)},statusstr: ${FAXOPT(statusstr)},error: ${FAXOPT(error)})
+

Propchange: asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/manager.general.conf.inc
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/manager.general.conf.inc?view=auto&rev=1680
==============================================================================
--- asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/manager.general.conf.inc (added)
+++ asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/manager.general.conf.inc Thu Jun 30 13:26:58 2011
@@ -1,0 +1,2 @@
+enabled = yes
+bindaddr = 127.0.0.2

Propchange: asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/manager.general.conf.inc
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/manager.general.conf.inc
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/manager.general.conf.inc
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/sip.conf?view=auto&rev=1680
==============================================================================
--- asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/sip.conf (added)
+++ asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/sip.conf Thu Jun 30 13:26:58 2011
@@ -1,0 +1,25 @@
+[general]
+bindaddr = 127.0.0.2
+
+[ast1-g711]
+type = friend
+fromuser = ast2-g711
+context = gatewayfax
+host = 127.0.0.1
+t38pt_udptl = no
+disallow = all
+allow = ulaw
+qualify = no
+insecure = invite
+
+[ast1-t38]
+type = friend
+fromuser = ast2-t38
+context = gatewayfax
+host = 127.0.0.1
+t38pt_udptl = yes
+disallow = all
+allow = ulaw
+qualify = no
+insecure = invite
+

Propchange: asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/sip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/sip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/fax/gateway_mix1/configs/ast2/sip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/fax/gateway_mix1/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/fax/gateway_mix1/run-test?view=auto&rev=1680
==============================================================================
--- asterisk/trunk/tests/fax/gateway_mix1/run-test (added)
+++ asterisk/trunk/tests/fax/gateway_mix1/run-test Thu Jun 30 13:26:58 2011
@@ -1,0 +1,114 @@
+#!/usr/bin/env python
+# vim: sw=3 et:
+'''
+Copyright (C) 2011, Digium, Inc.
+Matthew Nicholson <mnicholson 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 re
+import shutil
+
+from twisted.internet import reactor
+
+sys.path.append("lib/python")
+from asterisk.asterisk import Asterisk
+from asterisk.TestCase import TestCase
+
+class GatewayTest(TestCase):
+   event_count = 0
+   success_count = 0
+   reactor_timeout = 120
+
+   def __init__(self, argv):
+      TestCase.__init__(self, argv)
+      self.create_asterisk(2)
+
+      # copy the tiff file we are going to send to a good known location
+      shutil.copy("%s/send.tiff" % (os.path.dirname(argv[0]),), "%s/var/lib/asterisk/" % (self.ast[0].base,))
+
+   def ami_connect(self, ami):
+      TestCase.ami_connect(self, ami)
+
+      if ami.id == 0:
+
+         print "sending a call from ast1 to ast2"
+
+         ami.registerEvent('UserEvent', self.fax_result)
+         df = ami.originate("sip/ast2-g711/1234", "sendfax", "1234", 1)
+
+         def handle_failure(reason):
+            print "error sending originate:"
+            print reason.getTraceback()
+            self.stop_reactor()
+
+            return reason
+
+         df.addErrback(handle_failure)
+      else:
+         ami.registerEvent('UserEvent', self.fax_gateway_result)
+
+   def fax_gateway_result(self, ami, event):
+      if event['userevent'] != 'FaxStatus':
+         return
+
+      self.event_count += 1
+
+      if event['status'] == "SUCCESS":
+         print "successful gateway operation"
+         self.success_count += 1
+      else:
+         print "gateway error:"
+         print "status: %s" % (event['status'],)
+         print "error: %s" % (event['error'],)
+         print "statusstr: %s" % (event['statusstr'],)
+
+      self.are_we_there_yet()
+
+   def fax_result(self, ami, event):
+      if event['userevent'] != 'FaxStatus':
+         return
+
+      self.event_count += 1
+
+      if event['status'] == "SUCCESS":
+         print "successful %s through gateway" % (event['operation'],)
+         self.success_count += 1
+      else:
+         print "error sending fax through gateway:"
+         print "operation: %s" % (event['operation'],)
+         print "status: %s" % (event['status'],)
+         print "error: %s" % (event['error'],)
+         print "statusstr: %s" % (event['statusstr'],)
+
+      self.are_we_there_yet()
+
+   def are_we_there_yet(self):
+      if self.event_count == 3:
+         if self.success_count == 3:
+            self.passed = True
+         self.stop_reactor()
+
+   def run(self):
+      TestCase.run(self)
+      self.create_ami_factory(2)
+
+
+def main(argv = sys.argv):
+   test = GatewayTest(argv)
+   test.start_asterisk()
+   reactor.run()
+   test.stop_asterisk()
+
+   if not test.passed:
+      return 1
+
+   return 0
+
+if __name__ == "__main__":
+   sys.exit(main() or 0)
+

Propchange: asterisk/trunk/tests/fax/gateway_mix1/run-test
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/fax/gateway_mix1/run-test
------------------------------------------------------------------------------
    svn:executable = *

Propchange: asterisk/trunk/tests/fax/gateway_mix1/run-test
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/fax/gateway_mix1/run-test
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/fax/gateway_mix1/send.tiff
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/fax/gateway_mix1/send.tiff?view=auto&rev=1680
==============================================================================
Binary file - no diff available.

Propchange: asterisk/trunk/tests/fax/gateway_mix1/send.tiff
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: asterisk/trunk/tests/fax/gateway_mix1/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/fax/gateway_mix1/test-config.yaml?view=auto&rev=1680
==============================================================================
--- asterisk/trunk/tests/fax/gateway_mix1/test-config.yaml (added)
+++ asterisk/trunk/tests/fax/gateway_mix1/test-config.yaml Thu Jun 30 13:26:58 2011
@@ -1,0 +1,25 @@
+testinfo:
+    summary: 'Test the fax gateway.'
+    description: |
+        This test verifies proper gateway functionality when a CED triggered
+        t38 negotiation request fails. The gateway should detect a CED tone
+        from the receiving side and send a t38 reinvite to the sending side.
+        The sending side will reject the reinvite. The gateway should detect
+        this and wait for the receiving side to send a T.38 reinvite and then
+        gateway the fax.
+
+        The call flow looks like this:
+         |send        |
+         |g711     t38|
+         |----------->|
+         |     gateway|
+         |t38      t38|
+         |<-----------|
+        \|receive     |/
+
+properties:
+    minversion: '1.10'
+    dependencies:
+        - python : 'twisted'
+        - python : 'starpy'
+        - custom : 'fax'

Propchange: asterisk/trunk/tests/fax/gateway_mix1/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/fax/gateway_mix1/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/fax/gateway_mix1/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/fax/gateway_mix2/configs/ast1/extensions.conf

[... 3424 lines stripped ...]



More information about the svn-commits mailing list