jain-sip
jain-sip copied to clipboard
Surface TLS errors that have to do with untrusted server certificates
Scenario:
- Android Olympus tried to register with an RC instance where we are using a self-signed certificate (for testing)
- Registration fails because the client doesn't trust the server cert by default but there is no apparent error returned through the JAIN SIP API
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:
- ClientTransaction.sendRequest() for the REGISTER or
- Asynchronously call SipListener.processIOException()
@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]]