diff options
author | Emil Ivov <emcho@jitsi.org> | 2014-05-26 21:00:58 +0200 |
---|---|---|
committer | Emil Ivov <emcho@jitsi.org> | 2014-05-26 21:00:58 +0200 |
commit | 63bb9bf64a225cbdf3758d525ddfa90f2a87adcd (patch) | |
tree | d6b9ddfc83d45e168eed7e43b2c8de08c5cf4620 /src | |
parent | 4a8eeafe6ca3bc04e2ef9c48972dcfca56ca55d6 (diff) | |
download | jitsi-63bb9bf64a225cbdf3758d525ddfa90f2a87adcd.zip jitsi-63bb9bf64a225cbdf3758d525ddfa90f2a87adcd.tar.gz jitsi-63bb9bf64a225cbdf3758d525ddfa90f2a87adcd.tar.bz2 |
Fixes an issue with non-responses to INVITEs arriving within a TERMINATED dialog by responding with a 481 Call/Transaction Does Not Exist.
Diffstat (limited to 'src')
-rw-r--r-- | src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java | 60 |
1 files changed, 58 insertions, 2 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java index 858af41..10b368a 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java @@ -313,8 +313,17 @@ public class OperationSetBasicTelephonySipImpl } else { - logger.error("reINVITEs while the dialog is not " - + "confirmed are not currently supported."); + if (dialogState.equals(DialogState.TERMINATED)) + { + processStrayInvite(serverTransaction); + } + else + { + logger.error("reINVITEs while the dialog is not " + + "confirmed are not currently supported."); + } + + processed = true; } } // ACK @@ -1167,6 +1176,53 @@ public class OperationSetBasicTelephonySipImpl } /** + * Processes stray INVITE requests that arrive for a dialog which has been + * already terminated. This method simply responds with a + * 481 Call/Transaction Does Not exist. + * + * @param serverTransaction the ServerTransaction the INVITE request + * arrived in. + */ + private void processStrayInvite(ServerTransaction serverTransaction) + { + Request inviteRequest = serverTransaction.getRequest(); + + // Send 481 Call/Transaction Does Not exist + Response noSuchCall = null; + try + { + noSuchCall = messageFactory.createResponse( + Response.CALL_OR_TRANSACTION_DOES_NOT_EXIST, inviteRequest); + } + catch (ParseException ex) + { + logger + .error("Error while trying to send a response to an INVITE", ex); + /* + * No need to let the user know about the error since it doesn't + * affect them. + */ + } + + if (noSuchCall != null) + { + try + { + serverTransaction.sendResponse(noSuchCall); + if (logger.isDebugEnabled()) + logger.debug("sent response " + noSuchCall); + } + catch (Exception ex) + { + logger.error("Failed to reject a stray INVITE with a 481, " + + "exception was:\n", ex); + } + } + + //there's really nothing else for us to do here. + } + + /** * Sets the state of the specifies call peer as DISCONNECTED. * * @param serverTransaction the transaction that the cancel was received in. |