Package 

Class SIPRegistration

  • All Implemented Interfaces:
    java.lang.Runnable

    
    public class SIPRegistration
    extends Thread
                        

    This class manages the SIP registration process in a separate thread. It is responsible for periodically sending SIP REGISTER requests to the server to keep the registration alive. It also handles presence updates, network connectivity checks, and pausing/resuming the registration process.

    • Method Summary

      Modifier and Type Method Description
      void run() The main loop of the registration thread.This thread is responsible for:- Periodically sending SIP REGISTER requests to keep the registration alive.- Sending PUBLISH requests for presence updates (if enabled).- Sending PING messages to maintain network connectivity.- Pausing and resuming registration based on external triggers.
      void stopRegistration() Stops the registration process.This method sets the running flag to false, indicating that the registrationprocess should stop.
      void delayStartRegistration(int i) Delays the start of registration by the specified amount of time.This method sets the delay time and resumes the registration processwith the previously set registration expiration time.
      void pauseRegistration() Pauses the registration process.This method sets the 'paused' flag to true, indicating that the registrationprocess should be temporarily halted.
      void resumeRegistration(int time) Resumes the registration process after it has been paused.This method resets the registration expiration time, logs a message indicating resumption,resets the sleep count, sets the paused flag to false, and notifies any waiting threads.
      void unPause() Resumes the registration process if it was previously paused.This method sets the `paused` flag to `false` and notifies any threadswaiting on this object's monitor.
      boolean isPaused() Checks if the object (likely a game, animation, or timer) is currently paused.
      boolean isRunning() Checks if the object is currently running.
      boolean isStarted() Checks if the object (or process represented by this object) has been started.
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, onSpinWait, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, start, stop, suspend, toString, yield
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SIPRegistration

        SIPRegistration(SIPProvider sipProvider, String from)
        Constructor for the SIPRegistration class.
        Parameters:
        sipProvider - The SIP provider to use for registration.
        from - The SIP address to register from.
    • Method Detail

      • run

         void run()

        The main loop of the registration thread.This thread is responsible for:- Periodically sending SIP REGISTER requests to keep the registration alive.- Sending PUBLISH requests for presence updates (if enabled).- Sending PING messages to maintain network connectivity.- Pausing and resuming registration based on external triggers.

      • stopRegistration

         void stopRegistration()

        Stops the registration process.This method sets the running flag to false, indicating that the registrationprocess should stop. It also resets the paused flag to false.If the thread is currently waiting (paused), it is notified to wake up.The thread is then interrupted to ensure it exits any blocking operations.Finally, the method waits for the thread to finish execution using `join()`.If the thread exits successfully, a log message is printed.If an InterruptedException occurs during the exit process, an error message is logged.

      • delayStartRegistration

         void delayStartRegistration(int i)

        Delays the start of registration by the specified amount of time.This method sets the delay time and resumes the registration processwith the previously set registration expiration time.

        Parameters:
        i - The delay time in milliseconds.
      • pauseRegistration

         void pauseRegistration()

        Pauses the registration process.This method sets the 'paused' flag to true, indicating that the registrationprocess should be temporarily halted. It also logs a debug message using Timber.

      • resumeRegistration

         void resumeRegistration(int time)

        Resumes the registration process after it has been paused.This method resets the registration expiration time, logs a message indicating resumption,resets the sleep count, sets the paused flag to false, and notifies any waiting threads.

        Parameters:
        time - The new registration expiration time in milliseconds.
      • unPause

         void unPause()

        Resumes the registration process if it was previously paused.This method sets the `paused` flag to `false` and notifies any threadswaiting on this object's monitor. This allows the registration processto continue if it was previously paused using the `pause` method.

      • isPaused

         boolean isPaused()

        Checks if the object (likely a game, animation, or timer) is currently paused.

      • isRunning

         boolean isRunning()

        Checks if the object is currently running.The object is considered running if it is:

        • Alive (as determined by isAlive)
        • The `running` flag is true
        • The `paused` flag is false
      • isStarted

         boolean isStarted()

        Checks if the object (or process represented by this object) has been started.