[ejabberd] Change jabber users Presence externally from another application

Duane Larson duane.larson at gmail.com
Tue Jul 31 00:35:46 MSK 2012


I have more info.  I was able to get this to work but here is the issue.

For the script using the API I set my show to "dnd" and status to "On
Phone".  I also had to set the Presence Priority to a number higher than
what my pidgin client is set to.  So Pidgin has a priority of 5 so I set
the scripts priority to 6.  This worked and my buddy was able to see that
the guy is DND and On Phone.  The problem now is if someone still tries to
instant message the user that is On Phone and DND.  Now that my script has
a higher priority all messages go to it.  This isn't desired since it is
just a script and even though the user is on the phone I would still want
to chat with someone especially if the users are on the same call and want
to chat about the call.

Any ideas?


On Mon, Jul 30, 2012 at 1:53 PM, Duane Larson <duane.larson at gmail.com>wrote:

> Well my first attempt didn't work.  I guess if you have
> test.user at domainA.com/pidgin logged in and his presence set to
> "Available" and then when I execute a script that sets test.user at domainA.com/Blah
> presence to Status = "On Phone"/Show = "dnd" then anyone that is a buddy of
> his will not see his status change to dnd and On Phone.  The only time it
> works is if test.user at domainA.com/pidgin has set his status to "away"
> then if I set the presence to "dnd" the buddy sees the status change.
>
> So I am guessing this is how XMPP should work.  So changing the Presence I
> guess isn't the route I want to go.
>
> Then I heard about User Activity
> I'm trying to use the
> http://xmpp.org/extensions/xep-0108.html
> extension and it doesn't seem to be working.
>
> I basically send the following stanza to ejabberd
>
> <iq type='set'
>
>     from='juliet at capulet.lit/ca486eba-0f9a-11dc-8835-000bcd821bfb'
>     id='publish1'>
>
>   <pubsub xmlns='http://jabber.org/protocol/pubsub'>
>
>     <publish node='http://jabber.org/protocol/activity'>
>
>       <item>
>         <activity xmlns='http://jabber.org/protocol/activity'>
>
>           <relaxing>
>             <partying/>
>           </relaxing>
>
>           <text xml:lang='en'>My nurse's birthday!</text>
>
>         </activity>
>       </item>
>     </publish>
>
>   </pubsub>
> </iq>
>
>
> Here is what I see on the ejabberd server
>
> The user setting his "User Activity" is duane.larson at ae.com and the buddy bob.test at ae.com should be the one that sees the update but doesn't
>
> T 2012/07/30 13:40:28.045500 50.XX.XX.54:35105 -> 184.xxx.xxx.30:5222 [AP]
> <iq type='set' from='duane.larson at ae.com' id='publish1'><pubsub xmlns='http://jabber.org/protocol/pubsub'><publish node='http://jabber.org/protocol/activity'><item><activity xmlns='http://jabber.org/protocol/activity'><relaxing><partying/></relaxing><text xml:lang='en'>My nurse's birthday!</text></activity></item></publish></pubsub></iq>
>
> ##
> T 2012/07/30 13:40:28.095566 184.xxx.xxx.30:5222 -> 50.XX.XX.54:35105 [AP]
> <iq from='duane.larson at ae.com' to='duane.larson at ae.com/jaxl.1.1343673627' id='publish1' type='result'><pubsub xmlns='http://jabber.org/protocol/pubsub'><publish node='http://jabber.org/protocol/activity'><item id='53FA475C16C18'/></publish></pubsub></iq>
>
> #
> T 2012/07/30 13:40:28.095650 184.xxx.xxx.30:5222 -> 50.XX.XX.54:35105 [AP]
> <message from='duane.larson at ae.com' to='duane.larson at ae.com/jaxl.1.1343673627' type='headline'><event xmlns='http://jabber.org/protocol/pubsub#event'><items node='http://jabber.org/protocol/activity'><item id='53FA475C16C18'><activity xmlns='http://jabber.org/protocol/activity'><relaxing><partying/></relaxing><text xml:lang='en'>My nurse's birthday!</text></activity></item></items></event><addresses xmlns='http://jabber.org/protocol/address'><address type='replyto' jid='duane.larson at ae.com/jaxl.1.1343673627'/ <http://duane.larson@ae.com/jaxl.1.1343673627%27/>></addresses></message>
>
> ##
> T 2012/07/30 13:40:34.033334 216.12.249.203:60207 -> 184.xxx.xxx.30:5222 [AP]
> <iq type='get' id='purple8d799f70'><ping xmlns='urn:xmpp:ping'/></iq>
>
> #
> T 2012/07/30 13:40:34.033687 184.xxx.xxx.30:5222 -> 216.XX.XX.203:60207 [AP]
> <iq from='duane.larson at ae.com' to='duane.larson at ae.com/Work' type='error' id='purple8d799f70'><ping xmlns='urn:xmpp:ping'/><error code='503' type='cancel'><service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq>
>
>
>
> On Thu, Jul 26, 2012 at 1:00 PM, Duane Larson <duane.larson at gmail.com>wrote:
>
>> I'm trying to read over
>>
>> http://oriolrius.cat/blog/wp-content/uploads/2009/10/Oreilly.XMPP.The.Definitive.Guide.May.2009.pdf
>> and tell me if this could work
>>
>> Write a script that will do the following
>>
>>    1. Log on xmpp:user at domainA.com/deskphone
>>    2. Open session with ejabberd server for xmpp:user at domainA.com
>>    /deskphone
>>    3. Set Presence to the following <presence from="user at domainA.com
>>    /deskphone">
>>                                                   <show>dnd</show>
>>                                                   <status>On
>>    Phone</status>
>>                                               </presence>
>>    4. Close session with ejabberd ser for xmpp:user at domainA.com/deskphone
>>
>>
>> I am still reading the oreilly book to see what are the caveats to doing
>> this but I wanted to through it out there.
>>
>>
>>
>>
>> On Thu, Jul 26, 2012 at 10:41 AM, Aaron <aarond at cmu.edu> wrote:
>>
>>> You could send an IQ "set" request to a custom namespace and handle the
>>> IQ  in a module by adding the device's info such as phone number (which you
>>> could include in the SubEl of the IQ packet) to a devices database.
>>>
>>> --Aaron
>>>
>>>
>>>
>>> On Thursday, July 26, 2012 11:26:00 AM, duane.larson at gmail.com wrote:
>>>
>>>> Yeah I've looked at the OpenSIPS XMPP module but I don't think it can
>>>> accomplish what I am wanting to do. I think the OpenSIPS XMPP module
>>>> just allows a SIP user to communicate with an XMPP user. So DomainA
>>>> would be a SIP IM domain and their SIP SIMPLE client could send
>>>> instant messages directly to DomainB which is an XMPP domain and XMPP
>>>> clients.
>>>>
>>>> Any ideas on how to tie a JID to a phone number account?
>>>>
>>>>
>>>>
>>>> I just found this page
>>>> http://xmpp.org/xmpp-software/**libraries/<http://xmpp.org/xmpp-software/libraries/>
>>>>
>>>> I will look at some of these libraries and see if one of them can
>>>> accomplish what I am looking at doing. But once again if someone has
>>>> already done something like this I'd love to hear about it.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On , Gavin Henry <ghenry at surevoip.co.uk> wrote:
>>>> > > Hey Gavin,
>>>> >
>>>> >
>>>> >
>>>> > Hi Duane,
>>>> >
>>>> >
>>>> >
>>>> > > Thanks for the reply.  I use OpenSIPs and have different options
>>>> when it
>>>> >
>>>> > > comes to executing a script from within OpenSIPS when a user is on
>>>> a call.
>>>> >
>>>> > > It will be a multidomain installation.
>>>> >
>>>> >
>>>> >
>>>> > That's good. You just need to tie their number to a JID.
>>>> >
>>>> >
>>>> >
>>>> > > I'm not familiar with any RESTful api.  Do you have more details?
>>>>  I came
>>>> >
>>>> > > across a java api called smack last night and also a perl module
>>>> called
>>>> >
>>>> > > anyevent::xmpp.  I will look into those more but if you have any
>>>> hints or
>>>> >
>>>> > > experience in doing this I would love to hear.
>>>> >
>>>> >
>>>> >
>>>> > You can add OpenSIPS as a component to ejabberd but it's only one
>>>> >
>>>> > domain I think.
>>>> >
>>>> >
>>>> >
>>>> > Check the OpenSIPS XMPP module and http://www.ejabberd.im/mod_**
>>>> restful <http://www.ejabberd.im/mod_restful>
>>>> >
>>>> >
>>>> >
>>>> > Thanks.
>>>> >
>>>> >
>>>> >
>>>> > --
>>>> >
>>>> > Kind Regards,
>>>> >
>>>> >
>>>> >
>>>> > Gavin Henry.
>>>> >
>>>> > Managing Director.
>>>> >
>>>> >
>>>> >
>>>> > T +44 (0) 1224 900123
>>>> >
>>>> > M +44 (0) 7930 323266
>>>> >
>>>> > F +44 (0) 1224 824887
>>>> >
>>>> > E ghenry at surevoip.co.uk
>>>> >
>>>> >
>>>> >
>>>> > http://www.surevoip.co.uk/
>>>> >
>>>> >
>>>> >
>>>> > Suretec Systems T/A SureVoIP is a limited company registered in
>>>> >
>>>> > Scotland. Registered
>>>> >
>>>> > number: SC258005. Registered office: 24 Cormack Park, Rothienorman,
>>>> Inverurie,
>>>> >
>>>> > Aberdeenshire, AB51 8GL.
>>>> >
>>>> >
>>>> >
>>>> > Subject to disclaimer at http://www.suretecgroup.com/**
>>>> disclaimer.html <http://www.suretecgroup.com/disclaimer.html>
>>>> >
>>>> >
>>>> >
>>>> > Did you see the SureVoIP API news? -
>>>> >
>>>> > http://www.surevoip.co.uk/**news-events/surevoip-launches-**
>>>> innovative-api<http://www.surevoip.co.uk/news-events/surevoip-launches-innovative-api>
>>>> >
>>>> > and http://www.surevoip.co.uk/api
>>>> >
>>>> > ______________________________**_________________
>>>> >
>>>> > ejabberd mailing list
>>>> >
>>>> > ejabberd at jabber.ru
>>>> >
>>>> > http://lists.jabber.ru/**mailman/listinfo/ejabberd<http://lists.jabber.ru/mailman/listinfo/ejabberd>
>>>> >
>>>> >
>>>>
>>>>
>>>> ______________________________**_________________
>>>> ejabberd mailing list
>>>> ejabberd at jabber.ru
>>>> http://lists.jabber.ru/**mailman/listinfo/ejabberd<http://lists.jabber.ru/mailman/listinfo/ejabberd>
>>>>
>>>
>>>
>>> ______________________________**_________________
>>> ejabberd mailing list
>>> ejabberd at jabber.ru
>>> http://lists.jabber.ru/**mailman/listinfo/ejabberd<http://lists.jabber.ru/mailman/listinfo/ejabberd>
>>>
>>
>>
>>
>> --
>> --
>> *--*--*--*--*--*
>> Duane
>> *--*--*--*--*--*
>> --
>>
>
>
>
> --
> --
> *--*--*--*--*--*
> Duane
> *--*--*--*--*--*
> --
>



-- 
--
*--*--*--*--*--*
Duane
*--*--*--*--*--*
--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20120730/e6bfa227/attachment.html>


More information about the ejabberd mailing list