Overview

ARI有很多部分 - Asterisk服务请求的HTTP server,将channel的控制权交给连接的client的dialplan应用,在asterisk和外呼应用之间共享状态的websocket。这里提供asterisk的配置文件:对其修改以满足开发的要求。

此页面没有涵盖系统管理员可用的所有选项,但是它涵盖了为ARI配置asterisk的一些基础知识。

Asterisk Configuration Options for ARI

HTTP Server

asterisk中的HTTP server是通过http.conf配置的。请注意,这里并没有描述了http.conf中所有选项 - 相反,他它列出了ARI最有用的选项。

Section Parameter Type Default Description
general
enabled Boolean False Enable the HTTP server. The HTTP server in Asterisk is disabled by default. Unless it is enabled, ARI will not function!
bindaddr IP Address The IP address to bind the HTTP server to. This can either be an explicit local address, or 0.0.0.0 to bind to all available interfaces.
prefix String A prefix to require for all requests. If specified, requests must begin with the specified prefix.
tlsenable Boolean False Enable HTTPS
tlsbindaddr IP Address/Port The IP address and port to bind the HTTPS server to. This should be an IP address and port, e.g., 0.0.0.0:8089
tlscertfie Path The full path to the certificate file to use. Asterisk only supports the .pem format.
tlsprivatekey Path The full path to the private key file. Asterisk only supports the .pem format. If this is not specified, the certificate specified in tlscertfile will be searched for the private key.

http.conf示例

[general]
enabled = yes
bindaddr = 0.0.0.0
bindport = 8088
TLS
强烈建议使用TLS加密HTTP信令,使用安全的websocket接收事件。这需要在http.conf配置TLS信息,从你的ARI应用创建安全的websocket/HTTP连接。

ARI Configuration

ARI users和properties通过ari.conf配置。请注意,这里并没有罗列所有的选项;此列表包含ARI中配置users的最有用的选项。有关完整说明,请参阅ARI configuration文档。

Section Parameter Type Default Description
general
enabled Boolean False Enable/disable ARI.
pretty Boolean No Format JSON responses and events in a human readable form. This makes the output easier to read, at the cost of some additional bytes.
allowed_origins String A comma separated list of allowed origins for Cross-Origin Resource Sharing.
[user_name]
type String Must be user. Specifies that this configuration section defines a user for ARI.
read_only Boolean No Whether or not the user can issue requests that alter the Asterisk system. If set to Yes, then only GET and OPTIONS HTTP requests will be serviced.
password_format String plain Can be either plain or crypt. When the password is plain, Asterisk will expect the user’s password to be in plain text in the password field. When set to crypt, Asterisk will use crypt(3) to decrypt the password. A crypted password can be generated using mkpasswd -m sha-512.
password String The password for the user.

ari.conf示例

[general]
enabled = yes
pretty = yes
allowed_origins = localhost:8088,http://ari.asterisk.org[asterisk]
type = user
read_only = no
password = asterisk; password_format may be set to plain (the default) or crypt. When set to crypt,
; crypt(3) is used to validate the password. A crypted password can be generated
; using mkpasswd -m sha-512.
;
[asterisk-supersecret]
type = user
read_only = no
password = $6$nqvAB8Bvs1dJ4V$8zCUygFXuXXp8EU3t2M8i.N8iCsY4WRchxe2AYgGOzHAQrmjIPif3DYrvdj5U2CilLLMChtmFyvFa3XHSxBlB/
password_format = crypt

Configuring the Dialplan for ARI

默认情况下,ARI不能asteirsk中的任意channel。channel可能在一个长期运行的dialplan应用;也可能由AGI控制;可能已经挂断。如果asteirsk没有以安全的方式将信道控制权交给ARI,那么ARI暴露的很多操作根本就不安全。
为了将channel交给ARI,asterisk使用名为Stasis的dialplan应用。Stasis 和asterisk的其他dialplan应用一样,除了安全的将控制权交给ARI应用之外不做任何事情。Stasis dialplan应用有两个参数:

  • channel移交的ARI应用的名称。在单个asterisk实例可以存在多个ARI应用,每个ARI应用只能操作他控制的channels。
  • 移交ARI时传递给ARI应用的参数

Example: Two ARI Applications

extension.conf中dialplan的片段,说明了两个ARI应用。第一个channel到ARI的"Intro-IVR"的ARI应用没有任何附加参数,第二个channel到ARI应用的"Super-Conference"带有一个参数:指定进入的会议室。

