Pubsub in Asterisk using Tigase and res_xmpp

1.1k views Asked by At

I installed and configured Tigase server for distributing device state between multiple Asterisk servers. The server works fine. It's configuration file is as follows:

--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

The i installed two asterisk servers on two different systems. I also compiled res_xmpp on both and configured it using the following configuration file:

[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

the username for one of my servers is server1@localhost/voip1 and for the other is server2@localhost/voip2. Now the xmpp module works correctly. But pubsub events do not distribute correctly. As you can see i used an IP address to distinguish my Tigase server. If i use the same IP address in the pubsub_node option of res_xmpp module the server will return "Feature not Implemented" error with an error code of 501; because of this i used pubsub.192.168.20.105 and set this in the /etc/hosts of both servers not there is not an error message but i won't get the events either!!! How can i fix this?

3

There are 3 answers

0
gst On BEST ANSWER

I had the same problem with the Tigase server and Asterisk; your problem is that you set:

pubsub_autocreate=yes

config in your xmpp.conf. This option causes auto creation of many nodes; if you take a look at tig_nodes in the Tigase database you will see that many nodes have been created. You must comment this option. Afterward you must redeploy your Tigase SQL schema or you have to delete all those nodes; Then everything will be fine. By looking at the debug output of res_xmpp module in the Asterisk CLI you will see that res_xmpp will try to subscribe to many nodes at once and this causes confusion because many nodes with the same name exist; and server will return 409 and 501 errors.

1
Artur Hefczyc On

The problem is probably with the Tigase configuration. You have:

--comp-class-1 = tigase.muc.MUCComponent
--comp-name-1 = muc
--comp-name-1=pubsub
--comp-class-1=tigase.pubsub.PubSubComponent

As you can see you assigned the same number to both the MUC and PubSub component. Considering other configuration for other components a correct configuration for PubSub would be:

--comp-name-4=pubsub
--comp-class-4=tigase.pubsub.PubSubComponent
0
user278740 On
config-type=--gen-config-def
#config-type= --gen-config-all
--admins=admin@localhost
--virt-hosts=tigase.lc
--debug=server
--user-db=mysql
--user-db-uri = jdbc:mysql://localhost/tigasedb?user=root&password=no
--comp-name-1=pubsub
--comp-class-1=tigase.pubsub.PubSubComponent
--comp-class-2 = tigase.muc.MUCComponent
--comp-name-2 = muc
--sm-plugins = +message-archive-xep-0136
--comp-name-3 = message-archive
--comp-class-3 = tigase.archive.MessageArchiveComponent
--comp-class-4 = tigase.socks5.Socks5ProxyComponent
--comp-name-4 = proxy

Now my config looks like this but it gives me feature not implemented error again.