use of gov.nist.javax.sip.header.TimeStamp in project XobotOS by xamarin.
the class SIPClientTransaction method fireRetransmissionTimer.
/**
* Called by the transaction stack when a retransmission timer fires.
*/
protected void fireRetransmissionTimer() {
try {
// Resend the last request sent
if (this.getState() == null || !this.isMapped)
return;
boolean inv = isInviteTransaction();
TransactionState s = this.getState();
// Bug-fix for non-INVITE transactions not retransmitted when 1xx response received
if ((inv && TransactionState.CALLING == s) || (!inv && (TransactionState.TRYING == s || TransactionState.PROCEEDING == s))) {
if (lastRequest != null) {
if (sipStack.generateTimeStampHeader && lastRequest.getHeader(TimeStampHeader.NAME) != null) {
long milisec = System.currentTimeMillis();
TimeStamp timeStamp = new TimeStamp();
try {
timeStamp.setTimeStamp(milisec);
} catch (InvalidArgumentException ex) {
InternalErrorHandler.handleException(ex);
}
lastRequest.setHeader(timeStamp);
}
super.sendMessage(lastRequest);
if (this.notifyOnRetransmit) {
TimeoutEvent txTimeout = new TimeoutEvent(this.getSipProvider(), this, Timeout.RETRANSMIT);
this.getSipProvider().handleEvent(txTimeout, this);
}
if (this.timeoutIfStillInCallingState && this.getState() == TransactionState.CALLING) {
this.callingStateTimeoutCount--;
if (callingStateTimeoutCount == 0) {
TimeoutEvent timeoutEvent = new TimeoutEvent(this.getSipProvider(), this, Timeout.RETRANSMIT);
this.getSipProvider().handleEvent(timeoutEvent, this);
this.timeoutIfStillInCallingState = false;
}
}
}
}
} catch (IOException e) {
this.raiseIOExceptionEvent();
raiseErrorEvent(SIPTransactionErrorEvent.TRANSPORT_ERROR);
}
}
use of gov.nist.javax.sip.header.TimeStamp in project XobotOS by xamarin.
the class SIPDialog method resendAck.
/**
* Resend the last ack.
*/
public void resendAck() throws SipException {
if (this.getLastAckSent() != null) {
if (getLastAckSent().getHeader(TimeStampHeader.NAME) != null && sipStack.generateTimeStampHeader) {
TimeStamp ts = new TimeStamp();
try {
ts.setTimeStamp(System.currentTimeMillis());
getLastAckSent().setHeader(ts);
} catch (InvalidArgumentException e) {
}
}
this.sendAck(getLastAckSent(), false);
}
}
Aggregations