diff --git a/lib/installer-exclude/ice4j.jar b/lib/installer-exclude/ice4j.jar index e0429aa3a..47b51a81e 100644 Binary files a/lib/installer-exclude/ice4j.jar and b/lib/installer-exclude/ice4j.jar differ diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties index 8fbf27648..72e9226c0 100644 --- a/resources/languages/resources.properties +++ b/resources/languages/resources.properties @@ -573,6 +573,12 @@ service.gui.callinfo.ICE_STATE.Waiting=Gather candidates service.gui.callinfo.ICE_STATE.Running=Connectivity checks service.gui.callinfo.ICE_STATE.Completed=Completed service.gui.callinfo.ICE_STATE.Failed=Failed +service.gui.callinfo.ICE_LOCAL_HOST_ADDRESS=Local host IP / Port: +service.gui.callinfo.ICE_LOCAL_REFLEXIVE_ADDRESS=Local reflexive IP / Port: +service.gui.callinfo.ICE_LOCAL_RELAYED_ADDRESS=Local relayed IP / Port: +service.gui.callinfo.ICE_REMOTE_HOST_ADDRESS=Remote host IP / Port: +service.gui.callinfo.ICE_REMOTE_REFLEXIVE_ADDRESS=Remote reflexive IP / Port: +service.gui.callinfo.ICE_REMOTE_RELAYED_ADDRESS=Remote relayed IP / Port: service.gui.ALWAYS_TRUST=Always trust this certificate service.gui.CERT_DIALOG_TITLE=Verify Certificate diff --git a/src/net/java/sip/communicator/impl/gui/main/call/CallInfoFrame.java b/src/net/java/sip/communicator/impl/gui/main/call/CallInfoFrame.java index cec4b0e48..80498d1de 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/CallInfoFrame.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/CallInfoFrame.java @@ -8,6 +8,7 @@ import java.awt.*; import java.beans.*; +import java.net.*; import java.util.*; import java.util.List; @@ -274,15 +275,6 @@ private void constructPeerInfo(CallPeer callPeer, StringBuffer stringBuffer) if(callPeerMediaHandler != null) { - String iceCandidateExtendedType = - callPeerMediaHandler.getICECandidateExtendedType(); - if(iceCandidateExtendedType != null) - { - stringBuffer.append(getLineString(resources.getI18NString( - "service.gui.callinfo.ICE_CANDIDATE_EXTENDED_TYPE"), - iceCandidateExtendedType)); - } - String iceState = callPeerMediaHandler.getICEState(); if(iceState != null && !iceState.equals("Terminated")) { @@ -293,6 +285,7 @@ private void constructPeerInfo(CallPeer callPeer, StringBuffer stringBuffer) "service.gui.callinfo.ICE_STATE." + iceState))); } + MediaStream mediaStream = callPeerMediaHandler.getStream(MediaType.AUDIO); @@ -309,6 +302,7 @@ private void constructPeerInfo(CallPeer callPeer, StringBuffer stringBuffer) MediaType.AUDIO); constructAudioVideoInfo( + callPeerMediaHandler, mediaStream, stringBuffer, MediaType.AUDIO); @@ -329,6 +323,7 @@ private void constructPeerInfo(CallPeer callPeer, StringBuffer stringBuffer) MediaType.VIDEO); constructAudioVideoInfo( + callPeerMediaHandler, mediaStream, stringBuffer, MediaType.VIDEO); @@ -340,6 +335,8 @@ private void constructPeerInfo(CallPeer callPeer, StringBuffer stringBuffer) /** * Constructs audio video peer info. * + * @param callPeerMediaHandler The CallPeerMadiaHandler containing + * the AUDIO/VIDEO stream. * @param mediaStream the MediaStream that gives us access to * audio video info * @param stringBuffer the StringBuffer, where call peer info will @@ -348,6 +345,7 @@ private void constructPeerInfo(CallPeer callPeer, StringBuffer stringBuffer) * media handler must returns it encryption method. */ private void constructAudioVideoInfo( + CallPeerMediaHandler callPeerMediaHandler, MediaStream mediaStream, StringBuffer stringBuffer, MediaType mediaType) @@ -389,17 +387,118 @@ private void constructAudioVideoInfo( mediaStreamStats.getEncoding() + " / " + mediaStreamStats.getEncodingClockRate() + " Hz")); - stringBuffer.append( - getLineString( - resources.getI18NString("service.gui.callinfo.LOCAL_IP"), - mediaStreamStats.getLocalIPAddress() - + " / " + String.valueOf(mediaStreamStats.getLocalPort()))); + boolean displayedIpPort = false; + + // ICE candidate type + String iceCandidateExtendedType = + callPeerMediaHandler.getICECandidateExtendedType( + mediaType.toString()); + if(iceCandidateExtendedType != null) + { + stringBuffer.append(getLineString(resources.getI18NString( + "service.gui.callinfo.ICE_CANDIDATE_EXTENDED_TYPE"), + iceCandidateExtendedType)); + displayedIpPort = true; + } + + // Local host address + InetSocketAddress iceLocalHostAddress = + callPeerMediaHandler.getICELocalHostAddress(mediaType.toString()); + if(iceLocalHostAddress != null) + { + stringBuffer.append(getLineString(resources.getI18NString( + "service.gui.callinfo.ICE_LOCAL_HOST_ADDRESS"), + iceLocalHostAddress.getAddress().getHostAddress() + + "/" + iceLocalHostAddress.getPort())); + displayedIpPort = true; + } + + // Local reflexive address + InetSocketAddress iceLocalReflexiveAddress = + callPeerMediaHandler.getICELocalReflexiveAddress( + mediaType.toString()); + if(iceLocalReflexiveAddress != null) + { + stringBuffer.append(getLineString(resources.getI18NString( + "service.gui.callinfo.ICE_LOCAL_REFLEXIVE_ADDRESS"), + iceLocalReflexiveAddress.getAddress() + .getHostAddress() + + "/" + iceLocalReflexiveAddress.getPort())); + displayedIpPort = true; + } + + // Local relayed address + InetSocketAddress iceLocalRelayedAddress = + callPeerMediaHandler.getICELocalRelayedAddress( + mediaType.toString()); + if(iceLocalRelayedAddress != null) + { + stringBuffer.append(getLineString(resources.getI18NString( + "service.gui.callinfo.ICE_LOCAL_RELAYED_ADDRESS"), + iceLocalRelayedAddress.getAddress() + .getHostAddress() + + "/" + iceLocalRelayedAddress.getPort())); + displayedIpPort = true; + } + + // Remote relayed address + InetSocketAddress iceRemoteRelayedAddress = + callPeerMediaHandler.getICERemoteRelayedAddress( + mediaType.toString()); + if(iceRemoteRelayedAddress != null) + { + stringBuffer.append(getLineString(resources.getI18NString( + "service.gui.callinfo.ICE_REMOTE_RELAYED_ADDRESS"), + iceRemoteRelayedAddress.getAddress() + .getHostAddress() + + "/" + iceRemoteRelayedAddress.getPort())); + displayedIpPort = true; + } + + // Remote reflexive address + InetSocketAddress iceRemoteReflexiveAddress = + callPeerMediaHandler.getICERemoteReflexiveAddress( + mediaType.toString()); + if(iceRemoteReflexiveAddress != null) + { + stringBuffer.append(getLineString(resources.getI18NString( + "service.gui.callinfo.ICE_REMOTE_REFLEXIVE_ADDRESS"), + iceRemoteReflexiveAddress.getAddress() + .getHostAddress() + + "/" + iceRemoteReflexiveAddress.getPort())); + displayedIpPort = true; + } + + // Remote host address + InetSocketAddress iceRemoteHostAddress = + callPeerMediaHandler.getICERemoteHostAddress(mediaType.toString()); + if(iceRemoteHostAddress != null) + { + stringBuffer.append(getLineString(resources.getI18NString( + "service.gui.callinfo.ICE_REMOTE_HOST_ADDRESS"), + iceRemoteHostAddress.getAddress().getHostAddress() + + "/" + iceRemoteHostAddress.getPort())); + displayedIpPort = true; + } + + // If the stream does not use ICE, then show the transport IP/port. + if(!displayedIpPort) + { + stringBuffer.append( + getLineString( + resources.getI18NString("service.gui.callinfo.LOCAL_IP"), + mediaStreamStats.getLocalIPAddress() + + " / " + + String.valueOf(mediaStreamStats.getLocalPort()))); + + stringBuffer.append( + getLineString( + resources.getI18NString("service.gui.callinfo.REMOTE_IP"), + mediaStreamStats.getRemoteIPAddress() + + " / " + + String.valueOf(mediaStreamStats.getRemotePort()))); + } - stringBuffer.append( - getLineString( - resources.getI18NString("service.gui.callinfo.REMOTE_IP"), - mediaStreamStats.getRemoteIPAddress() - + " / " + String.valueOf(mediaStreamStats.getRemotePort()))); stringBuffer.append( getLineString( diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/IceUdpTransportManager.java b/src/net/java/sip/communicator/impl/protocol/jabber/IceUdpTransportManager.java index a85cc57a9..8ee05abc1 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/IceUdpTransportManager.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/IceUdpTransportManager.java @@ -1192,13 +1192,16 @@ public synchronized void close() * Returns the extended type of the candidate selected if this transport * manager is using ICE. * + * @param streamName The stream name (AUDIO, VIDEO); + * * @return The extended type of the candidate selected if this transport * manager is using ICE. Otherwise, returns null. */ - public String getICECandidateExtendedType() + public String getICECandidateExtendedType(String streamName) { return TransportManager.getICECandidateExtendedType( - this.iceAgent); + this.iceAgent, + streamName); } /** @@ -1211,6 +1214,142 @@ public String getICEState() return iceAgent.getState().toString(); } + /** + * Returns the ICE local host address. + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE local host address if this transport + * manager is using ICE. Otherwise, returns null. + */ + public InetSocketAddress getICELocalHostAddress(String streamName) + { + if(iceAgent != null) + { + LocalCandidate localCandidate = + iceAgent.getSelectedLocalCandidate(streamName); + if(localCandidate != null) + { + return localCandidate.getHostAddress(); + } + } + return null; + } + + /** + * Returns the ICE remote host address. + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE remote host address if this transport + * manager is using ICE. Otherwise, returns null. + */ + public InetSocketAddress getICERemoteHostAddress(String streamName) + { + if(iceAgent != null) + { + RemoteCandidate remoteCandidate = + iceAgent.getSelectedRemoteCandidate(streamName); + if(remoteCandidate != null) + { + return remoteCandidate.getHostAddress(); + } + } + return null; + } + + /** + * Returns the ICE local reflexive address (server or peer reflexive). + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE local reflexive address. May be null if this transport + * manager is not using ICE or if there is no reflexive address for the + * local candidate used. + */ + public InetSocketAddress getICELocalReflexiveAddress(String streamName) + { + if(iceAgent != null) + { + LocalCandidate localCandidate = + iceAgent.getSelectedLocalCandidate(streamName); + if(localCandidate != null) + { + return localCandidate.getReflexiveAddress(); + } + } + return null; + } + + /** + * Returns the ICE remote reflexive address (server or peer reflexive). + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE remote reflexive address. May be null if this transport + * manager is not using ICE or if there is no reflexive address for the + * remote candidate used. + */ + public InetSocketAddress getICERemoteReflexiveAddress(String streamName) + { + if(iceAgent != null) + { + RemoteCandidate remoteCandidate = + iceAgent.getSelectedRemoteCandidate(streamName); + if(remoteCandidate != null) + { + return remoteCandidate.getReflexiveAddress(); + } + } + return null; + } + + /** + * Returns the ICE local relayed address (server or peer relayed). + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE local relayed address. May be null if this transport + * manager is not using ICE or if there is no relayed address for the + * local candidate used. + */ + public InetSocketAddress getICELocalRelayedAddress(String streamName) + { + if(iceAgent != null) + { + LocalCandidate localCandidate = + iceAgent.getSelectedLocalCandidate(streamName); + if(localCandidate != null) + { + return localCandidate.getRelayedAddress(); + } + } + return null; + } + + /** + * Returns the ICE remote relayed address (server or peer relayed). + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE remote relayed address. May be null if this transport + * manager is not using ICE or if there is no relayed address for the + * remote candidate used. + */ + public InetSocketAddress getICERemoteRelayedAddress(String streamName) + { + if(iceAgent != null) + { + RemoteCandidate remoteCandidate = + iceAgent.getSelectedRemoteCandidate(streamName); + if(remoteCandidate != null) + { + return remoteCandidate.getRelayedAddress(); + } + } + return null; + } + /** * Retransmit state change events from the Agent to the media handler. * @param evt the event for state change. diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/RawUdpTransportManager.java b/src/net/java/sip/communicator/impl/protocol/jabber/RawUdpTransportManager.java index 0e52d38a0..b4eb73795 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/RawUdpTransportManager.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/RawUdpTransportManager.java @@ -654,10 +654,12 @@ public List wrapupCandidateHarvest() * Returns the extended type of the candidate selected if this transport * manager is using ICE. * + * @param streamName The stream name (AUDIO, VIDEO); + * * @return The extended type of the candidate selected if this transport * manager is using ICE. Otherwise, returns null. */ - public String getICECandidateExtendedType() + public String getICECandidateExtendedType(String streamName) { return null; } @@ -671,4 +673,86 @@ public String getICEState() { return null; } + + /** + * Returns the ICE local host address. + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE local host address if this transport + * manager is using ICE. Otherwise, returns null. + */ + public InetSocketAddress getICELocalHostAddress(String streamName) + { + return null; + } + + /** + * Returns the ICE remote host address. + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE remote host address if this transport + * manager is using ICE. Otherwise, returns null. + */ + public InetSocketAddress getICERemoteHostAddress(String streamName) + { + return null; + } + + /** + * Returns the ICE local reflexive address (server or peer reflexive). + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE local reflexive address. May be null if this transport + * manager is not using ICE or if there is no reflexive address for the + * local candidate used. + */ + public InetSocketAddress getICELocalReflexiveAddress(String streamName) + { + return null; + } + + /** + * Returns the ICE remote reflexive address (server or peer reflexive). + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE remote reflexive address. May be null if this transport + * manager is not using ICE or if there is no reflexive address for the + * remote candidate used. + */ + public InetSocketAddress getICERemoteReflexiveAddress(String streamName) + { + return null; + } + + /** + * Returns the ICE local relayed address (server or peer relayed). + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE local relayed address. May be null if this transport + * manager is not using ICE or if there is no relayed address for the + * local candidate used. + */ + public InetSocketAddress getICELocalRelayedAddress(String streamName) + { + return null; + } + + /** + * Returns the ICE remote relayed address (server or peer relayed). + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE remote relayed address. May be null if this transport + * manager is not using ICE or if there is no relayed address for the + * remote candidate used. + */ + public InetSocketAddress getICERemoteRelayedAddress(String streamName) + { + return null; + } } diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/TransportManagerGTalkImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/TransportManagerGTalkImpl.java index 8349ed606..78d506b89 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/TransportManagerGTalkImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/TransportManagerGTalkImpl.java @@ -1318,32 +1318,171 @@ public void close() * Returns the extended type of the candidate selected if this transport * manager is using ICE. * + * @param streamName The stream name (AUDIO, VIDEO); + * * @return The extended type of the candidate selected if this transport * manager is using ICE. Otherwise, returns null. */ - public String getICECandidateExtendedType() + public String getICECandidateExtendedType(String streamName) { return TransportManager.getICECandidateExtendedType( - this.iceAgent); + this.iceAgent, + streamName); } /** - * Retransmit state change events from the Agent. - * @param evt the event for state change. + * Returns the current state of ICE processing. + * + * @return the current state of ICE processing. */ - public void propertyChange(PropertyChangeEvent evt) + public String getICEState() { - getCallPeer().getMediaHandler().firePropertyChange( - evt.getPropertyName(), evt.getOldValue(), evt.getNewValue()); + return iceAgent.getState().name(); } /** - * Returns the current state of ICE processing. + * Returns the ICE local host address. * - * @return the current state of ICE processing. + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE local host address if this transport + * manager is using ICE. Otherwise, returns null. */ - public String getICEState() + public InetSocketAddress getICELocalHostAddress(String streamName) { - return iceAgent.getState().name(); + if(iceAgent != null) + { + LocalCandidate localCandidate = + iceAgent.getSelectedLocalCandidate(streamName); + if(localCandidate != null) + { + return localCandidate.getHostAddress(); + } + } + return null; + } + + /** + * Returns the ICE remote host address. + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE remote host address if this transport + * manager is using ICE. Otherwise, returns null. + */ + public InetSocketAddress getICERemoteHostAddress(String streamName) + { + if(iceAgent != null) + { + RemoteCandidate remoteCandidate = + iceAgent.getSelectedRemoteCandidate(streamName); + if(remoteCandidate != null) + { + return remoteCandidate.getHostAddress(); + } + } + return null; + } + + /** + * Returns the ICE local reflexive address (server or peer reflexive). + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE local reflexive address. May be null if this transport + * manager is not using ICE or if there is no reflexive address for the + * local candidate used. + */ + public InetSocketAddress getICELocalReflexiveAddress(String streamName) + { + if(iceAgent != null) + { + LocalCandidate localCandidate = + iceAgent.getSelectedLocalCandidate(streamName); + if(localCandidate != null) + { + return localCandidate.getReflexiveAddress(); + } + } + return null; + } + + /** + * Returns the ICE remote reflexive address (server or peer reflexive). + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE remote reflexive address. May be null if this transport + * manager is not using ICE or if there is no reflexive address for the + * remote candidate used. + */ + public InetSocketAddress getICERemoteReflexiveAddress(String streamName) + { + if(iceAgent != null) + { + RemoteCandidate remoteCandidate = + iceAgent.getSelectedRemoteCandidate(streamName); + if(remoteCandidate != null) + { + return remoteCandidate.getReflexiveAddress(); + } + } + return null; + } + + /** + * Returns the ICE local relayed address (server or peer relayed). + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE local relayed address. May be null if this transport + * manager is not using ICE or if there is no relayed address for the + * local candidate used. + */ + public InetSocketAddress getICELocalRelayedAddress(String streamName) + { + if(iceAgent != null) + { + LocalCandidate localCandidate = + iceAgent.getSelectedLocalCandidate(streamName); + if(localCandidate != null) + { + return localCandidate.getRelayedAddress(); + } + } + return null; + } + + /** + * Returns the ICE remote relayed address (server or peer relayed). + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE remote relayed address. May be null if this transport + * manager is not using ICE or if there is no relayed address for the + * remote candidate used. + */ + public InetSocketAddress getICERemoteRelayedAddress(String streamName) + { + if(iceAgent != null) + { + RemoteCandidate remoteCandidate = + iceAgent.getSelectedRemoteCandidate(streamName); + if(remoteCandidate != null) + { + return remoteCandidate.getRelayedAddress(); + } + } + return null; + } + + /** + * Retransmit state change events from the Agent. + * @param evt the event for state change. + */ + public void propertyChange(PropertyChangeEvent evt) + { + getCallPeer().getMediaHandler().firePropertyChange( + evt.getPropertyName(), evt.getOldValue(), evt.getNewValue()); } } diff --git a/src/net/java/sip/communicator/impl/protocol/sip/TransportManagerSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/TransportManagerSipImpl.java index 7ccc33694..d0584f722 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/TransportManagerSipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/TransportManagerSipImpl.java @@ -53,10 +53,12 @@ protected InetAddress getIntendedDestination(CallPeerSipImpl peer) * Returns the extended type of the candidate selected if this transport * manager is using ICE. * + * @param streamName The stream name (AUDIO, VIDEO); + * * @return The extended type of the candidate selected if this transport * manager is using ICE. Otherwise, returns null. */ - public String getICECandidateExtendedType() + public String getICECandidateExtendedType(String streamName) { return null; } @@ -70,4 +72,86 @@ public String getICEState() { return null; } + + /** + * Returns the ICE local host address. + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE local host address if this transport + * manager is using ICE. Otherwise, returns null. + */ + public InetSocketAddress getICELocalHostAddress(String streamName) + { + return null; + } + + /** + * Returns the ICE remote host address. + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE remote host address if this transport + * manager is using ICE. Otherwise, returns null. + */ + public InetSocketAddress getICERemoteHostAddress(String streamName) + { + return null; + } + + /** + * Returns the ICE local reflexive address (server or peer reflexive). + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE local reflexive address. May be null if this transport + * manager is not using ICE or if there is no reflexive address for the + * local candidate used. + */ + public InetSocketAddress getICELocalReflexiveAddress(String streamName) + { + return null; + } + + /** + * Returns the ICE remote reflexive address (server or peer reflexive). + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE remote reflexive address. May be null if this transport + * manager is not using ICE or if there is no reflexive address for the + * remote candidate used. + */ + public InetSocketAddress getICERemoteReflexiveAddress(String streamName) + { + return null; + } + + /** + * Returns the ICE local relayed address (server or peer relayed). + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE local relayed address. May be null if this transport + * manager is not using ICE or if there is no relayed address for the + * local candidate used. + */ + public InetSocketAddress getICELocalRelayedAddress(String streamName) + { + return null; + } + + /** + * Returns the ICE remote relayed address (server or peer relayed). + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE remote relayed address. May be null if this transport + * manager is not using ICE or if there is no relayed address for the + * remote candidate used. + */ + public InetSocketAddress getICERemoteRelayedAddress(String streamName) + { + return null; + } } diff --git a/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java b/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java index d9a009559..9b594c9ba 100644 --- a/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java +++ b/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java @@ -8,6 +8,7 @@ import java.awt.*; import java.beans.*; +import java.net.*; import java.util.*; import java.util.List; @@ -1432,17 +1433,19 @@ public SrtpControl getEncryptionMethod(MediaType mediaType) * Returns the extended type of the candidate selected if this transport * manager is using ICE. * + * @param streamName The stream name (AUDIO, VIDEO); + * * @return The extended type of the candidate selected if this transport * manager is using ICE. Otherwise, returns null. */ - public String getICECandidateExtendedType() + public String getICECandidateExtendedType(String streamName) { TransportManager transportManager = getTransportManager(); return (transportManager == null) ? null - : transportManager.getICECandidateExtendedType(); + : transportManager.getICECandidateExtendedType(streamName); } /** @@ -1461,6 +1464,118 @@ public String getICEState() : transportManager.getICEState(); } + /** + * Returns the ICE local host address. + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE local host address if this transport + * manager is using ICE. Otherwise, returns null. + */ + public InetSocketAddress getICELocalHostAddress(String streamName) + { + TransportManager transportManager = getTransportManager(); + + return + (transportManager == null) + ? null + : transportManager.getICELocalHostAddress(streamName); + } + + /** + * Returns the ICE remote host address. + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE remote host address if this transport + * manager is using ICE. Otherwise, returns null. + */ + public InetSocketAddress getICERemoteHostAddress(String streamName) + { + TransportManager transportManager = getTransportManager(); + + return + (transportManager == null) + ? null + : transportManager.getICERemoteHostAddress(streamName); + } + + /** + * Returns the ICE local reflexive address (server or peer reflexive). + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE local reflexive address. May be null if this transport + * manager is not using ICE or if there is no reflexive address for the + * local candidate used. + */ + public InetSocketAddress getICELocalReflexiveAddress(String streamName) + { + TransportManager transportManager = getTransportManager(); + + return + (transportManager == null) + ? null + : transportManager.getICELocalReflexiveAddress(streamName); + } + + /** + * Returns the ICE remote reflexive address (server or peer reflexive). + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE remote reflexive address. May be null if this transport + * manager is not using ICE or if there is no reflexive address for the + * remote candidate used. + */ + public InetSocketAddress getICERemoteReflexiveAddress(String streamName) + { + TransportManager transportManager = getTransportManager(); + + return + (transportManager == null) + ? null + : transportManager.getICERemoteReflexiveAddress(streamName); + } + + /** + * Returns the ICE local relayed address (server or peer relayed). + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE local relayed address. May be null if this transport + * manager is not using ICE or if there is no relayed address for the + * local candidate used. + */ + public InetSocketAddress getICELocalRelayedAddress(String streamName) + { + TransportManager transportManager = getTransportManager(); + + return + (transportManager == null) + ? null + : transportManager.getICELocalRelayedAddress(streamName); + } + + /** + * Returns the ICE remote relayed address (server or peer relayed). + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE remote relayed address. May be null if this transport + * manager is not using ICE or if there is no relayed address for the + * remote candidate used. + */ + public InetSocketAddress getICERemoteRelayedAddress(String streamName) + { + TransportManager transportManager = getTransportManager(); + + return + (transportManager == null) + ? null + : transportManager.getICERemoteRelayedAddress(streamName); + } + public MediaHandler getMediaHandler() { return mediaHandler; diff --git a/src/net/java/sip/communicator/service/protocol/media/TransportManager.java b/src/net/java/sip/communicator/service/protocol/media/TransportManager.java index a9326eaf2..c68803f58 100644 --- a/src/net/java/sip/communicator/service/protocol/media/TransportManager.java +++ b/src/net/java/sip/communicator/service/protocol/media/TransportManager.java @@ -584,10 +584,12 @@ protected static void setNextMediaPortToTry(int nextMediaPortToTry) * Returns the extended type of the candidate selected if this transport * manager is using ICE. * + * @param streamName The stream name (AUDIO, VIDEO); + * * @return The extended type of the candidate selected if this transport * manager is using ICE. Otherwise, returns null. */ - public abstract String getICECandidateExtendedType(); + public abstract String getICECandidateExtendedType(String streamName); /** * Returns the current state of ICE processing. @@ -597,45 +599,97 @@ protected static void setNextMediaPortToTry(int nextMediaPortToTry) */ public abstract String getICEState(); + /** + * Returns the ICE local host address. + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE local host address if this transport + * manager is using ICE. Otherwise, returns null. + */ + public abstract InetSocketAddress getICELocalHostAddress(String streamName); + + /** + * Returns the ICE remote host address. + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE remote host address if this transport + * manager is using ICE. Otherwise, returns null. + */ + public abstract InetSocketAddress getICERemoteHostAddress( + String streamName); + + /** + * Returns the ICE local reflexive address (server or peer reflexive). + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE local reflexive address. May be null if this transport + * manager is not using ICE or if there is no reflexive address for the + * local candidate used. + */ + public abstract InetSocketAddress getICELocalReflexiveAddress( + String streamName); + + /** + * Returns the ICE remote reflexive address (server or peer reflexive). + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE remote reflexive address. May be null if this transport + * manager is not using ICE or if there is no reflexive address for the + * remote candidate used. + */ + public abstract InetSocketAddress getICERemoteReflexiveAddress( + String streamName); + + /** + * Returns the ICE local relayed address (server or peer relayed). + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE local relayed address. May be null if this transport + * manager is not using ICE or if there is no relayed address for the + * local candidate used. + */ + public abstract InetSocketAddress getICELocalRelayedAddress( + String streamName); + + /** + * Returns the ICE remote relayed address (server or peer relayed). + * + * @param streamName The stream name (AUDIO, VIDEO); + * + * @return the ICE remote relayed address. May be null if this transport + * manager is not using ICE or if there is no relayed address for the + * remote candidate used. + */ + public abstract InetSocketAddress getICERemoteRelayedAddress( + String streamName); + /** * Returns the ICE candidate extended type selected by the given agent. * * @param iceAgent The ICE agent managing the ICE offer/answer exchange, * collecting and selecting the candidate. + * @param streamName The stream name (AUDIO, VIDEO); * * @return The ICE candidate extended type selected by the given agent. null * if the iceAgent is null or if there is no candidate selected or * available. */ - public static String getICECandidateExtendedType(Agent iceAgent) + public static String getICECandidateExtendedType( + Agent iceAgent, + String streamName) { if(iceAgent != null) { - List iceMediaStreams = iceAgent.getStreams(); - for(int i = 0; i < iceMediaStreams.size(); ++i) + LocalCandidate localCandidate = + iceAgent.getSelectedLocalCandidate(streamName); + if(localCandidate != null) { - List components = - iceMediaStreams.get(i).getComponents(); - for(int j = 0; j < components.size(); ++j) - { - org.ice4j.ice.Component component = components.get(i); - if(component.getComponentID() == - org.ice4j.ice.Component.RTP) - { - CandidatePair candidatePair = - component.getSelectedPair(); - if(candidatePair != null) - { - LocalCandidate localCandidate = - candidatePair.getLocalCandidate(); - if(localCandidate != null) - { - return - localCandidate.getExtendedType().toString(); - } - } - } - } + return localCandidate.getExtendedType().toString(); } } return null;