How to Integrate Openfire XMPP Chat Server with Asterisk PBX server

After successfully Installing Asterisk PBX server and Installing Openfire XMPP Chat server, it’s time to integrate the two so that our Chat server can be used within the VOIP infrastructure build with Asterisk.Prerequisites

Installed Asterisk PBX server

Installed Openfire XMPP server

Asterisk and Openfire networked so that both can communicate successfully.

We’ll follow steps below to complete the integration.
> Once you’ve installed both Asterisk and Openfire, start Openfire and login to Web configuration interface. Use ip 127.0.0.1 if you have Openfire installed on your host computer and ip address of Openfire server if it’s on a remote system or on a Virtual Machine.

http://127.0.0.1:9090
http://your_ip_address:9090

> Login with the username and password you configured during installation.
> On the Menu section, go to Plugins >> “Available Plugins” and Search for plugins named “Asterisk-IM” and “SIP Phone Plugin”. Install the Plugins by clicking on the + (Plus sign) at the right corner of the plugin name section.
> If you can’t seem to find above plugins under “Available Plugins” sub-menu, you may download the plugins manually and put them inside “Openfire plugins directory”.
Do the following on Openfire XMPP server.

For Openfire to recognize added plugins, restart it using the command below

service openfire restart

> Once you restart Openfire, you should see Asterisk-IM menu on openfire dashboard’s menu. Click on it to configure it.
> Under Asterisk-IM > General settings, make sure Asteris-IM plugin is enabled.
On “Configure Phone Manager”, add Asterisk Context, mine is named test.If you have context already configured in your Asterisk Server, add it here. In case you don’t have any context, use “test” as we’ll add it later.

> Now it’s time to add Asterisk Server. This is done by just clicking on “Add Server” option under General settings. Then provide the following informationServer Name:Alias name of your Asterisk Server. Can be any nameServer IP: Ip address of your Asterisk ServerPort: connection port used to connect to Asterisk Server, the default is 5038Username: username that will connect to the asterisk manager. We’ll add it to Asterisk manager.conf file in the next step. Save the configurations.Password: user password that will be used to connect to Asterisk PBX server.
See screenshot below for my configuration.

> Head over to Asterisk Server and add the user you specified on the previous step to /etc/asterisk/manager.conf file.

Start your Asterisk PBX server, then:

su -
nano /etc/asterisk/manager.conf

nano /etc/asterisk/manager.conf

Make sure the general section has the following configuration options.

Save settingsand you have successfully completed the configurations.
> Before we can start sending messages to our XMPP buddies, we need to connect to an XMPP-enabled server. Add following configurations to xmpp.conf file.

> To install res_xmpp, we need the iksemel development library. If the OpenSSL development library is installed, res_xmpp will also utilize that for secure connections.First, install iksemel and OpenSSL Libraries.
For Ubuntu and Debian based systems:

sudo apt-get install libiksemel-dev libssl-dev

For CentOS 7 and RedHat Bases systems:

sudo yum install iksemel-devel openssl-devel

Restart your Asterisk Server then install res_xmpp as below.> Installing res_xmpp
Once you’ve installed the dependencies, you need to run ./configure in your Asterisk source and make menuselect. Then go into the Resource Modules menu and make sure res_xmpp is enabled. After that, run make install to get the new modules.

cd asterisk-source-directory
./configure
make menuselect

Then go into the Resource Modules menu and make sure res_xmpp is enabled. After that do the installation.

make install

Testing.

Test to confirm that sip users were successfully added to asterisk

service asterisk restart
asterisk -rvvvvvv
sip show peers

Test to confirm that Asterisk and Openfire XMPP server are communicating, on Asterisk CLI type:

manager reload
manager show connected

You can now install Sparkweb which is an Open Source, web-based IM client optimized for businesses and organizations and Spark IM client to use. You will be able to receive a call via SIP account we added to Asterisk.
On our next tutorial, we’ll talk about how to Use Zoiper and X-Lite Softphones to send instant messages over Openfire XMPP server.Tags:
How to install Openfire and integrate it with Asterisk PBX server
How to integrate Openfire with Asterisk
Asterisk running on CentOS 7 server and Openfire on CentOS 7 server integration.
How to make Softphones; X-Lite and Zoiper chat using Openfire XMPP server.