powered by Jive Software

Feature request - Query XMPP Server from Asterisk

This is more of an Asterisk development request, but it is the next logical step for fully leveraging this plug-in with Asterisk. An application within Asterisk is needed to query an XMPP server (ie - Jive Messenger) for the status of a user. This could then be returned in a variable and used to make routing decisions within the dialing plan.

So something like:

exten => s,1,QueryXMPP(xmpp_status=my_user@jabber.org)

exten => s,2,GotoIf($[$ = “Available”]?is_avail|s|1:3)

Also, would be great to have an /etc/asterisk/xmpp.conf file to connect to XMPP at startup in order to have the appropriate connections open prior to calling the application in the dialplan.

This is a cool idea. We could do these fairly easy using fastAGI. You could then have queries like

agi(agi://myxmppserver.com/findPresence?device="$).

I have created an feature request for this: PHONE-32

Hi!

also soon you will be able to do

exten => s,1,XMPPStatus(asterisk,my_user@jabber.org,xmpp_status)

exten => s,2,GotoIF($[ $ < 3 ]?is_avail:is_away)

_

Is someone adding this? Source?

It is part of astjab, http://astjab.org . It is a resource for asterisk similar to asterisk-im. We are working to unify the two so that execute queries like that will be more direct.

Matt

speak of the devil

http://bugs.digium.com/view.php?id=5501

and

Great!

Although, when I tried to patch while in /usr/src (Asterisk source in /usr/src/asterisk) I get some failures when trying to patch Asterisk 1.2beta:


waldorf:/usr/src # patch -p0 < xmpp.patch

patching file asterisk/app.c

Hunk #1 succeeded at 37 (offset -11 lines).

Hunk #2 succeeded at 215 (offset -11 lines).

patching file asterisk/channels/chan_agent.c

Hunk #1 succeeded at 50 (offset -14 lines).

Hunk #2 succeeded at 137 (offset -14 lines).

Hunk #3 FAILED at 167.

Hunk #4 FAILED at 180.

Hunk #5 succeeded at 232 (offset -20 lines).

Hunk #6 succeeded at 275 (offset -39 lines).

Hunk #7 succeeded at 299 (offset -40 lines).

Hunk #8 succeeded at 368 (offset -42 lines).

Hunk #9 succeeded at 388 (offset -42 lines).

Hunk #10 succeeded at 1064 (offset -48 lines).

Hunk #11 succeeded at 1564 (offset -62 lines).

Hunk #12 FAILED at 2204.

Hunk #13 succeeded at 2523 (offset -106 lines).

Hunk #14 succeeded at 2524 (offset -114 lines).

3 out of 14 hunks FAILED – saving rejects to file asterisk/channels/chan_agent.c.rej

patching file asterisk/configs/xmpp.conf.sample

patching file asterisk/include/asterisk/app.h

Hunk #1 succeeded at 19 (offset -8 lines).

Hunk #2 succeeded at 105 (offset -8 lines).

patching file asterisk/include/asterisk/astobj.h

Hunk #1 succeeded at 378 (offset -9 lines).

patching file asterisk/include/asterisk/xmpp.h

patching file asterisk/res/Makefile

Hunk #1 FAILED at 12.

Hunk #2 succeeded at 39 (offset -26 lines).

1 out of 2 hunks FAILED – saving rejects to file asterisk/res/Makefile.rej

patching file asterisk/res/res_xmpp.c

waldorf:/usr/src #


/usr/src/asterisk/res/Makefile.rej


  • 12,18 ****

MODS=res_adsi.so res_features.so res_musiconhold.so res_indications.so res_monitor.so \

  •  res_agi.so
    

ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/odbcinst.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/odbcinst.h),)

ifneq ($,FreeBSD)
— 12,18 -


MODS=res_adsi.so res_features.so res_musiconhold.so res_indications.so res_monitor.so \

  •  res_agi.so res_xmpp.so   ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/odbcinst.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/odbcinst.h),)
    
    ifneq ($,FreeBSD)

Hi Muppet. I did only make the patch for asterisk-head. Although 1.2 is very similar to asterisk-head it is not asterisk-head. Let me go crank out a patch for you.

Matt

Done. it is now been added to http://astjab.org as well as http://bugs.digium.com/view.php?id=5501

Enjoy

Thanks! Patches 1.2 fine now. But now I get a compilation error:


L_OPTIMIZATIONS -fomit-frame-pointer -c -o frame.o frame.c

gcc -pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g -Iinclude -I…/include -D_REENTRANT -D_GNU_SOURCE -O6 -march=i686 -DZAPTEL_OPTIMIZATIONS -fomit-frame-pointer -c -o loader.o loader.c

gcc -pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g -Iinclude -I…/include -D_REENTRANT -D_GNU_SOURCE -O6 -march=i686 -DZAPTEL_OPTIMIZATIONS -fomit-frame-pointer -c -o config.o config.c

In file included from include/asterisk/app.h:22,

from config.c:39:

include/asterisk/xmpp.h:20:21: iksemel.h: No such file or directory

In file included from include/asterisk/app.h:22,

from config.c:39:

include/asterisk/xmpp.h:81: error: parse error before “iksid”

include/asterisk/xmpp.h:81: warning: no semicolon at end of struct or union

include/asterisk/xmpp.h:82: warning: type defaults to int'' in declaration ofp’’

include/asterisk/xmpp.h:82: warning: data definition has no type or storage class

include/asterisk/xmpp.h:83: error: parse error before ‘’*’’ token

include/asterisk/xmpp.h:83: warning: type defaults to int'' in declaration off’’

include/asterisk/xmpp.h:83: warning: data definition has no type or storage class

include/asterisk/xmpp.h:84: error: parse error before ‘’*’’ token

include/asterisk/xmpp.h:84: warning: type defaults to int'' in declaration ofstack’’

include/asterisk/xmpp.h:84: warning: data definition has no type or storage class

include/asterisk/xmpp.h:92: error: parse error before ‘’}’’ token

make: *** Error 1


include/asterisk/xmpp.h:20:21: iksemel.h: No such file or directory

dn dn dnannanana

there is an added dependency to asterisk with this patch

iksemel 1.2 you dont have it installed, you will need to install libiksemel to run it and iksemel-dev to compile it.

Okay, not a part of the standard OpenSuSE v9.3 or v9.1 Pro distro, so had to download and compile from here:

http://jabberstudio.org/projects/iksemel/project/view.php

All compiled fine now (on v9.1 but compiler issues on v9.3). Will play around and let you know how it goes. Thanks!

Message was edited by:

MuppetMaster

Excuse my ignorance on this subject, but what is the difference between a ‘‘client’’ and a ‘‘component’’ when attaching to a Jabber/XMPP server?

A Client is a user like you or I, A component is a trusted user, like an aim gateway or other service you would get from your jive or any xmpp server. As you have probably noticed my implementation is very much a work in progress. However eventually I would like to enable some things like jabber voicemail, and a jabber control system in asterisk, but you could not implement these things as a user but only as a component. Its all just a matter of time, which sucks as I have very little of it. Right now I am focusing on a few bug fixes and writing documentation for what I have so far.

new patches available from website, or bug tracker. Enjoy.

I know it’'s a little bit of a work around, but, um, it works… I put a comment on the feature request:

PHONE-32