[default]exten => ivr,1,NoOp()same =>     n,Stasis(Intro-IVR)same =>     n,Hangup()exten => conference,1,NoOp()same =>            n,Stasis(Super-Conference,100)same =>            n,Hangup()

当channel进入Stasis应用时,asterisk将检查是否为该应用建立websocket连接。如果是,将channel移交给ARI控制,为websocekt订阅channel事件,并向websocket发送StasisStart事件,通知它channel已经进入应用。

websocket连接是必须的。
如果你没有为特定应用创建到asterisk的websocket连接,当一个channel进入应用的Stasis时,asterisk将立即从应用中获取channel并返给dialplan。This is to prevent channels from entering into an application before something is ready to handle them.
请注意,如果连接断开,asterisk将知道之前存在的连接,并允许channel进入(尽管你收到告警:事件丢失);

Asterisk Configuration for ARI相关推荐

  1. Asterisk REST Interface(ARI)

    The Evolution of Asterisk APIs(asterisk API的演变) 当Asterisk于1999首次创建时,其设计主要在于成为一个独立的Private Branch eXc ...

  2. asterisk配置文详解

    asterisk配置文详解 Configuration GuideYou've  installed Asterisk and verified that it will  start up.Now ...

  3. Analog Trunk Features (模拟中继特征)

    Analog Trunk Features (模拟中继特征) usedistinctiveringdetection: Whether or not to attempt to recognize d ...

  4. Asterisk安装

    一.获取asterisk安装包 wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-1.6.0.ta ...

  5. 使用数据库保存Asterisk sip账号信息(odbc方式)

    在默认情况下,Asterisk的配置文件都保存在/etc/asterisk目录中,以ini文件的格式保存.我们也可以使用数据库来保存大多数Asterisk配置信息. Asterisk使用数据库保存配置 ...

  6. asterisk使用MYSQL认证的配置方法

    asterisk要使用MYSQL实时认证peers,就必须安装asterisk的realtime 和 mysql 模块,这些模块在asterisk插件包中 下载地址是:http://www.aster ...

  7. Asterisk 可加载模块

    app_adsiprog.so => (Asterisk ADSI Programming Application) --用于支持模拟显示服务接口的终端设备,在终端屏幕上操作菜单等. app_a ...

  8. Asterisk内核 拾遗

    转载地址:http://linmuyi9999.blog.163.com/blog/static/6681608200928113330936/ Asterisk是一个开源的pbx系统,在公开的资料中 ...

  9. PCIE ARI技术

    目录 1.ARI简介 2.ARI配置过程 3.ARI寄存器 3.1 ARI Capability Header 3.2 ARI Capability Register 3.3 ARI Control ...

最新文章

  1. 8 pycharm 快捷键_Pycharm自动添加文件头注释和函数注释参数
  2. try-catch语句讲解
  3. AntD02 Table组件的使用
  4. 利用Linux命令行进行文本按行去重并按重复次数排序yes
  5. 学习学习SpringSecurity
  6. mysql 新增返回主键自增id_详解mysql插入数据后返回自增ID的七种方法
  7. 程序、线程、进程的区别(python、Java举例)
  8. [转载] Python算法
  9. .net pdf转图片_如何将PDF转图片?PDF转图片免费方法!
  10. windows部署novnc浏览器远程控制windows
  11. 西门子S7-200PLC基本入门编程
  12. 早期系统虚拟机分享 windows虚拟机vmdk
  13. 寒江独钓第3章——串口过滤
  14. 虚拟机:虚拟机三种网络连接
  15. 马士兵 java se_马士兵javase(170804)
  16. PodfileKit将github上常见的iOS(Swift)第三方框架进行了汇总,并且将框架进行了分类,为用户管理第三方框架提供了方便。
  17. 审稿人意见回复 Response to revierwers (Updating)
  18. plt绘图—取消坐标轴,边框处理,白边处理,颜色图谱
  19. 让你读过的书都变成钱!
  20. HDU2549:壮志难酬

热门文章

  1. android距离感应器控制黑屏,白屏
  2. 2021年互联网大厂Java面经总结,保准看明白!
  3. 程序报错未定义的引用
  4. office中“Error! Reference source not found.“”错误! 参考源未找到“的问题解决方案...
  5. Springmvc+Mybatis( 配置Conveter转换器 转换工厂 (来转换数据格式)),报错,搞好了
  6. 小游戏:HelloColor
  7. 足球数据API接口 - 【即时指数2】API调用示例代码
  8. 什么是软阀值?什么是硬阀值?
  9. 中国Azure新数据中心(区域)正式商用
  10. python爬虫小项目: 爬取百度贴吧帖子