[jitsi-dev] [jitsi] Force transport selection when sips URI or transport parameter (#52)


#1

Tested with a registrarless account, this seems to work for UDP and TCP.

To make a call, use a URI like:

 sip:bob@example.org;transport=TCP

Without this patch, Jitsi registrarless accounts will always try UDP
https://trac.jitsi.org/ticket/1300#comment:2

For TLS, further work appears to be needed elsewhere in the stack as well, but this patch doesn't break any existing behavior so it can be safely merged. When trying TLS, there is an exception like this:

     [java] 14:10:36.432 SEVERE: [67] impl.protocol.sip.ProtocolProviderServiceSipImpl.getLocalViaHeaders().1233 Unable to create a via header for port 38876
     [java] java.io.IOException: The provider that requested the SSL Socket could not be found
     [java]     at net.java.sip.communicator.impl.protocol.sip.net.SslNetworkLayer.getSSLSocketFactory(SslNetworkLayer.java:202)
     [java]     at net.java.sip.communicator.impl.protocol.sip.net.SslNetworkLayer.createSSLSocket(SslNetworkLayer.java:281)
     [java]     at gov.nist.javax.sip.stack.IOHandler.getLocalAddressForTlsDst(IOHandler.java:199)
     [java]     at gov.nist.javax.sip.stack.SIPTransactionStack.getLocalAddressForTlsDst(SIPTransactionStack.java:643)
     [java]     at net.java.sip.communicator.impl.protocol.sip.SipStackSharing.getLocalAddressForDestination(SipStackSharing.java:1155)
     [java]     at net.java.sip.communicator.impl.protocol.sip.ProtocolProviderServiceSipImpl.getLocalViaHeaders(ProtocolProviderServiceSipImpl.java:1190)
     [java]     at net.java.sip.communicator.impl.protocol.sip.ProtocolProviderServiceSipImpl.getLocalViaHeaders(ProtocolProviderServiceSipImpl.java:1152)
     [java]     at net.java.sip.communicator.impl.protocol.sip.SipMessageFactory.createInviteRequest(SipMessageFactory.java:775)
     [java]     at net.java.sip.communicator.impl.protocol.sip.SipMessageFactory.createInviteRequest(SipMessageFactory.java:864)
     [java]     at net.java.sip.communicator.impl.protocol.sip.CallSipImpl.invite(CallSipImpl.java:357)
     [java]     at net.java.sip.communicator.impl.protocol.sip.OperationSetBasicTelephonySipImpl.createOutgoingCall(OperationSetBasicTelephonySipImpl.java:173)
     [java]     at net.java.sip.communicator.impl.protocol.sip.OperationSetBasicTelephonySipImpl.createCall(OperationSetBasicTelephonySipImpl.java:118)
     [java]     at net.java.sip.communicator.service.protocol.media.AbstractOperationSetBasicTelephony.createCall(AbstractOperationSetBasicTelephony.java:111)
     [java]     at net.java.sip.communicator.impl.protocol.sip.UriHandlerSipImpl.handleUri(UriHandlerSipImpl.java:313)
     [java]     at net.java.sip.communicator.impl.argdelegation.ArgDelegationPeerImpl.handleUri(ArgDelegationPeerImpl.java:186)
     [java]     at net.java.sip.communicator.util.launchutils.ArgDelegator.handleUri(ArgDelegator.java:62)
     [java]     at net.java.sip.communicator.util.launchutils.LaunchArgHandler.handleConcurrentInvocationRequestArgs(LaunchArgHandler.java:557)
     [java]     at net.java.sip.communicator.util.launchutils.SipCommunicatorLock$LockServerConnectionProcessor.run(SipCommunicatorLock.java:827)
     [java] 14:10:39.124 SEVERE: [67] impl.protocol.sip.UriHandlerSipImpl.showErrorMessage().403 Failed to create a call to sip:bob@example.org;transport=tls
     [java] net.java.sip.communicator.service.protocol.OperationFailedException: Unable to create a via header for port 38876
     [java]     at net.java.sip.communicator.impl.protocol.sip.ProtocolProviderServiceSipImpl.getLocalViaHeaders(ProtocolProviderServiceSipImpl.java:1237)
     [java]     at net.java.sip.communicator.impl.protocol.sip.ProtocolProviderServiceSipImpl.getLocalViaHeaders(ProtocolProviderServiceSipImpl.java:1152)
     [java]     at net.java.sip.communicator.impl.protocol.sip.SipMessageFactory.createInviteRequest(SipMessageFactory.java:775)
     [java]     at net.java.sip.communicator.impl.protocol.sip.SipMessageFactory.createInviteRequest(SipMessageFactory.java:864)
     [java]     at net.java.sip.communicator.impl.protocol.sip.CallSipImpl.invite(CallSipImpl.java:357)
     [java]     at net.java.sip.communicator.impl.protocol.sip.OperationSetBasicTelephonySipImpl.createOutgoingCall(OperationSetBasicTelephonySipImpl.java:173)
     [java]     at net.java.sip.communicator.impl.protocol.sip.OperationSetBasicTelephonySipImpl.createCall(OperationSetBasicTelephonySipImpl.java:118)
     [java]     at net.java.sip.communicator.service.protocol.media.AbstractOperationSetBasicTelephony.createCall(AbstractOperationSetBasicTelephony.java:111)
     [java]     at net.java.sip.communicator.impl.protocol.sip.UriHandlerSipImpl.handleUri(UriHandlerSipImpl.java:313)
     [java]     at net.java.sip.communicator.impl.argdelegation.ArgDelegationPeerImpl.handleUri(ArgDelegationPeerImpl.java:186)
     [java]     at net.java.sip.communicator.util.launchutils.ArgDelegator.handleUri(ArgDelegator.java:62)
     [java]     at net.java.sip.communicator.util.launchutils.LaunchArgHandler.handleConcurrentInvocationRequestArgs(LaunchArgHandler.java:557)
     [java]     at net.java.sip.communicator.util.launchutils.SipCommunicatorLock$LockServerConnectionProcessor.run(SipCommunicatorLock.java:827)
     [java] Caused by: java.io.IOException: The provider that requested the SSL Socket could not be found
     [java]     at net.java.sip.communicator.impl.protocol.sip.net.SslNetworkLayer.getSSLSocketFactory(SslNetworkLayer.java:202)
     [java]     at net.java.sip.communicator.impl.protocol.sip.net.SslNetworkLayer.createSSLSocket(SslNetworkLayer.java:281)
     [java]     at gov.nist.javax.sip.stack.IOHandler.getLocalAddressForTlsDst(IOHandler.java:199)
     [java]     at gov.nist.javax.sip.stack.SIPTransactionStack.getLocalAddressForTlsDst(SIPTransactionStack.java:643)
     [java]     at net.java.sip.communicator.impl.protocol.sip.SipStackSharing.getLocalAddressForDestination(SipStackSharing.java:1155)
     [java]     at net.java.sip.communicator.impl.protocol.sip.ProtocolProviderServiceSipImpl.getLocalViaHeaders(ProtocolProviderServiceSipImpl.java:1190)

You can merge this Pull Request by running:

  git pull https://github.com/dpocock/jitsi sip-call-transport-param

Or you can view, comment on it, or merge it online at:

  https://github.com/jitsi/jitsi/pull/52

-- Commit Summary --

  * Force transport selection when sips URI or transport parameter

-- File Changes --

    M src/net/java/sip/communicator/impl/protocol/sip/CallSipImpl.java (35)

-- Patch Links --

https://github.com/jitsi/jitsi/pull/52.patch
https://github.com/jitsi/jitsi/pull/52.diff

···

---
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/jitsi/pull/52


#2

The problem with TLS comes down to a UI problem and how certificate validation in Java works. In the end, the SIP socket factory (which is generic to all accounts) needs to find the provider that requested the socket to retrieve the domain names that are valid for the received certificate. Now in regless-mode there is a) no single socket and b) the valid names on the certificate would need to be matched against the called URI (as opposed to the proxy). This won't be easy...

···

---
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/jitsi/pull/52#issuecomment-51687002


#3

Yes, I understood there was more effort involved. Even so, this patch is useful - it allows people to select TCP instead of UDP. Even if they select TLS and it doesn't work, it now gives an error popup rather than silently trying UDP.

···

---
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/jitsi/pull/52#issuecomment-51687178


#4

Merged #52.

···

---
Reply to this email directly or view it on GitHub:
https://github.com/jitsi/jitsi/pull/52#event-151042937