Class RTSPClient

java.lang.Object
javaforce.voip.RTSP
javaforce.voip.RTSPClient
All Implemented Interfaces:
STUN.Listener, RTSPInterface, TransportInterface

public class RTSPClient extends RTSP implements RTSPInterface, STUN.Listener
Handles the client end of a RTSP link.
  • Field Details

    • userobj

      public Object userobj
    • expires

      public int expires
  • Constructor Details

    • RTSPClient

      public RTSPClient()
  • Method Details

    • getUser

      public String getUser()
      Returns the registered user name.
    • getRemoteHost

      public String getRemoteHost()
      Returns the remote host.
    • getRemoteIP

      public String getRemoteIP()
    • init

      public boolean init(String remotehost, int remoteport, int localport, RTSPClientInterface iface, TransportType type)
      Initialize this instance for RTSP.
      Parameters:
      remotehost - ,remoteport is the RTSP Server/Proxy address.
      localport - is the UDP port to bind to locally.
      iface - must be a RTSPClientInterface where RTSP events are dispatched to.
    • uninit

      public void uninit()
      Free all resources.
      Overrides:
      uninit in class RTSP
    • setNAT

      public static void setNAT(RTSPClient.NAT nat, String host, String user, String pass)
      Sets the type of NAT traversal type (global setting).
    • useNATOnPrivateNetwork

      public static void useNATOnPrivateNetwork(boolean state)
      Disable/enable use of NAT traversal on private networks (global setting) Private networks : 192.168.x.x , 10.x.x.x , 172.[16-31].x.x
    • keepalive

      public void keepalive(String url)
      Send an empty RTSP message to server. This MUST be done periodically to keep firewalls open. Most routers close UDP connections after 60 seconds. Cameras will disconnect after 60 seconds.
    • isPrivateNetwork

      public static boolean isPrivateNetwork(String ip)
      Determine if server is on a local private network.
    • getlocalRTPhost

      public String getlocalRTPhost(RTSPSession sess)
      Returns local RTP IP address.
      Specified by:
      getlocalRTPhost in class RTSP
    • stunPublicIP

      public void stunPublicIP(STUN stun, String ip, int port)
      Specified by:
      stunPublicIP in interface STUN.Listener
    • turnAlloc

      public void turnAlloc(STUN stun, String ip, int port, byte[] token, int lifetime)
      Specified by:
      turnAlloc in interface STUN.Listener
    • turnBind

      public void turnBind(STUN stun)
      Specified by:
      turnBind in interface STUN.Listener
    • turnRefresh

      public void turnRefresh(STUN stun, int lifetime)
      Specified by:
      turnRefresh in interface STUN.Listener
    • turnFailed

      public void turnFailed(STUN stun)
      Specified by:
      turnFailed in interface STUN.Listener
    • turnData

      public void turnData(STUN stun, byte[] data, int offset, int length, short channel)
      Specified by:
      turnData in interface STUN.Listener
    • setUserPass

      public void setUserPass(String user, String pass)
    • options

      public boolean options(String url)
      Send OPTIONS request to server.
    • describe

      public boolean describe(String url)
      Send DESCRIBE request to server.
    • setup

      public boolean setup(String url, int localrtpport, int trackid)
      Send SETUP request to server (RTSP).
    • play

      public boolean play(String url)
      Send PLAY request to server (RTSP).
    • teardown

      public boolean teardown(String url)
      Send TEARDOWN request to server (RTSP).
    • get_parameter

      public boolean get_parameter(String url, String[] params)
      GET_PARAMETER (RTSP) Used as a keepalive.
    • onPacket

      public void onPacket(RTSP rtsp, String[] msg, String remoteip, int remoteport)
      Processes RTSP messages sent from the RTSP server.
      Specified by:
      onPacket in interface RTSPInterface
    • onConnect

      public void onConnect(RTSP rtsp, String remoteip, int remoteport)
      Specified by:
      onConnect in interface RTSPInterface
    • onDisconnect

      public void onDisconnect(RTSP rtsp, String remoteip, int remoteport)
      Specified by:
      onDisconnect in interface RTSPInterface
    • toString

      public String toString()
      Overrides:
      toString in class Object