码迷,mamicode.com
首页 > 其他好文 > 详细

Xmpp integration with Asterisk

时间:2015-07-17 18:02:20      阅读:161      评论:0      收藏:0      [点我收藏+]

标签:

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 will use Openfire an opensource xmpp server.
Asterisk is opensource telephony switching exchange service for linux. In this blog I am using FreePBX install on centos 6.5.
In this blog I assume that user has already install openfire and asterisk server on linux machines. So I will start with creating a user in openfire and intregate my opefire server with asterisk server and in finally we will able to call from sip phone to xmpp client.

 

Step 1: Creating user in xmpp server

Login to openfire server. You will find the welcome screen as in image below and then click on user/session tab

技术分享

Now provide the user information and click on 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 will 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 will 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 will 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 about this you will find in asterisk configuration 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 to Phone tab and then click on add new phone mapping and provide the detail as in image below.

技术分享

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 will find the page as below.

技术分享

successful SIP mapping

Now all 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 100 which is of my xmpp client . I get a incoming call. check the image below

技术分享

incoming call from SIP phone

In the image you will find a box saying incoming call from the SIP user.

Once you accept the call it will get connected .

技术分享

call accepted

So we successfully integrated XMPP (Openfire) with SIP (Asterisk).

In easy 6 step we have done this.

Xmpp integration with Asterisk

标签:

原文地址:http://www.cnblogs.com/welhzh/p/4655029.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!