break;
case TimerLong:
SipServletRequest byeRequest = null;
ReplicationUnitOfWork uow = new ReplicationUnitOfWork();
try {
synchronized (this) {
if (m_State == CONFIRMED_UAS) {
m_State = TIMEOUT_UAS;
if (m_TimerShort != null) {
m_TimerShort.cancel();
m_TimerShort = null;
}
if (m_Log.isLoggable(Level.FINE)) {
m_Log.log(Level.FINE,
"Timer fired after 64*T1s - end dialog");
}
// Lock the DS for the entire duration.
SipSession session = m_RetransmitResponse.getSession();
DialogFragment dialog = ((SipSessionImplBase) session).getDF();
if (dialog != null) { // to be on the safe side
uow.lockDialog(dialog);
}
// issue 1085 :: create byeRequest before invoking the listeners.
// issue 1350 :: check that session is still valid. If app is undeployed it will not be
if(session.isValid()){
byeRequest = session.createRequest("BYE");
}
else {
if (m_Log.isLoggable(Level.FINE)) {
m_Log.log(Level.FINE,
"Skipping to send BYE since SipSession is no longer valid");
}
}
// invoke the listeners first, then they will still be done if anything
// goes wrong later with the actual creating or sending of the bye
// XXX ? should we not check if the SAS is still valid at this point?
SipApplicationSessionImpl sas = m_RetransmitResponse.getSessionImpl().getApplicationSessionImpl();
if(sas!=null){
SipApplicationListeners sipAppListeners = sas.getSipApplicationListeners();
if (sipAppListeners != null) {
ArrayList<SipErrorListener> sipErrorList =
sipAppListeners.getSipErrorListeners();
for (SipErrorListener listener : sipErrorList) {
try {
listener.noAckReceived(new SipErrorEvent(
m_RetransmitResponse.getRequest(),
m_RetransmitResponse));
} catch (Throwable t) {
m_Log.log(Level.WARNING, t.getMessage(), t);
}
}
}
}
}
}
// send after synchronization...
if (byeRequest != null) {
if (disableByeOnNoAckReceived) {
if (m_Log.isLoggable(Level.FINE)) {
m_Log.log(Level.FINE, "BYE is not automatically sent by the container for no ACK recieved.");
}
} else {
byeRequest.send();
}
}
} catch (IncompleteDialogException e) { // uow.lockdialog can cause this.
if (m_Log.isLoggable(Level.FINE)) {
m_Log.log(Level.FINE, "The dialog was incomplete while handling TimerLong. Skipping send", e);
}
} catch (RemoteLockRuntimeException e) { // uow.lockdialog or getSASImpl() can cause this.
if (m_Log.isLoggable(Level.FINE)) {
m_Log.log(Level.FINE, "The dialog was remotely locked while handling TimerLong. Skipping send", e);
}
} catch (IOException e) { /// bye.send can cause this.
m_Log.log(Level.WARNING, "Problem sending BYE", e);
} finally {
uow.saveAndUnlock();
}
break;
case TimerShortProvRsp: