Open adkhadilkar opened 5 years ago
Fully agree with the suggested change by @adkhadilkar
I was having situation where the TCP connection between SIP Proxy and B2BUA is closed sometimes and the behaviour when using NioTcpMessageProcessor was working randomly. Instead using the regular TCPMessageProcessor it was working fine,.
I added the lines suggested then socket is recreated adequately and the issue i was having is corrected ( i guess previously it was closed in the finally clause :-( )
--- a/src/gov/nist/javax/sip/stack/NIOHandler.java
+++ b/src/gov/nist/javax/sip/stack/NIOHandler.java
@@ -303,6 +303,7 @@ public class NIOHandler {
receiverAddress + " " + contactPort + " " + senderAddress);
}
putSocket(key, clientSock);
+ connected=true;
break;
} else {
break;
@@ -354,6 +355,7 @@ public class NIOHandler {
clientSock = messageProcessor.connect(new InetSocketAddress(receiverAddress, contactPort),
senderAddress, this.messageProcessor.sipStack.connTimeout);
putSocket(key, clientSock);
+ connected=true;
}
So i would agree with the reported issue.
First thanks for making this great library for SIP communication !!
While using the Jain SIP library for SIP over Websocket, I found one issue in NIOHandler.java file in openOutgoingConnection method. Inside the openOutgoingConnection there is connected flag (Line 257) defined which wasn't updated in the same method. As we are checking the value in finally(Line 369/371) everytime it is creating new socket.
Ideally from my understanding we need to set the connected to true once we create the socket. before/after putSocket(key, clientSock); line (305/356)