Class RTSP
java.lang.Object
javaforce.voip.RTSP
- All Implemented Interfaces:
TransportInterface
- Direct Known Subclasses:
RTSPClient,RTSPServer
Base class for RTSP communications (Real Time Streaming Protocol).
Opens the TCP port and passes any received packets thru the RTSPInterface.
Direct Known subclasses : RTSPClient
RFC : http://tools.ietf.org/html/rfc2326.html - RTSP
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Codec[]Adds a codec to a list of codecs.String[]buildsdp(RTSPSession sess, CallDetails.SideDetails cdsd) Builds SDP packet.static Codec[]Removes a codec from a list of codecs.static StringReturns a random generated tag for the To: or From: parts of a SIP message.protected StringgetAuthResponse(RTSPSession sess, String user, String pass, String remote, String cmd, String header) Generates a complete header response to a SIP authorization challenge.Returns a random SIP branch id.protected StringReturns branch in first Via lineReturns a random callid for a SIP message (a unique id for each call, not to be confused with caller id).static CodecReturns a codec from a list of codecs.protected intReturns the cseq of a SIP message.protected Stringgetcseqcmd(String[] msg) Returns the command at the end of the cseq header in a SIP message.static StringReturns a flag in a To: From: field.abstract StringgetlocalRTPhost(RTSPSession sess) protected Stringgetnonce()Returns a random nonce variable used in SIP authorization.protected longgetNow()Returns current time in seconds.protected longReturns the 'o' counts in a SIP/SDP packet.intprotected intgetremote_audio_rtp_port(String[] msg) Returns the remote RTP port in a SIP/SDP packet.protected intgetremote_video_rtp_port(String[] msg) Returns the remote Video RTP port in a SIP/SDP packet.protected Stringgetremotertphost(String[] msg) Returns the remote RTP host in a SIP/SDP packet.protected StringgetRequest(String[] msg) Returns the requested operation of a SIP message.protected StringgetResponse(String user, String pass, String realm, String cmd, String uri, String nonce, String qop, String nc, String cnonce) Generates a response to a SIP authorization challenge.protected intgetResponseType(String[] msg) Returns the response number from a SIP reply message.protected StringReturns a random generated rinstance id.protected String[]getroutelist(String[] msg) Returns the Record-Route: list in a SIP message as an array.Parses the SDP content.static StringReturns the 'tag' field from 'fields'.protected StringReturns a random generated tuple id.protected StringReturns the URI part of a SIP message.protected StringReturns URI in SIP msg.protected String[]getvialist(String[] msg) Returns the Via: list in a SIP message as an array.static booleanDetermines if codecs[] contains codec.protected booleaninit(String localhost, int localport, RTSPInterface iface, boolean server, TransportType type) Opens the transport and sets the RTSPInterface callback.protected booleanDetermines if a SIP message is on hold.static StringJoins a To: or From: field after it was split into parts.voidvoidonDisconnect(String host, int port) static String[]Removes the 'tag' field from 'fields'.Resolve hostname to IP address.protected booleansend(InetAddress remote, int remoteport, String datastr) Sends a packet out on the UDP port.static String[]Sets/adds a flag in a To: From: field.voidsetLog(int id) protected voiduninit()Closes the UDP port and frees resources.
-
Field Details
-
transport
-
localhost
-
localport
protected int localport -
useragent
-
log
public int log -
debug
public static boolean debug
-
-
Constructor Details
-
RTSP
public RTSP()
-
-
Method Details
-
init
protected boolean init(String localhost, int localport, RTSPInterface iface, boolean server, TransportType type) throws Exception Opens the transport and sets the RTSPInterface callback.- Throws:
Exception
-
uninit
protected void uninit()Closes the UDP port and frees resources. -
setLog
public void setLog(int id) -
send
Sends a packet out on the UDP port. -
join
-
getFlag2
-
setFlag2
-
getbranch
Returns a random SIP branch id. TODO : Implement RFC 3261 section 8.1.1.7 (z9hG4bK) -
getbranch
-
ishold
Determines if a SIP message is on hold. -
getvialist
-
getroutelist
-
getrinstance
Returns a random generated rinstance id. -
gettupleid
Returns a random generated tuple id. -
geturi
-
generatetag
Returns a random generated tag for the To: or From: parts of a SIP message. This function is used by replacetag() so it must resemble a To: or From: field. -
removetag
-
gettag
-
getcallid
Returns a random callid for a SIP message (a unique id for each call, not to be confused with caller id). -
getNow
protected long getNow()Returns current time in seconds. -
getnonce
Returns a random nonce variable used in SIP authorization. -
getSDP
-
hasCodec
-
addCodec
-
delCodec
-
getCodec
-
getRequest
-
getURI
-
getResponseType
Returns the response number from a SIP reply message. (100, 200, 401, etc.) -
getcseq
Returns the cseq of a SIP message. -
getcseqcmd
-
getResponse
-
getAuthResponse
-
getremotertphost
-
getremote_audio_rtp_port
Returns the remote RTP port in a SIP/SDP packet. -
getremote_video_rtp_port
Returns the remote Video RTP port in a SIP/SDP packet. -
geto
Returns the 'o' counts in a SIP/SDP packet. idx can be 1 or 2. -
getlocalRTPhost
-
buildsdp
Builds SDP packet. (RFC 2327) -
resolve
-
onConnect
- Specified by:
onConnectin interfaceTransportInterface
-
onDisconnect
- Specified by:
onDisconnectin interfaceTransportInterface
-
getPacketPoolSize
public int getPacketPoolSize()
-