HP-UX Java SIP Stack Programmer's Guide (February 2008)

Forming a SIP Message
You can use factories to create a SIP message. Therefore, you must create the factories
before forming a SIP message.
Follow this procedure to create factories:
1. To create an address, use the AddressFactory interface, as follows:
Address address=addressFactory.createAddress(URI);
Address address=addressFactory.createAddress(String);
Address address=addressFactory.createAddress(String, URI);
2. To create a header, use the HeaderFactory interface, as follows:
AcceptHeader accept=headerFactory.createAcceptHeader
(String, String);
3. To create a request message or response message using a message factory, use the
MessageFactory interfaces, as follows:
Request request=messageFactory.createRequest(<parameters>);
Response response=messageFactory.createResponse(<parameters>);
Sending a SIP Message
You can send a SIP message in the following scenarios:
Stateless
Transaction-Stateful
Dialog-Stateful
The following methods enable you to send messages in different scenarios:
To send a message in a stateless scenario, send the request or response to the
transport using the obtained SipProvider object, specified as follows:
provider.sendResponse(Response);
provider.sendRequest(Request);
Follow this procedure to send a message in a transaction-stateful scenario:
1. To create a new client or server transaction from the SipProvider, use the
following methods:
ClientTransaction ctr=provider.getNewClientTransaction();
ServerTransaction str=provider.getNewServerTransaction();
Forming a SIP Message 53