Class ConnectionPolicy


  • public class ConnectionPolicy
    extends java.lang.Object
    Defines the server connection policy used by a User.

    A connection policy is set during user creation and determines what servers a user will register with and how it should interact with them in failover scenarios.

    • Constructor Detail

      • ConnectionPolicy

        public ConnectionPolicy​(SignalingServer signalingServer)
      • ConnectionPolicy

        public ConnectionPolicy​(SignalingServerGroup signalingServerGroup,
                                SignalingEnvironment signalingEnvironment)
        Constructor
        Parameters:
        signalingServerGroup - The SignalingServerGroup to connect with.
        signalingEnvironment - Controls how connections to servers are established and recovered after failures. Note that when OPENSIPS is passed in, the encapsulated RegistrationGroup objects must be limited to a single SignalingServer per group, and those SignalingServer objects must use the AUTOMATIC FailbackPolicy. Otherwise, the attempt to create the User object may fail.
      • ConnectionPolicy

        public ConnectionPolicy​(SignalingServer signalingServer,
                                SignalingEnvironment signalingEnvironment)
        Constructor
        Parameters:
        signalingServer - The server to connect with.
        signalingEnvironment - Controls how connections the server are established and recovered after failures. Note that server must use the AUTOMATIC FailbackPolicy if OPENSIPS is passed here, otherwise the attempt to create the User object may fail.
    • Method Detail

      • setOutboundPingPolicy

        public void setOutboundPingPolicy​(int crlfPingInterval,
                                          int crlfPingTimeout,
                                          int tcpKeepAliveInterval,
                                          int tcpKeepAliveCount)
        Set outbound ping policy. It should be noted that discovery of capabilities from a connection peer may affect the behavior of the algorithm used to ping a connection. On some platforms, CRLF ping attempts can interfere with with TCPKeepAlive processing, so in the special case where the CRLF ping is enabled, the unCRLFPingTimeout value is 0, and the TCPKeepAliveInterval is > 0, if the first CRLF ping does not receive a response, then further CRLF pings are discontinued.
        Parameters:
        crlfPingInterval - CRLF ping interval (in seconds). 0 disables CRLF pings. Note that the timer is re-started when there is socket activity.
        crlfPingTimeout - Amount of time to wait for a response before declaring a failure. To prevent failure from being declared, set the parameter to 0. Note that when this value is non-zero, the absence of a single response will cause a failure to be declared.
        tcpKeepAliveInterval - Socket-level ping interval (in seconds). O disables TCP keep-alives. This interval is used for both the first and subsequent pings.
        tcpKeepAliveCount - The number of un-answered pings that will cause a failure to be declared. This value must be > 0 if unTCPKeepAliveInterval is set, otherwise the system default value is used.
      • setInitialReconnectInterval

        public void setInitialReconnectInterval​(int initialReconnectInterval)
        Set the initial reconnection attempt interval. When SIP connections fail, they are retried at a random interval somewhere between 50% and 100% of the interval specified here. The default is 2 seconds. For every subsequent failure, the initial interval is doubled until the maximum value is reached (see setMaxReconnectInterval(int)).
        Parameters:
        initialReconnectInterval - The nominal interval to wait (in seconds) before the first reconnection attempt. 0 disables automatic reconnection attempts. Values less than 0 or greater than 65535 are ignored.
      • setMaxReconnectInterval

        public void setMaxReconnectInterval​(int maxReconnectInterval)
        Set the max reconnection attempt interval. Set the upper bound for the reconnection attempt interval algorithm. The default is 1800 seconds.
        Parameters:
        maxReconnectInterval - The maximum delay interval between automatic reconnection attempts. Values less than 0 or greater than 65535 are ignored.
      • setLocalUDPPortMin

        public void setLocalUDPPortMin​(int localUDPPortMin)
        Set Minimum value of the local UDP Port in UDP port Range. If the port range is not specified or invalid then default port range will be used for UDP registration. Default Port Range is 5060 – 5070. Default Minimum value of the local UDP Port is 5060. Port range will be considered as invalid if not matches with following: Minimum port should be less than Maximum port. Both Minimum and Maximum port should be configured. Minimum port should be greater than 1024 and less than 65535. Minimum or Maximum port should not be zero. Some Servers allow Port 5061 only for TLS connection hence port 5061 will be skipped for UDP connection even includes in configured port range.
        Parameters:
        localUDPPortMin - - Minimum value of local UDP port to use for SIP signaling
      • setLocalUDPPortMax

        public void setLocalUDPPortMax​(int localUDPPortMax)
        Set Maximum value of the local UDP Port in UDP port Range. If the port range is not specified or invalid then default port range will be used for UDP registration. Default Port Range is 5060 – 5070. Default Maximum value of the local UDP Port is 5070. Port range will be considered as invalid if not matches with following: Minimum port should be less than Maximum port. Both Minimum and Maximum port should be configured. Minimum port should be greater than 1024 and less than 65535. Minimum or Maximum port should not be zero. Some Servers allow Port 5061 only for TLS connection hence port 5061 will be skipped for UDP connection even includes in configured port range.
        Parameters:
        localUDPPortMax - - Maximum value of local UDP port to use for SIP signaling
      • getCRLFPingInterval

        public int getCRLFPingInterval()
        Returns the CRLF Ping Interval.
        Returns:
        the CRLF Ping Interval.
      • getCRLFPingTimeout

        public int getCRLFPingTimeout()
        Returns the CRLF Ping Timeout.
        Returns:
        the CRLF Ping Timeout.
      • getTCPKeepAliveInterval

        public int getTCPKeepAliveInterval()
        Returns the TCP Keep Alive Ping Interval.
        Returns:
        the TCP Keep Alive Ping Interval.
      • getTCPKeepAliveCount

        public int getTCPKeepAliveCount()
        Returns the TCP Keep Alive Count.
        Returns:
        the TCP Keep Alive Ping Count.
      • getInitialReconnectInterval

        public int getInitialReconnectInterval()
        Returns the Initial Reconnect Interval.
        Returns:
        the Initial Reconnect Interval.
      • getMaxReconnectInterval

        public int getMaxReconnectInterval()
      • getLocalUDPPortMin

        public int getLocalUDPPortMin()
        Get the Minimum value of local UDP Port set in UDP Port Range.
        Returns:
        - Minimum value of local UDP port used for SIP signaling
      • getLocalUDPPortMax

        public int getLocalUDPPortMax()
        Get the Maximum value of local UDP Port set in UDP Port Range.
        Returns:
        - Maximum value of local UDP port used for SIP signaling
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object