Http://gnu-linux.org/xmpp-integration-with-asterisk.html
XMPP stands for extensible Messaging and Presence Protocol, its a widely used communication Protocol. In this blog I'll use the OpenFire an opensource XMPP server.
Asterisk is opensource telephony switching Exchange service for Linux. In this blog I am using the FreePBX Install on CentOS 6.5.
In this blog I assume that user have already install OpenFire and asterisk server on Linux machines. So I'll start with creating a user in OpenFire and intregate my opefire server with Asterisk server and in finally we WI ll able to the from SIP phone to XMPP client.
Step 1: Creating user in XMPP server
Login to OpenFire server. You'll find the Welcome screen as in image below and then click on user/session tab
Now provide the user information and click to create user as in image below.
Step 2: starting Spark XMPP client
Download Spark client on your Linux machine.
wget http://www.igniterealtime.org/downloadServlet?filename=spark/spark_2_7_0.tar.gz
Untar the file and run Spark executable file
Tar-xvzf spark_2_7_0.tar.gz
CD spark*
./spark
You'll find the spark client starts as in image below.
Provide user ID, password which you created in OpenFire server and give server IP.
Now again go to your OpenFire server and click on Session tab you'll find status of the user online
Step 3: Enable SIP plugin to OpenFire
Download the SIP jar file
wget Http://www.igniterealtime.org/projects/openfire/plugins/sip.jar
Click on Plugins tab and upload your Sip.jar file. After some time you'll find phone tab inside the server tab
Note The plugin work with OpenFire version 3.9.3
Step 4: Configure SIP user on asterisk
Now we need to configure sip.conf and extension.conf file to switch the call between asterisk and XMPP client.
SIP configuration settings Copy paste below code in your sip.conf, more detail on this you'll find in asterisk config Uration Blog.
[100]
username=100
Type=friend
Secret=123
Record_out=never
Record_in=never
Qualify=no
port=5060
Nat=never
Host=dynamic
dtmfmode=rfc2833
Call-limit=4
Canreinivite=no
Disallow=all
Allow=all
extension.conf Configuration
Exten = 100,1,dial (sip/100,20)
Now restart your asterisk server
Service asterisk restart
The above settings allow SIP client to established call to XMPP client which is spark.
Step 5: Configure SIP phone on OpenFire
On your OpenFire interface go-Phone tab and then click on Add New Phone mapping and provide the detail as in image Belo W.
SIP PHONE Settings
XMPP username = user name of your OpenFire user.
SIP username = user name on your asterisk server which we configure in sip.conf
Authorization username = Same as SIP username
PASSWORD = PASSWORD of your SIP user.
Server = IP of asterisk server
Click on Create and you'll find the page as below.
Successful SIP mapping
Now all of the configuration is done, finally you have to login to your spark and sip phone.
Step 6: make a call from SIP phone
I am using Twinkle as my SIP phone now as a dial the extension number are which is of my XMPP client. I get a incoming call. Check the image below
Incoming call from SIP phone
In the image you'll find a box saying incoming call from the SIP user.
Once you accept the call it'll get connected.
Call accepted
So we successfully integrated XMPP (OpenFire) with SIP (Asterisk).
In easy 6, step we have do this.
XMPP Integration with Asterisk