Search in sources :

Example 1 with TimeStamp

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);
    }
}
Also used : TransactionState(javax.sip.TransactionState) InvalidArgumentException(javax.sip.InvalidArgumentException) TimeoutEvent(javax.sip.TimeoutEvent) IOException(java.io.IOException) TimeStamp(gov.nist.javax.sip.header.TimeStamp)

Example 2 with TimeStamp

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);
    }
}
Also used : InvalidArgumentException(javax.sip.InvalidArgumentException) TimeStamp(gov.nist.javax.sip.header.TimeStamp)

Aggregations

TimeStamp (gov.nist.javax.sip.header.TimeStamp)2 InvalidArgumentException (javax.sip.InvalidArgumentException)2 IOException (java.io.IOException)1 TimeoutEvent (javax.sip.TimeoutEvent)1 TransactionState (javax.sip.TransactionState)1