Â
sipXopenfire XMLRPC API
There is currently 1 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
- 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
<?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/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)
This method returns the xmpp username being given the email address saved in user-portal: contact information page
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)
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:
<?xml version="1.0"?> <methodCall> <methodName>presenceServer.getPresenceState</methodName> <params> <param> <value> <string>mirceac</string> </value> </param> </params> </methodCall>
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)
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:
<?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
- setPresenceStatus(String id, String status)
This method sets the given status message of the given XMPP user id
XML to send:
<?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>
It 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> </struct> </value> </param> </params> </methodResponse>
- public Map getPresenceStatus(String id)
This method returns the presence status message of the given XMPP user id
XML to send:
<?xml version="1.0"?> <methodCall> <methodName>presenceServer.getPresenceStatus</methodName> <params> <param> <value> <string>mirceac</string> </value> </param> </params> </methodCall>
It 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>Here</value> </member> <member> <name>status-code</name> <value>ok</value> </member> </struct> </value> </param> </params> </methodResponse>
- ping(String originatorName)
This method verifies if the XMPP server is up
XML to send:
<?xml version="1.0"?> <methodCall> <methodName>presenceServer.ping</methodName> <params> <param> <value> <string>mirceac</string> </value> </param> </params> </methodCall>
It returns 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>status-code</name> <value>ok</value> </member> <member> <name>instance-handle</name> <value>of:821711375117195347</value> </member> </struct> </value> </param> </params> </methodResponse>
- registerPresenceMonitor(String protocol, String serverUrl )
This method registers a listener to be notified when the presence changes