Asterisk连接器用于Asterisk调用Odoo应用程序。

asterisk-calls-agent的Python项目详细描述


https://apps.odoo.com/apps/modules/13.0/asterisk_calls/icon.png

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世界都能从中受益。在

Installation

当前,在安装此软件包之前,您应该手动安装所需的依赖项:

pip3 install -r requirements.txt

之后,您可以从PyPi安装它:

^{pr2}$

Configuration

Agent

使用Nameko样式配置。有关默认配置,请参见config.yml。在

#TODO:请在此描述配置选项。在

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

就这样。在

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java JavaFX触控事件未触发Ubuntu 20.04触控笔记本电脑   java如何在AWT中关闭窗口?   java Dagger 2:注入具有构造函数参数的成员   创建对象的Java调用类   对象我想在A.java中添加两个数字,并在B.java中打印结果(如何?)   java如何使用AWS SDK for Android从数字海洋空间下载图像?   java Facebook sdk 4.0.1无法使用Android studio获取某些字段   4分钟后web应用程序(Angular 8和Rest API)中的java自动会话超时   在Eclipse for Java EE developers edition中禁用HTML警告   java按字母顺序排列字符串我错过了什么明显的东西吗?   java在Jshell中println和printf有什么不同