The Publish program is called by the different modules to send presence information to the presence server. The PUBLISH message is created using the arguments sent in from the modules (these values are set in the configuration file of each module). After the message has been created, it creates the body of the message translated into PIDF format. The message is then sent over the network to the presence server according to settings in the configuration file of the sip stack.
Operating System : Windows.
Language: Java
Software: MJSIP java sipstack
The Publish class is build on top of the existing MJSIP sip protocol stack. Therefore changes must be made to the main configuration file, to set up relevant routing information for sending messages to the presence server.
Sample of the server.cfg file follows:
# MjSip Server configuration file
# ___________________________________________
#
# ********** sip ***********
via_addr=honamsun.cs.columbia.edu
host_port=5060
transport_protocols=udp tcp
outbound_proxy=honamsun.cs.columbia.edu
The host_port contains the port number of the presence server, and the outbound_proxy is setup to the presence server's hostname.
The publishPIDF function of PUBLISH is called by the different modules which wish to publish information to the presence server. The main body of the PUBLISH message (such as the To, From headers) is created using parameters such as username, hostname, destination port passed in from the modules. After the message has been created, the body of the message in translated into PIDF format.
The Modules also send in information about their location and activity, this information is used in the creation of the body of the message (PIDF). The XML message is hard-coded with inputs from the modules concerning their location, activity and user identification information.
Sample PUBLISH message:
PUBLISH sip:Rekha@cs.columbia.edu SIP/2.0
Via: SIP/2.0/UDP honamsun.cs.columbia.edu:5060;rport;branch=z9hG4bK69107
Max-Forwards: 70
To: <sip:Rekha@cs.columbia.edu>
From: <sip:Rekha@cs.columbia.edu>;tag=z9hG4bK36146617
Call-ID: 856533295196@honamsun.cs.columbia.edu
CSeq: 1 PUBLISH
Contact: <sip:Rekha@cs.columbia.edu:6060>
Expires: 3600
User-Agent: mjsip stack 1.6
Event: presence
Content-Length: 742
Content-Type: application/cpim-pidf+xml
<?xml version="1.0" encoding="UTF-8"?>
<presence xmlns="urn:ietf:params:xml:ns:cpim-pidf"
xmlns:local="urn:automatedBusy:pidf-status-type"
xmlns:dm="urn:ietf:params:xml:ns:pidf:person"
xmlns:es="urn:ietf:params:xml:ns:pidf:status:rpid-status"
xmlns:et="urn:ietf:params:xml:ns:pidf:rpid-tuple"
xmlns:ts="urn:ietf:params:xml:ns:pidf:timed-status"
entity="pres:rd2241@cs.columbia.edu "
<tuple id="fce89076">
<status>
<basic>"closed"</basic>
<dm:person>
<et:class>"Rekha"</et:class>
<dm:status>
<es:activities>
<es:activity>"DYNAMIC"</es:activity>
</es:activities>
</dm:status>
</dm:person>
<local:location>"CS Lounge, Mudd, NY 10027"</local:location>
</status>
</tuple>
</presence>
The publish message generated gets its username, hostname, location, activity arguments, from each module when it is called to publish presence information to the server. Multiple xml namespaces are used in the PIDF for specifying location and activity information. The PIDF skeleton structure is fixed with each module filling in information such as the location, activity of the user, username and whether they are busy or not, which is set in the <basic> xml element as closed or opened.
The system was tested by having the various modules call its publishPIDF function to publish messages to the presence server. Since the subsystems are all different, the function had to take care of differences in their requirements. For example a calendar entry does not always have location information and a RFID tags always sends in location information.
Learning to work with MJSIP.