- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 Asterisk ARI 来监视与桥相关的事件。我正在使用 Asterisk 13.6.0。
具体来说,我想知道桥何时创建或销毁,以及用户( channel )何时加入或离开桥。在我的服务器上,桥是在有人拨入时动态创建的,并在最后一个成员离开桥时自动销毁。
使用 node-ari-client来自 Asterisk 项目的库,并遵循他们的一些示例代码,这就是我目前所拥有的。
var client = require("ari-client");
var util = require("util");
client.connect("http://localhost:8088", "username", "password")
.then(function (ari) {
ari.once("StatisStart", channelJoined);
function channelJoined (event, incoming) {
incoming.on("BridgeCreated", function(event, bridge) {
console.log(util.format("Bridge created: %s", bridge.id));
});
incoming.on("BridgeDestroyed", function(event, bridge) {
console.log(util.format("Bridge destroyed: %s", bridge.id));
});
incoming.on("ChannelEnteredBridge", function(event, channel) {
console.log(util.format("Bridge was joined by: %s", channel.id));
});
incoming.on("ChannelLeftBridge", function(event, channel) {
console.log(util.format("Bridge was joined by: %s", channel.id));
});
}
ari.start("bridge-watcher");
})
.done();
我预计 .on()
处理程序会在各种事件发生时打印到控制台。然而,调用一座桥,离开一座桥,没有任何东西被打印到控制台。
如果重要的话,这里是 npm ls
的输出,显示了我正在使用的版本。 Node 是 v0.10.36。
├─┬ ari-client@0.5.0
│ ├── backoff-func@0.1.2
│ ├── bluebird@2.9.34
│ ├── node-uuid@1.4.1
│ ├─┬ swagger-client@2.0.26
│ │ ├── btoa@1.1.1
│ │ └─┬ shred@0.8.10
│ │ ├── ax@0.1.8
│ │ ├── cookiejar@1.3.1
│ │ ├── iconv-lite@0.2.11
│ │ └── sprintf@0.1.1
│ ├── underscore@1.6.0
│ └─┬ ws@0.4.31
│ ├── commander@0.6.1
│ ├── nan@0.3.2
│ ├── options@0.0.5
│ └── tinycolor@0.0.1
├── bluebird@3.1.1
└─┬ util@0.10.3
└── inherits@2.0.1
最佳答案
Specifically, I want to know when a bridge has been created or destroyed, and when a user (channel) has joined or left the bridge. On my server, bridges are created dynamically when someone dials in, and destroyed automatically when the last member leaves the bridge.
请记住:ARI 的主要目的是 build your own dialplan applications , 而不是监控整个 Asterisk。因此,默认情况下,您的外部应用程序不会订阅 Asterisk 中的资源。作为Channels in a Stasis Application部分解释:
Resources in Asterisk do not, by default, send events about themselves to a connected ARI application. In order to get events about resources, one of three things must occur:
The resource must be a channel that entered into a Stasis dialplan application. A subscription is implicitly created in this case. The subscription is implicitly destroyed when the channel leaves the Stasis dialplan application.
While a channel is in a Stasis dialplan application, the channel may interact with other resources - such as a bridge. While channels interact with the resource, a subscription is made to that resource. When no more channels in a Stasis dialplan application are interacting with the resource, the implicit subscription is destroyed.
At any time, an ARI application may make a subscription to a resource in Asterisk through application operations. While that resource exists, the ARI application owns the subscription.
如果您希望在 Asterisk 中自动获取 channel 在 bridge-watcher
应用程序之外使用的资源的事件,除非您执行以下两种操作之一,否则您将无法获取它们:
使用 applications resource 显式订阅资源.这适用于相对静态和/或长期存在的资源,例如端点、静态桥(例如用于 session 的桥)、邮箱和设备状态。它不适用于临时资源。
在 Asterisk 13.6.0 及更高版本中,您现在可以在连接 WebSocket 时订阅所有事件源。在 node-ari-client
中,您将执行以下操作:
ari.start(bridge-watcher, true);
但是您应该注意,即使您订阅了所有资源,您也不会明确地拥有它们。您只能自动观看它们。所有权的概念在 ARI 中非常重要,特别是因为它涉及您可以和不能对 channel 做什么以及何时。我链接的 wiki 页面提供了一些关于其工作原理的合理文档。
关于javascript - 使用 ARI 监视与桥梁相关的事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34551454/
a = [ "a", "b", "c", "d", "e" ] 这两种说法有什么区别? a[1,3] #=> [ "b", "c", "d" ] 对比 a[1..3]
我按照此处的教程 (https://github.com/apache/aries-jpa/tree/master/examples) 运行 aries-jpa 示例,但没有成功。 README.md
万字长文解析最常见的数据库恢复算法: ARIES 首发地址: https://mp.weixin.qq.com/s/Kc13g8OHK1h_f7eMlnl4Aw Intro
我想知道是否有人有录制 ARI 桥来分离文件、未混合的经验(或至少分离立体声文件的 L 和 R channel )。似乎这可以通过记录单独的 channel 来实现,但这些 channel 无法桥接。
我正在尝试使用 ARI API 发起调用,我遵循的过程是 POST/ari/channels 创建 channel 1 到本地扩展 POST/ari/bridges 创建网桥 POST/ari/bri
我正在尝试使用 Asterisk ARI 来监视与桥相关的事件。我正在使用 Asterisk 13.6.0。 具体来说,我想知道桥何时创建或销毁,以及用户( channel )何时加入或离开桥。在我的
为什么在聚类方法中使用调整兰德指数 (ARI) 和归一化互信息 (NMI) 比简单的测试分数(例如 MSE)能获得更好的测量结果?我明白哪个点属于哪个簇在聚类算法中很重要,并且标记是任意的。 最佳答案
给定一棵 n 元整数树,任务是找到一个子序列的最大和,其约束条件是序列中的任何 2 个数字都不应共享树中的公共(public)边。例子: 1个 /\ 2 5 /\ 3 4最大非相邻和 = 3 + 4
我无法通过控制台浏览器(lynx、elinks)在 ARI 中进行身份验证 cat/etc/asterisk/ari.conf : [general] enabled = yes pret
如果 Aries 算法已经知道在分析阶段后要撤消哪些事务,为什么要在撤消之前应用重做? 我知道(认为)它与 Lsn 编号和保持一致性有关,因为鉴于磁盘上刷新的数据可能与崩溃时撤消事务不同,撤消事务(由
在ARIES algorithm ,为什么它需要在重做通行证中重复崩溃前的所有历史记录?我可以在分析过程中获取提交的事务编号,然后重做提交的事务日志记录吗?这种方法将减少需要重做和撤消的记录数。 最佳
我目前正在为 asterisk 开发静音功能,我可以使用 asterisk ARI 从我的 Web 前端运行它。 但每次我尝试运行/调用静音函数时,都会出现以下错误: Error: { "mess
我想接受一个返回元组的函数。有没有办法描述函数的返回元组长度? 最佳答案 似乎不是。可能是因为它在形式逻辑中不是必需的,因为使用了 2 个函数而不是一个具有两个输出的函数。 如果 arity 或 ad
我用Java编写了一个K-ary树结构的程序,所以我试图找到树的叶子数.. import java.util.List; import java.util.ArrayList; /** A tree
我正在遵循位于:Camel MyBatis Integration Guide 的设置指南。我正在使用服务混合 5.0.1。我使用了 features-install spring-mybatis 来
计算ARI时与 scikit's implementation ,我注意到一个奇怪的情况。对于某些看起来标签上高度一致的列表,ARI 仍然是 0.0 甚至更糟。 我尝试了几种标签,以下是观察到的最奇怪
我想找出一个函数 f(x) 来计算 k 叉树中的叶子数。例如,假设我们创建了一棵树,它以根 4 开始,有 3 个 child ,每个 child 分别为 -1、-2、-3。我们的叶子只会是 0 值,而
我正在尝试用 C++ 设计一个树类,但我遇到了节点销毁的问题。 如果我销毁一个节点,我不想销毁它的整个子树,因为可能有其他东西指向它。所以显而易见的解决方案是使用引用计数。我会有一个指向父节点的弱指针
我在销毁树时遇到删除节点的问题。每个节点都是在我的 Tree 类中定义的结构: struct node { Skill skill; node** child; node
我正在尝试编写一个程序,将家谱表示为 n 叉树。该程序必须从 CSV 文件中读取名称并构建树。树由以下结构表示: typedef struct NTree_S { char * na
我是一名优秀的程序员,十分优秀!