Browse Source

Merge pull request #12 from akretion/8.0-fix-bug11-ami-test

[FIX] Bug #11 AMI test: success is now only reported when it really works
pull/22/head
Pedro M. Baeza 10 years ago
parent
commit
31da3d8d6b
  1. 6
      asterisk_click2dial/asterisk_click2dial.py

6
asterisk_click2dial/asterisk_click2dial.py

@ -248,6 +248,7 @@ class asterisk_server(orm.Model):
def test_ami_connection(self, cr, uid, ids, context=None):
assert len(ids) == 1, 'Only 1 ID'
ast_server = self.browse(cr, uid, ids[0], context=context)
ast_manager = False
try:
ast_manager = Manager.Manager(
(ast_server.ip_address, ast_server.port),
@ -258,14 +259,11 @@ class asterisk_server(orm.Model):
_("Connection Test Failed!"),
_("Here is the error message: %s" % e))
finally:
try:
if ast_manager:
ast_manager.Logoff()
except Exception:
pass
raise orm.except_orm(
_("Connection Test Successfull!"),
_("OpenERP can successfully login to the Asterisk Manager "
_("Odoo can successfully login to the Asterisk Manager "
"Interface."))
def _get_calling_number(self, cr, uid, context=None):

Loading…
Cancel
Save