Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

There are currently 2 XMLRPC APIs available from the sipXopenfire plugin.

Unified Presence

NOTE : Calls are secured using BASIC Authentication
XML-RPC presence java clients provided by sipxecs (sipXopenfire project) can be used using the SHARED_SECRET

Here you can get and set someone's unified presence.  

Example using curl CLI tool to get presence information

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

<?xml version="1.0"?>
<methodCall>
 <methodName>presenceServer.getUnifiedPresenceInfo</methodName>
 <params>
   <param>
     <value>
       <string>2011</string>
     </value>
   </param>
 </params>
</methodCall>

Step 2. Then run this command, replacing mypbx.example.com with the FQDN of your sipXecs system

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

Returns as response something like:

<?xml version="1.0" encoding="UTF-8"?>
<methodResponse xmlns:ex="http://ws.apache.org/xmlrpc/namespaces/extensions">
<params>
    <param>
        <value>
           <struct>
           <member>
               <name>custom-presence-message</name>
               <value></value>
           </member>
           <member>
               <name>sip-id</name>
               <value>2011</value>
           </member>
           <member>
               <name>status-code</name>
               <value>ok</value>
           </member>
           <member>
               <name>unified-presence</name>
               <value>available-for-both</value>
           </member>
           <member>
              <name>jabber-id</name>
              <value>mirceac@openuc.ezuce.com</value>
           </member>
           <member>
              <name>xmpp-presence</name>
              <value>AVAILABLE</value>
           </member>
           <member>
              <name>sip-presence</name>
              <value>IDLE</value>
           </member>
           </struct>
        </value>
    </param>
</params>
</methodResponse>

The same procedure as above can be applied for other calls present int the Unified Presence API

  • getXMPPUsername(String emailAddress)

XML to send:

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

Returns as response something like:

<?xml version="1.0" encoding="UTF-8"?>
<methodResponse xmlns:ex="http://ws.apache.org/xmlrpc/namespaces/extensions">
<params>
    <param>
        <value>
            <struct>
                <member>
                    <name>sip-id</name>
                    <value>mirceac</value>
                </member>
                <member>
                    <name>status-code</name>
                    <value>ok</value>
                </member>
            </struct>
       </value>
   </param>
</params>
</methodResponse>
  • getPresenceState(String xmppUsername)

XML to send:

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

Returns as response something like:

<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>xmpp-presence</name>
                    <value>AVAILABLE</value>
                </member>
            </struct>
        </value>
    </param>
</params>
</methodResponse>
</methodCall>
  • setPresenceState(String xmppUsername, String xmppPresenceAsString)

XML to send:

<?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>

Retuns as response something like:

<methodResponse xmlns:ex="http://ws.apache.org/xmlrpc/namespaces/extensions">
<params>
    <param>
        <value>
            <struct>
                <member>
                    <name>status-code</name>
                    <value>ok</value>
                </member>
            </struct>
        </value>
    </param>
</params>
</methodResponse>

If you now call the getPresenceState method it will show you AWAY as xmpp-presence value

Chatroom 

  • No labels