HP-UX Java SIP Stack Programmer's Guide (February 2008)
To use an existing client or server transaction formed by the arrival of request
or response events, use the following methods:
— ServerTransaction str=RequestEvent.getServerTransaction();
— ClientTransaction ctr=ResponseEvent.getClientTransaction();
2. Send the request or response using the obtained transaction object, specified
as follows:
ctr.sendRequest();
str.sendResponse(Response);
• Follow this procedure to send a message in a dialog-stateful scenario:
1. To create a new dialog from the SipProvider, use the following method:
Dialog dialog=provider.getNewDialog();
To use an existing dialog formed by the arrival of events, use the following
method:
Dialog dialog=ResponseEvent.getDialog();
Dialog dialog=RequestEvent.getDialog();
2. To send the request using the obtained dialog object, specify the following
methods:
dialog.sendRequest(ClientTransaction);
Processing an Event
The receipt of a request message or response message is notified to an application as
events. Processing an event involves receiving and parsing the SIP message. This section
describes how to receive and parse SIP messages.
Follow this procedure to process an event:
1. To receive a message, use the getRequest() or getResponse() API using an
instance of the RequestEvent or ResponseEvent, specified as follows:
Request req=RequestEvent.getRequest();
Response resp=ResponseEvent.getResponse();
2. To parse a message, use the appropriate get* APIs, such as getHeader() or
getContentLength() of the Message interface.
3. To set values, use the appropriate set* APIs, such as setHeader() or
setContentLength() of the Message interface.
54 Creating an Application