Fields Summary |
---|
private gov.nist.siplite.message.Request | requestThe current request to be processed. |
private javax.microedition.sip.SipClientConnection | sipClientConnectionThe associated connection client. |
private javax.microedition.sip.SipConnectionNotifier | sipConnectionNotifierThe connection state notifier. |
private javax.microedition.sip.SipRefreshListener | sipRefreshListenerThe current refresh event listener. |
private String | taskIdThe task identifier. |
Methods Summary |
---|
public gov.nist.siplite.header.CallIdHeader | getNewCallId()Gets the new caller identifier.
return ((SipConnectionNotifierImpl)sipConnectionNotifier).
getSipProvider().getNewCallId();
|
public synchronized gov.nist.siplite.message.Request | getRequest()Returns the request to refresh
return request;
|
public javax.microedition.sip.SipClientConnection | getSipClientConnection()Return the sipClientconnection on which is enabled the listener
return sipClientConnection;
|
public javax.microedition.sip.SipConnectionNotifier | getSipConnectionNotifier()Return the callback interface listening for events on this task
return sipConnectionNotifier;
|
public javax.microedition.sip.SipRefreshListener | getSipRefreshListener()Return the callback interface listening for events on this task
return sipRefreshListener;
|
public java.lang.String | getTaskId()Returns the task identifier
return taskId;
|
public void | run()Run the refresh thread.
Request clonedRequest = (Request)request.clone();
// setRequestHeaders(clonedRequest);
request = null;
try {
updateAndSendRequest(clonedRequest);
} catch (Exception ex) {
if (Logging.REPORT_LEVEL <= Logging.WARNING) {
Logging.report(Logging.WARNING, LogChannels.LC_JSR180,
"RefreshTask.run(): can't send a message: " + ex);
}
}
|
public synchronized void | setRequestHeaders(gov.nist.siplite.message.Request clonedRequest)Sets appropriate CSeq and Via headers in the given request
preparing it for sending.
// RFC 3261, section 10.2.4, Refreshing Bindings:
// "A UA SHOULD use the same Call-ID for all registrations during a
// single boot cycle".
//
// Call-Id header was added in SipClientConnectionImpl.send()
// when the initial request was sent. This is the reason why
// Call-Id header is not added here.
// Update the CSeq header. RFC 3261, p. 58:
// A UA MUST increment the CSeq value by one for each
// REGISTER request with the same Call-ID.
CSeqHeader cseq = clonedRequest.getCSeqHeader();
if (cseq != null) {
cseq.setSequenceNumber(cseq.getSequenceNumber() + 1);
} else {
// log an error
if (Logging.REPORT_LEVEL <= Logging.ERROR) {
Logging.report(Logging.ERROR, LogChannels.LC_JSR180,
"RefreshTask.run(): The request doesn't " +
"contain CSeq header!");
}
}
// ViaHeader
clonedRequest.removeHeader(ViaHeader.NAME);
Vector viaHeaders = new Vector();
try {
ViaHeader viaHeader = StackConnector
.headerFactory
.createViaHeader(
sipConnectionNotifier.getLocalAddress(),
sipConnectionNotifier.getLocalPort(),
((SipConnectionNotifierImpl)
sipConnectionNotifier)
.getSipProvider().getListeningPoint()
.getTransport(),
null);
viaHeaders.addElement(viaHeader);
} catch (ParseException ex) {
if (Logging.REPORT_LEVEL <= Logging.WARNING) {
Logging.report(Logging.WARNING, LogChannels.LC_JSR180,
"RefreshTask.run(): can't create Via header: " + ex);
}
} catch (IOException ioe) {
if (Logging.REPORT_LEVEL <= Logging.WARNING) {
Logging.report(Logging.WARNING, LogChannels.LC_JSR180,
"RefreshTask.run(): can't create Via header: " + ioe);
}
}
try {
clonedRequest.setVia(viaHeaders);
} catch (SipException ex) {
if (Logging.REPORT_LEVEL <= Logging.WARNING) {
Logging.report(Logging.WARNING, LogChannels.LC_JSR180,
"RefreshTask.run(): can't set Via header: " + ex);
}
}
|
public synchronized void | updateAndSendRequest(gov.nist.siplite.message.Request updatedRequest)Updates the request in the sipClientConnection and sends it.
request = updatedRequest;
setRequestHeaders(request);
((SipClientConnectionImpl)sipClientConnection).
updateAndSendRequestFromRefresh(request);
|
public synchronized java.io.OutputStream | updateRequestAndOpenOutputStream(gov.nist.siplite.message.Request updatedRequest)Updates the request in the sipClientConnection and calls
SipClientConnection.openContentOutputStream() to fill
the new message body content.
request = updatedRequest;
setRequestHeaders(request);
return ((SipClientConnectionImpl)sipClientConnection).
updateRequestAndOpenOutputStream(request);
|