Asterisk连接器用于Asterisk调用Odoo应用程序。
asterisk-calls-agent的Python项目详细描述
目录
Introduction
Asterisk Calls Agent是一种中间件软件,用作Odoo之间的桥梁 和Asterisk IP-PBX。在
使用Asterisk Calls客户端使Odoo成为一个电话应用程序平台,因为所有的开发 在Odoo级别完成,这样每个Odoo开发人员都可以快速方便地集成Asterisk 任何Odoo模块的功能。在
代理体系结构是基于回调的,其中每个回调都是一个Odoo方法。在
在许多情况下,没有修改的代理都可以工作 Asterisk Calls应用程序。在
Dependencies
Asterisk Calls代理基于Nameko-一个很棒的Python微服务框架。在
星号调用代理非常小,因为与Odoo相关的操作来自nameko-odoo库 与星号相关的操作来自nameko-ami库。在
虽然Asterisk Calls代理是作为商业模块Asterisk Calls的基础开发的,但它确实是 决定在LGPL许可下开放和免费代理,这样所有的Odoo世界都能从中受益。在
Configuration
Asterisk
请参阅有关为代理准备星号的文档Asterisk Calls module。在
Running Asterisk Calls Agent
您可以从以下任何位置手动启动代理:
nameko run --config=config.yml asterisk_calls_client
您还可以创建systemd服务文件asterisk_calls_agent.service,然后 安装它以在引导时启动代理(根据您的环境调整它)。在
[Unit]Description=Asterisk Calls Odoo connector After=network.target [Service]Environment="ASTERISK_SYSTEM_NAME=asterisk"User=root ExecStart=/usr/local/bin/nameko run --config=/etc/asterisk_calls_agent.yml asterisk_calls_agent Restart=always RemainAfterExit=no StandardOutput=syslog StandardError=syslog SyslogIdentifier=ASTERISK_CALLS_AGENT [Install]WantedBy=multi-user.target
,并激活它:
systemctl daemon-reload
systemctl enable asterisk_calls_agent
systemctl start asterisk_calls_agent
systemctl status asterisk_calls_agent
Support & Contributing
随时为问题和想法创建新的门票。在
Development
正如在一开始所说的开发是在奥多层完成的。在
特工会转给指定的奥多 AMI messages。在
你的AMI要知道你的邮件应该转发到哪一个 配置文件中的事件映射。在
假设我们要收集通话记录。在这种情况下,你需要 将Cdrevent映射到将接收它的Odoo模型和方法。 将以下部分添加到config.yml:
EVENT_MAP:-name:Cdrtype:AMImodel:asterisk_calls.callmethod:create_cdr
现在在名为asterisk_calls的Odoo应用程序中(只是一个示例)创建一个方法 create_cdr,包含以下内容:
classCall(models.Model):_name='asterisk_calls.call'_description='Call Log'src=fields.Char()dst=fields.Char()channel=fields.Char()# The rest fields are ommited...@api.modeldefcreate_cdr(self,event):get=event['headers'].getdata={'accountcode':get('AccountCode'),'src':get('Source'),'dst':get('Destination'),'dcontext':get('DestinationContext'),'clid':get('CallerID'),'channel':get('Channel'),'dstchannel':get('DestinationChannel'),'lastapp':get('LastApplication'),'lastdata':get('LastData'),'started':get('StartTime')orFalse,'answered':get('AnswerTime')orFalse,'ended':get('EndTime')orFalse,'duration':get('Duration'),'billsec':get('BillableSeconds'),'disposition':get('Disposition'),'amaflags':get('AMAFlags'),'uniqueid':get('UniqueID')orget('Uniqueid'),'linkedid':get('Linkedid'),'userfield':get('UserField'),'system_name':get('SystemName'),}self.create(data)returnTrue
就这样。在
- 项目
标签: