jitsi/jitsi — pull request #52 by dpocock (2014-08-09 12:11:38+00:00)
Title: Force transport selection when sips URI or transport parameter

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)
```