diff options
author | Emil Ivov <emcho@jitsi.org> | 2006-10-23 16:22:31 +0000 |
---|---|---|
committer | Emil Ivov <emcho@jitsi.org> | 2006-10-23 16:22:31 +0000 |
commit | 0d9fb0f5e1c25368bf236425940675d437d68419 (patch) | |
tree | de1cf4e606759007ab36a76e19d768212b4c0aee /src | |
parent | 9e5b60b9edefa33a8ece3d21c79dd5c6633f7909 (diff) | |
download | jitsi-0d9fb0f5e1c25368bf236425940675d437d68419.zip jitsi-0d9fb0f5e1c25368bf236425940675d437d68419.tar.gz jitsi-0d9fb0f5e1c25368bf236425940675d437d68419.tar.bz2 |
Working on the JMF implementation of the media service.
added a method for retrieving a transport address (may remove later)
Diffstat (limited to 'src')
-rw-r--r-- | src/net/java/sip/communicator/impl/protocol/sip/CallParticipantSipImpl.java | 81 |
1 files changed, 79 insertions, 2 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/CallParticipantSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/CallParticipantSipImpl.java index 1919478..633cf9a 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/CallParticipantSipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/CallParticipantSipImpl.java @@ -14,6 +14,7 @@ import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.event.*; import net.java.sip.communicator.util.*; import javax.sip.*; +import java.net.*; /** * Our SIP implementation of the default CallParticipant; @@ -52,7 +53,7 @@ public class CallParticipantSipImpl private String participantID; /** - * The call participant belongs to. + * The call this participant belongs to. */ private CallSipImpl call; @@ -82,6 +83,13 @@ public class CallParticipantSipImpl private SipProvider jainSipProvider = null; /** + * The transport address that we are using to address the participant or the + * first one that we'll try when we next send them a message (could be the + * address of our sip registrar). + */ + private InetSocketAddress transportAddress = null; + + /** * Creates a new call participant with address <tt>participantAddress</tt>. * * @param participantAddress the JAIN SIP <tt>Address</tt> of the new call @@ -181,6 +189,7 @@ public class CallParticipantSipImpl } + /** * Returns the date (time) when this call participant acquired its * current status. @@ -200,7 +209,10 @@ public class CallParticipantSipImpl */ public String getDisplayName() { - return participantAddress.getDisplayName(); + String displayName = participantAddress.getDisplayName(); + return (displayName == null) + ? participantAddress.getURI().toString() + : displayName; } /** @@ -396,4 +408,69 @@ public class CallParticipantSipImpl { return jainSipProvider; } + + /** + * The address that we have used to contact this participant. In cases + * where no direct connection has been established with the participant, + * this method will return the address that will be first tried when + * connection is established (often the one used to connect with the + * protocol server). The address may change during a session and + * + * @param transportAddress The address that we have used to contact this + * participant. + */ + public void setTransportAddress(InetSocketAddress transportAddress) + { + InetSocketAddress oldTransportAddress = this.transportAddress; + this.transportAddress = transportAddress; + + this.fireCallParticipantChangeEvent( + CallParticipantChangeEvent + .CALL_PARTICIPANT_TRANSPORT_ADDRESS_CHANGE + , oldTransportAddress + , transportAddress); + } + + /** + * The address that we have used to contact this participant. In cases + * where no direct connection has been established with the participant, + * this method will return the address that will be first tried when + * connection is established (often the one used to connect with the + * protocol server). The address may change during a session and + * + * @return The address that we have used to contact this participant. + */ + public InetSocketAddress getLocalTransportAddress() + { + /** @todo this is ugly as we don't really know which listening point + * we're using. will do until we implement ice. */ + int defaultLpPort + = ((ProtocolProviderServiceSipImpl)getProtocolProvider()) + .getDefaultListeningPoint().getPort(); + + return new InetSocketAddress(defaultLpPort); + } + + /** + * Returns the protocol provider that this participant belongs to. + * @return a reference to the ProtocolProviderService that this participant + * belongs to. + */ + public ProtocolProviderService getProtocolProvider() + { + return this.getCall().getProtocolProvider(); + } + + /** + * Returns the contact corresponding to this participant or null if no + * particular contact has been associated. + * <p> + * @return the <tt>Contact</tt> corresponding to this participant or null + * if no particular contact has been associated. + */ + public Contact getContact() + { + return null; + } + } |