xmpp - Asterisk 中使用 Tigase 和 res_xmpp 的 Pubsub

标签 xmpp asterisk publish-subscribe tigase

我安装并配置了 Tigase 服务器,用于在多个 Asterisk 服务器之间分发设备状态。服务器工作正常。其配置文件如下:

--cluster-mode = true
config-type = --gen-config-def
--debug = server,xmpp,net
--user-db = mysql
--admins = admin@localhost
--user-db-uri = jdbc:mysql://localhost/tigasedb?user=root&password=no
--virt-hosts = localhost
--comp-name-3 = message-archive
--comp-class-3 = tigase.archive.MessageArchiveComponent
--comp-class-2 = tigase.socks5.Socks5ProxyComponent
--comp-name-2 = proxy
--comp-class-1 = tigase.muc.MUCComponent
--comp-name-1 = muc
--sm-plugins = +message-archive-xep-0136
#--ssl-container-class=tigase.extras.io.PEMSSLContextContainer
#--ssl-container-class=tigase.io.SSLContextContainer
--comp-name-1=pubsub
--comp-class-1=tigase.pubsub.PubSubComponent

我在两个不同的系统上安装了两个 Asterisk 服务器。我还在两者上编译了 res_xmpp 并使用以下配置文件对其进行了配置:

[general]
debug=yes
autoregister=yes
collection_nodes=yes
pubsub_autocreate=yes

[tigase]
type=client
serverhost=192.168.20.105
username=server1@localhost/voip1
pubsub_node=pubsub.192.168.20.105
secret=123456
priority=25
port=5222
usetls=yes
usesasl=yes
status=available
statusmessage="I am available"
timeout=5
buddy=server2@localhost/voip2
distribute_events=yes

我的一台服务器的用户名是 server1@localhost/voip1,另一台服务器的用户名是 server2@localhost/voip2。现在xmpp模块可以正常工作了。但 pubsub 事件无法正确分发。如您所见,我使用 IP 地址来区分我的 Tigase 服务器。如果我在 res_xmpp 模块的 pubsub_node 选项中使用相同的 IP 地址,服务器将返回“功能未实现”错误,错误代码为 501;因此,我使用了 pubsub.192.168.20.105 并将其设置在两台服务器的/etc/hosts 中,没有错误消息,但我也不会收到事件! 我该如何解决这个问题?

最佳答案

我在 Tigase 服务器和 Asterisk 上也遇到了同样的问题;你的问题是你设置:

pubsub_autocreate=yes

在 xmpp.conf 中进行配置。该选项会导致自动创建许多节点;如果您查看 Tigase 数据库中的 tig_nodes,您将看到已经创建了许多节点。您必须评论该选项。之后,您必须重新部署 Tigase SQL 架构,否则您必须删除所有这些节点;那么一切都会好起来的。通过查看 Asterisk CLI 中 res_xmpp 模块的调试输出,您将看到 res_xmpp 将尝试一次订阅许多节点,这会导致困惑,因为存在许多同名节点;服务器将返回 409 和 501 错误。

关于xmpp - Asterisk 中使用 Tigase 和 res_xmpp 的 Pubsub,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20439852/

相关文章:

node.js - MQTT 到卡夫卡。如何避免重复

c++ - linux 上的链接问题(找不到合适的库的名称)

Jabber 的 Lua 库

android - 添加聊天和 VOIP 通话功能?

php - 使用 Asterisk PHP 脚本匹配电话前缀的最快方法

callback - HTTP 回调与消息传递相比有何优缺点?

ios - 无法在 iOS 中将 XMPPFramework 连接到 Openfire 服务器

ios - 获取 XMPP 聊天记录 OpenFire

linux - 从USB串行设备读取二进制流

node.js - 将 Backbone.iobind (socket.io) 与 Node.js 服务器集群结合使用