Implementado asistente en la configuracion para probar llamada.
This commit is contained in:
parent
a9648c0e3c
commit
def7b79d7a
|
@ -5,6 +5,7 @@ from trytond.pool import Pool
|
||||||
from . import user
|
from . import user
|
||||||
from . import config
|
from . import config
|
||||||
from . import calls
|
from . import calls
|
||||||
|
from . import test_configuration
|
||||||
|
|
||||||
__all__ = ['register']
|
__all__ = ['register']
|
||||||
|
|
||||||
|
@ -15,8 +16,10 @@ def register():
|
||||||
calls.Caller,
|
calls.Caller,
|
||||||
user.User,
|
user.User,
|
||||||
config.Configuration,
|
config.Configuration,
|
||||||
|
test_configuration.TestConfigurationStart,
|
||||||
module='tryphone', type_='model')
|
module='tryphone', type_='model')
|
||||||
Pool.register(
|
Pool.register(
|
||||||
|
test_configuration.TestConfiguration,
|
||||||
module='tryphone', type_='wizard')
|
module='tryphone', type_='wizard')
|
||||||
Pool.register(
|
Pool.register(
|
||||||
module='tryphone', type_='report')
|
module='tryphone', type_='report')
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
from trytond.model import ModelView, fields
|
||||||
|
from trytond.wizard import Wizard, StateView, StateTransition, Button
|
||||||
|
from trytond.pool import Pool
|
||||||
|
from trytond.transaction import Transaction
|
||||||
|
|
||||||
|
class TestConfigurationStart(ModelView):
|
||||||
|
"Test configuration start form"
|
||||||
|
|
||||||
|
__name__ = 'tryphone.test_configuration.start'
|
||||||
|
|
||||||
|
to = fields.Char('To')
|
||||||
|
|
||||||
|
|
||||||
|
class TestConfiguration(Wizard):
|
||||||
|
__name__ = 'tryphone.test_configuration'
|
||||||
|
|
||||||
|
start = StateView('tryphone.test_configuration.start',
|
||||||
|
'',
|
||||||
|
[
|
||||||
|
Button(
|
||||||
|
"Cancel", 'end', 'tryton-cancel'),
|
||||||
|
Button(
|
||||||
|
"Import", 'try_call', 'tryton-ok', default=True)
|
||||||
|
])
|
||||||
|
try_call = StateTransition()
|
||||||
|
|
||||||
|
def transition_try_call(self):
|
||||||
|
pool = Pool()
|
||||||
|
Caller = pool.get('tryphone.caller')
|
||||||
|
User = pool.get('res.user')
|
||||||
|
user = User(Transaction().user)
|
||||||
|
destination = self.start.to
|
||||||
|
Caller.call(
|
||||||
|
user=user,
|
||||||
|
destination=self.start.to
|
||||||
|
)
|
||||||
|
return 'end'
|
|
@ -17,7 +17,7 @@ Usuario con extensión::
|
||||||
>>> config_pbx = ConfigPBX()
|
>>> config_pbx = ConfigPBX()
|
||||||
>>> config_pbx.host = '127.0.0.1'
|
>>> config_pbx.host = '127.0.0.1'
|
||||||
>>> config_pbx.port = 8706
|
>>> config_pbx.port = 8706
|
||||||
>>> config_pbx.api_client = 'freetwitch'
|
>>> config_pbx.api_client = 'test'
|
||||||
>>> config_pbx.api_password = 'some_password'
|
>>> config_pbx.api_password = 'some_password'
|
||||||
>>> config_pbx.save()
|
>>> config_pbx.save()
|
||||||
>>> config_pbx.host
|
>>> config_pbx.host
|
||||||
|
@ -25,7 +25,24 @@ Usuario con extensión::
|
||||||
>>> config_pbx.port
|
>>> config_pbx.port
|
||||||
8706
|
8706
|
||||||
>>> config_pbx.api_client
|
>>> config_pbx.api_client
|
||||||
'freetwitch'
|
'test'
|
||||||
>>> config_pbx.api_password
|
>>> config_pbx.api_password
|
||||||
'some_password'
|
'some_password'
|
||||||
|
|
||||||
|
Hacer llamada de prueba::
|
||||||
|
|
||||||
|
>>> User = Model.get('res.user')
|
||||||
|
>>> users = User.find()
|
||||||
|
>>> users[0].login
|
||||||
|
'admin'
|
||||||
|
>>> admin = users[0]
|
||||||
|
>>> admin.phone_extension = '120'
|
||||||
|
>>> admin.save()
|
||||||
|
|
||||||
|
>>> test_configuration = Wizard('tryphone.test_configuration', [])
|
||||||
|
>>> test_configuration.form.to = '8099'
|
||||||
|
>>> test_configuration.execute('try_call')
|
||||||
|
>>> CallLog = Model.get('tryphone.call_log')
|
||||||
|
>>> call_logs = CallLog.find()
|
||||||
|
>>> call_logs[0].destination
|
||||||
|
'8099'
|
||||||
|
|
Loading…
Reference in New Issue