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以内),我并没有深入地讨论各个组成.但是如果要真正地按 ...
随机推荐
- This 在 C# 中的含义
这涉及到c# 中的oo思想,其实不管在c# 或其他编码语言中,很多抽象的概念当你项目经验多了,自然而然就会对这些东西理解的更透彻点,更加具象. 这里有一些面向对象编程的概念需要说明:类(Class)的 ...
- hibernate 连接 oracle数据库
前言:以下所有的操作都是基于你已经成功安装了oracle数据库并且java的开发环境正常的情况下进行的. 如果没有完善请先配置基础环境. 第一步:配置需要的环境(下载并导入需要的包). 我的百度云盘里 ...
- 关于iOS元旦http,https的规定,官方论坛回应
先贴原文地址:https://forums.developer.apple.com/thread/48979#146140 原文: eskimoAug 2, 2016 4:17 AM(in respo ...
- iOS 此证书的签发者无效
1.先检查Apple Worldwide Developer Relations Certification Authority Intermediate Certificate证书是否过期,该证书过 ...
- Flex基础相关
本篇文章转载于http://www.ruanyifeng.com/blog/2015/07/flex-grammar.html,原作者阮一峰. 网页布局(layout)是CSS的一个重点应用. 布局的 ...
- 通过css实现文本超出部分以省略号(......)代替
一.单行溢出 1,固定宽度(非常容易) text-overflow: ellipsis; 2,不固定宽度 思路:想让这个区域成为块元素,然后不换行,溢出隐藏. display: block; whit ...
- 寒假ACM训练(二)
放了假的效率明显就低起来,最近也一直在学习Ubuntu,所以一直等到今天才写. 还是在用PC. 真的十分郁闷这个LC-Display,其实从思路上是有很多.不过我最后把他当成8字,分成了七笔. 一直W ...
- ListView复用和优化详解
我们每一个Android开发人员对ListView的使用肯定是很熟悉的,然而多少人能真正的懂ListView的缓存机制呢,说白了就是ListView为了提高效率,而内部实现的一种优化,牺牲一点内存.而 ...
- 如何便携使用github
Git是一个分布式的版本控制系统,最初由Linus Torvalds编写,用作Linux内核代码的管理.在推出后,Git在其它项目中也取得了很大成功,尤其是在Ruby社区中.目前,包括Rubinius ...
- 移动端下拉刷新、加载更多插件dropload.js(基于jQuery/Zepto)
移动端下拉刷新.加载更多插件dropload.js(基于jQuery/Zepto) 原文:http://www.grycheng.com/?p=1869 废话不多说,先让大家看一下案例效果: DEMO ...