XMPP and Asterisk integration
http://www.mundoopensource.com.br/en_page_xmpp_asterisk_pratical_example/
www.mundoopensource.com.br/xmpp-asterisk-integration-practical-example-part-2/
In past few years integrate XMPP and Asterisk is one of my principal goals. The development of an realtime communication tool with open source software necessarily needs this two technologies and make it happens is one of my intents.
Nine years ago, since I started to work with Asterisk and Openfire I’m studying a way to do it and when I discovered that Asterisk 11 had improved xmpp support, I noticed that it was the time to make this real.
Using AGIs scripts in python, I started the development of a “tool” that allows users to run commands through their xmpp account in their preferred xmpp client (Pidgin, for example). The current version of my software permits:
Send SIP messages to an extension
Send text messages (SMS)
Enable/disable DND for extension
Enable/disable divert for extension
Queue logon/logoff
Show extension informations
Show queue informations
Send XMPP message to all extensions logged in a queue
Show SIP and IAX peers informations
And other resources under development
For it works you’ll need to create a column in your SIP table to store the extension’s JID. I created a column named JID in my sippeers table.
Now I’ll show you a practical example of this integration.
What do you need?
You’ll need this following items:
A running Asterisk 11 (at least) with res_xmpp support configured.
A running XMPP server (Openfire 3.9.3 is a good one)
A JID account for your Asterisk (to use in res_xmpp)
And now ?
First you need to make Asterisk works with your XMPP server. Edit /etc/asterisk/xmpp.conf and create a sessions for you server. Example:
[asterisk]
type=client
serverhost=yourjabberdomain
username=asterisk@yourjabberdomain
secret=password
priority=1
usetls=yes
port=5222
usesasl=yes
status=available
statusmessage="Asterisk Server"
endtodialplan=yes
context=from_xmpp
keepalive=yes
After, edit /etc/asterisk/extensions.conf and create from_xmpp context with the following content:
[from_xmpp]
exten => s,1,NoOp(XMPP Message)
same => n,NoOp(To: ${MESSAGE(to)})
same => n,NoOp(From: ${MESSAGE(from)})
same => n,NoOp(Message: ${MESSAGE(body)})
same => n,NoOp(Sending SIP message)
; AGI that process message and get the following variables
; ${XMPP_MSG} - message text
; ${XMPP_SIPDEST} - to extension
; ${XMPP_SIPORIG} - from extension
same => n,agi(process_xmpp_msg.agi)
; Set ${XMPPRESOURCE} = session name in xmpp.conf file (can be a global variable)
same => n,Set(XMPPRESOURCE=asterisk)
same => n,Set(MESSAGE(body)=${XMPP_MSG})
same => n,MessageSend(sip:${XMPP_SIPDEST},sip:${XMPP_SIPORIG})
same => n,JabberSend(${XMPPRESOURCE},${MESSAGE(from):5},"Message sent. Status:${MESSAGE_SEND_STATUS}). )
How to use it?
To “communicate” with your Asterisk server just send messages to Asterisk JID configured in your xmpp.conf file (in this example, asterisk@yourjabberdomain). The message will be received in xmpp context (from_xmpp context) and stored in ${MESSAGE} variable. The NoOP commands in the example context are used just to show you how Asterisk processes the message.
UPDATE: some readers ask me to send my process_xmpp_msg.agi. You can get it here. It was adapted from my original script, so I hope it is working.
XMPP and Asterisk integration的更多相关文章
- Xmpp integration with Asterisk
http://gnu-linux.org/xmpp-integration-with-asterisk.html Xmpp stands for eXtensible Messaging and Pr ...
- Github上的原文XMPP环境搭建步骤,英语能力差不多的可以看看
Getting started using XMPPFramework on iOS Here is a post on StackOverflow describing how to install ...
- xmpp muc 群聊协议 4
7. Occupant Use Cases The main actor in a multi-user chat environment is the occupant, who can be sa ...
- [转] Spring Integration 系统集成
[From] http://blog.csdn.net/w_x_z_/article/details/53316618 pring Ingegration 提供了基于Spring的EIP(Enterp ...
- 转 asterisk app命令中文翻译
常规指令 Authenticate:鉴别用户 VMAuthenticate:根据“voicemail.conf”鉴别用户 Curl:接受外接URLs的修复.支持POSTing DUNDiLookup: ...
- xmpp之配置Xcode(1)
介绍 ios上的XMPPFramework你能够在Xcode/iPhoneXMPP 目录找到,它只是实现了XMPP的一小部分功能. 下面主要介绍在开发XMPPFramework ios应用之前的配置工 ...
- 在 Laravel 中使用图片处理库 Integration/Image
系统需求 PHP >= 5.3 Fileinfo Extension GD Library (>=2.0) … or … Imagick PHP extension (>=6.5.7 ...
- 技术笔记:XMPP之openfire+spark+smack
在即时通信这个领域目前只找到一个XMPP协议,在其协议基础上还是有许多成熟的产品,而且是开源的.所以还是想在这个领域多多了解一下. XMPP协议:具体的概念我就不写了,毕竟这东西网上到处是.简单的说就 ...
- 按照Enterprise Integration Pattern搭建服务系统
在前一篇文章中,我们已经对Enterprise Integration Pattern中所包含的各个组成进行了简单地介绍.限于篇幅(20页Word以内),我并没有深入地讨论各个组成.但是如果要真正地按 ...
随机推荐
- sqlserver2008安装出现跨语言
我在安装sqlserver2008的时候出现了一个问题,安装到一半的时候出现 跨语言安装失败 ,我细细的查了下问题,我装的安装语言绝对没有错的吧,然后我后退几步又是同样的错误,最后我把镜像重新加载到虚 ...
- Visual EmbedLinux Tools:让vs支持嵌入式Linux开发(转)
转自:http://blog.csdn.net/lights_joy/article/details/49499743 1 什么是Visual EmbedLinux Tools Visual Embe ...
- 《玩转shutdown》-linux命令五分钟系列之十三
1 我想立即关机! $shutdown -h now 2 我想立即重启 $shutdown -r now 3 我想在23:30分准时关机 $shutdown -h 23:30 4 我想在15分钟后关机 ...
- django添加静态文件
最近做了一个todolist webapp,需要稍微添加css时候又忘记django的添加方法了,查看了以前的项目才想起来,所以记录一下. 1.settings.py 将以下代码放到最下面 STATI ...
- 不为人知的Locked
在属性面板上,有一个Locked属性,什么时候添加上去的,真是没有注意到,它的说明为:确定是否可以移动控件或调整控件的大小,默认是为false的,设置为true以后,当前选中的控件会在左上角出现一个锁 ...
- demo_02 less
html 中的代码<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> &l ...
- Android Handler、Lopper消息驱动机制
Android应用程序是通过消息来驱动的,系统为每一个应用程序维护一个消息队例(MesageQueue),应用程序的主线程不断地从这个消息队例中获取消息(Mesage),然后对这些消息进行处理(Han ...
- Colletion View 简单的备忘
UIColletionView 这篇只是做UIColletionView的常用属性.代理方法和数据源方法的备忘,之后做一些自定义布局,增加删除动画等. UIColletionViewFlowLayou ...
- 从MVC到前后端分离
摘要:MVC模式早在上个世纪70年代就诞生了,直到今天它依然存在,可见生命力相当之强.MVC模式最早用于Smalltalk语言中,最后在其它许多开发语言中都得到了很好的应用,例如,Java中的Stru ...
- 当xcode里点运行出现treating unicode character as whites
可能是由于粘贴网页上的代码的时候两行之间的回车引起的,两行之间重新输入回车就行......删掉重新写一遍就ok了 引入网页上的回车时 可能 网页对其格式做了处理,所以Xcode 不认识了