Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
  * Conditions Of Use
  *
  * This software was developed by employees of the National Institute of
  * Standards and Technology (NIST), an agency of the Federal Government.
  * Pursuant to title 15 Untied States Code Section 105, works of NIST
  * employees are not subject to copyright protection in the United States
  * and are considered to be in the public domain.  As a result, a formal
  * license is not needed to use the software.
 *
 * This software is provided by NIST as a service and is expressly
 * provided "AS IS."  NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED
 * OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
 * AND DATA ACCURACY.  NIST does not warrant or make any representations
 * regarding the use of the software or the results thereof, including but
 * not limited to the correctness, accuracy, reliability or usefulness of
 * the software.
 *
 * Permission to use this software is contingent upon your acceptance
 * of the terms of this agreement
 *
 * .
 *
 */
 package gov.nist.javax.sip;
 
 
 import javax.sip.*;
 
Implementation of the ListeningPoint interface

Author(s):
M. Ranganathan
Version:
1.2 $Revision: 1.17 $ $Date: 2010/09/13 14:58:00 $
 
 
 
     protected String transport;

    
My port. (same thing as in the message processor)
 
 
     int port;

    
Pointer to the imbedded mesage processor.
 
     protected MessageProcessor messageProcessor;

    
Provider back pointer
 
     protected SipProviderImpl sipProvider;

    
Our stack
 
     protected SipStackImpl sipStack;




    
Construct a key to refer to this structure from the SIP stack

Parameters:
host host string
port port
transport transport
Returns:
a string that is used as a key
 
     public static String makeKey(String hostint portString transport) {
         return new StringBuilder(host)
             .append(":")
             .append(port)
             .append("/")
             .append(transport)
             .toString()
             .toLowerCase();
     }

    
Get the key for this strucut

Returns:
get the host
    protected String getKey() {
        return makeKey(this.getIPAddress(), );
    }

    
Set the sip provider for this structure.

Parameters:
sipProvider provider to set
    public void setSipProvider(SipProviderImpl sipProviderImpl) {
        this. = sipProviderImpl;
    }

    
Remove the sip provider from this listening point.
    public void removeSipProvider() {
        this. = null;
    }

    
Constructor

Parameters:
sipStack Our sip stack
    protected ListeningPointImpl(
        SipStack sipStack,
        int port,
        String transport) {
        this. = (SipStackImplsipStack;
        this. = port;
        this. = transport;
    }

    
Clone this listening point. Note that a message Processor is not started. The transport is set to null.

Returns:
cloned listening point.
    public Object clone() {
        ListeningPointImpl lip =
            new ListeningPointImpl(this.this.null);
        lip.sipStack = this.;
        return lip;
    }



    
Gets the port of the ListeningPoint. The default port of a ListeningPoint is dependent on the scheme and transport. For example:
  • The default port is 5060 if the transport UDP the scheme is sip:.
  • The default port is 5060 if the transport is TCP the scheme is sip:.
  • The default port is 5060 if the transport is SCTP the scheme is sip:.
  • The default port is 5061 if the transport is TLS over TCP the scheme is sip:.
  • The default port is 5061 if the transport is TCP the scheme is sips:.

Returns:
port of ListeningPoint
    public int getPort() {
        return .getPort();
    }

    
Gets transport of the ListeningPoint.

Returns:
transport of ListeningPoint
    public String getTransport() {
        return .getTransport();
    }

    
Get the provider.

Returns:
the provider.
    public SipProviderImpl getProvider() {
        return this.;
    }
    /* (non-Javadoc)
     * @see javax.sip.ListeningPoint#getIPAddress()
     */
    public String getIPAddress() {
        return this..getIpAddress().getHostAddress();
    }
    /* (non-Javadoc)
     * @see javax.sip.ListeningPoint#setSentBy(java.lang.String)
     */
    public void setSentBy(String sentBythrows ParseException {
        this..setSentBy(sentBy);
    }
    /* (non-Javadoc)
     * @see javax.sip.ListeningPoint#getSentBy()
     */
    public String getSentBy() {
        return this..getSentBy();
    }
    public boolean isSentBySet() {
        return this..isSentBySet();
    }
    public Via getViaHeader() {
        return this..getViaHeader();
     }
        return this.;
    }
        try {
            String ipAddress = this.getIPAddress();
            int port = this.getPort();
            SipURI sipURI = new SipUri();
            sipURI.setHost(ipAddress);
            sipURI.setPort(port);
            sipURI.setTransportParam(this.);
            Contact contact = new Contact();
            AddressImpl address = new AddressImpl();
            address.setURI(sipURI);
            contact.setAddress(address);
            
            return contact;
        } catch (Exception ex) {
            InternalErrorHandler.handleException("Unexpected exception",.getStackLogger());
            return null;
        }
    }
    public void sendHeartbeat(String ipAddressint portthrows IOException {
        HostPort targetHostPort  = new HostPort();
        targetHostPort.setHost(new HostipAddress));
        targetHostPort.setPort(port);
        MessageChannel messageChannel = this..createMessageChannel(targetHostPort);
        SIPRequest siprequest = new SIPRequest();
        siprequest.setNullRequest();
        messageChannel.sendMessage(siprequest);
    }
    
    public ViaHeader createViaHeader() {
           return this.getViaHeader();
    }
New to GrepCode? Check out our FAQ X