Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Example using curl CLI tool to get presence information

  • getUnifiedPresenceInfo
    This method returns XMPP information being given the sip extension, as described below

Step 1. Create a file called get-presence.xml with content, replace 200 with the SIP user id you wish to get presence information on

...

  • getXMPPUsername(String emailAddress)

This method returns the xmpp username being given the email address saved in user-portal: contact information page

XML to send:

No Format
<?xml version="1.0"?>
<methodCall>
 <methodName>presenceServer.getXmppUsername</methodName>
 <params>
   <param>
     <value>
       <string>mirceac@ezuce.com</string>
     </value>
   </param>
 </params>
</methodCall>

...

  • getPresenceState(String xmppUsername)

XML to send:

...

This method returns the presence state being given the XMPP id
The string representation of the presence might be:
AVAILABLE, AWAY, BUSY, OFFLINE, CHAT, EXTENDED_AWAY

XML to send:

No Format
<?xml version="1.0"?>
<methodCall>
 <methodName>presenceServer.getPresenceState</methodName>
 <params>
   <param>
     <value>
       <string>mirceac</string>
     </value>
   </param>
 </params>

...

  • setPresenceState(String xmppUsername, String xmppPresenceAsString)

XML to send:

...

This method changes the presence state of the given XMPP user id
The xmppPresenceAsString parameter can have the following String representations:
AVAILABLE, AWAY, BUSY, OFFLINE, CHAT, EXTENDED_AWAY

XML to send:

No Format
<?xml version="1.0"?>
<methodCall>
 <methodName>presenceServer.setPresenceState</methodName>
 <params>
   <param>
     <value>
       <string>mirceac</string>
     </value>
   </param>
   <param>
     <value>
       <string>AWAY</string>
     </value>
   </param>
 </params>
</methodCall>

...

  • setPresenceStatus(String id, String status)

This method sets the given status message of the given XMPP user id

XML to send:

No Format
<?xml version="1.0"?>
<methodCall>
 <methodName>presenceServer.setPresenceStatus</methodName>
 <params>
   <param>
     <value>
       <string>mirceac</string>
     </value>
   </param>
   <param>
     <value>
       <string>Here</string>
     </value>
   </param>
 </params>
</methodCall>

...

  • public Map getPresenceStatus(String id)

This method returns the presence status message of the given XMPP user id

XML to send:

No Format
<?xml version="1.0"?>
<methodCall>
 <methodName>presenceServer.getPresenceStatus</methodName>
 <params>
   <param>
     <value>
       <string>mirceac</string>
     </value>
   </param>   
 </params>
</methodCall>

...

No Format
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse xmlns:ex="http://ws.apache.org/xmlrpc/namespaces/extensions">
<params>
    <param>
        <value>
            <struct>
                <member>
                    <name>status-code</name>
                    <value>ok</value>
                </member>
                <member>
                    <name>instance-handle</name>
                    <value>of:821711375117195347</value>
                </member>
            </struct>
       </value>
    </param>
</params>
</methodResponse>

Chatroom 

The relative path for this service is: sipx-openfire-presence/chatroom
Therefore, in this case the curl call will change into:

curl \
-H "Content-Type: application/xml" \
-X POST \
--data-binary @get-presence.xml \
http://<user>:<password>@mypbx.example.com:9094/plugins/sipx-openfire-presence/chatroom

...