* @return the Contact corresponding to this peer or null * if no particular contact has been associated. */ public Contact getContact() { OperationSetPresence presence = getProtocolProvider().getOperationSet(OperationSetPresence.class); return (presence == null) ? null : presence.findContactByID(getAddress()); } /** * Returns the service discovery information that we have for this peer. * * @return the service discovery information that we have for this peer. */ public DiscoverInfo getDiscoveryInfo() { return discoverInfo; } /** * Returns a human readable name representing this peer. * * @return a String containing a name for that peer. */ public String getDisplayName() { if (getCall() != null) { Contact contact = getContact(); if (contact != null) return contact.getDisplayName(); } return peerJID; } /** * Returns full URI of the address. * * @return full URI of the address */ public String getURI() { return "xmpp:" + peerJID; } /** * Determines whether this peer initiated the session. Note that if this * peer is the initiator of the session, then we are the responder! * * @return true if this peer initiated the session; false, * otherwise (i.e. if _we_ initiated the session). */ public boolean isInitiator() { return initiator; } /** * Retrieves the DiscoverInfo for a given peer identified by its URI. * * @param calleeURI The URI of the call peer. * * @return The retrieved DiscoverInfo, or null if not available. */ protected void retrieveDiscoveryInfo(String calleeURI) { try { DiscoverInfo discoveryInfo = getProtocolProvider().getDiscoveryManager().discoverInfo( calleeURI); if(discoveryInfo != null) setDiscoveryInfo(discoveryInfo); } catch (XMPPException xmppex) { logger.warn("Could not retrieve info for " + calleeURI, xmppex); } } /** * Specifies the address, phone number, or other protocol specific * identifier that represents this call peer. This method is to be * used by service users and MUST NOT be called by the implementation. * * @param address The address of this call peer. */ public void setAddress(String address) { if (!peerJID.equals(address)) { String oldAddress = getAddress(); peerJID = address; fireCallPeerChangeEvent( CallPeerChangeEvent.CALL_PEER_ADDRESS_CHANGE, oldAddress, address); } } /** * Sets the service discovery information that we have for this peer. * * @param discoverInfo the discovery information that we have obtained for * this peer. */ public void setDiscoveryInfo(DiscoverInfo discoverInfo) { this.discoverInfo = discoverInfo; } /** * Returns the session ID of the Jingle session associated with this call. * * @return the session ID of the Jingle session associated with this call. */ public abstract String getSID(); /** * Returns the IQ ID of the Jingle session-initiate packet associated with * this call. * * @return the IQ ID of the Jingle session-initiate packet associated with * this call. */ public String getSessInitID() { return sessionInitIQ != null ? sessionInitIQ.getPacketID() : null; } }