RestComm / jain-sip

Disclaimer: This repository is a git-svn mirror of the project found at http://java.net/projects/jsip whose original repository is developed collaboratively by the Advanced Networking Technologies Division at the National Institute of Standards and Technology (NIST) - an agency of the United States Department of Commerce and by a community of individual and enterprise contributors. TeleStax, Inc. will perform some productization work, new features experimentation branches, etc for its TelScale jSIP product that doesn't concern the community from the main repository hence this git repository.
http://www.restcomm.com/
144 stars 152 forks source link

Surface TLS errors that have to do with untrusted server certificates #158

Open atsakiridis opened 7 years ago

atsakiridis commented 7 years ago

Scenario:

I was thinking that it might be worth surfacing this sort of error so the user knows what the issue is, since its a typical configuration that most people will find themselves testing with. For me it took me some time to figure out because by default JAIN SIP logs aren't shown anywhere and I just saw the REGISTER stuck for no apparent reason. Maybe we could return an exception either during:

@jaimecasero: wdyt?


DEBUG - android.gov.nist.javax.sip.stack.NioTcpMessageChannel.readChannel(NioTcpMessageChannel.java:93) [NioTcpMessageChannel::readChannel]
DEBUG - android.gov.nist.javax.sip.stack.NioTcpMessageChannel.readChannel(NioTcpMessageChannel.java:100) [Read 821 from socketChannel]
DEBUG - android.gov.nist.javax.sip.stack.NioTlsMessageChannel.addBytes(NioTlsMessageChannel.java:216) [Adding TLS bytes for decryption 821]
DEBUG - android.gov.nist.javax.sip.stack.SSLStateMachine.unwrap(SSLStateMachine.java:298) [Unwrap src java.nio.HeapByteBuffer[pos=0 lim=821 cap=821] dst java.nio.DirectByteBuffer[pos=0 lim=16384 cap=16384]]
DEBUG - android.gov.nist.javax.sip.stack.SSLStateMachine.unwrap(SSLStateMachine.java:308) [An Exception occured while trying to unwrap the message javax.net.ssl.SSLHandshakeException: Handshake failed]
DEBUG - android.gov.nist.javax.sip.stack.NioTcpMessageChannel.readChannel(NioTcpMessageChannel.java:132) [IOException  closing sock javax.net.ssl.SSLHandshakeException: Handshake failedmyAddress:myport 192.168.2.52:5090, remoteAddress:remotePort /192.168.2.35:5081]
DEBUG - android.gov.nist.javax.sip.stack.NioTcpMessageChannel.close(NioTcpMessageChannel.java:224) [Closing NioTcpMessageChannel android.gov.nist.javax.sip.stack.NioTlsMessageChannel@ae71ab7 socketChannel = java.nio.channels.SocketChannel[connected local=/192.168.2.52:43630 remote=/192.168.2.35:5081]]