Package javaforce.voip
Class RTP
java.lang.Object
javaforce.voip.RTP
- All Implemented Interfaces:
STUN.Listener
RTP (Real-Time Transport Protocol)
Handles sending/receiving RTP packets.
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanprotected RTPChannelprotected final Objectstatic final Codecstatic final Codecstatic final Codecstatic final Codecstatic final Codecstatic final Codecstatic final Codecstatic final Codecstatic final Codecstatic final Codecstatic final Codecstatic final Codecstatic final Codecstatic final Codecstatic final Codecstatic final Codecstatic final Codecstatic final Codecstatic final Codecstatic booleanprotected RTPInterfaceintstatic longprotected booleanprotected Transportprotected Transportprotected STUNprotected STUNprotected longprotected static Stringprotected static Stringprotected static Stringprotected byte[]protected static Stringprotected static boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateChannel(int ssrc, SDP.Stream stream) Create a new RTP channel with a specified ssrc id.createChannel(SDP.Stream stream) Create a new RTP channel with a random ssrc id.static voidstatic voidenableTURN(String host, String user, String pass) findChannel(short turnChannel) findChannel(String ip, int port) static Stringstatic StringReturns default RTP channel.intstatic intprotected shortbooleanReturns current raw modestatic Stringbooleaninit(RTPInterface iface) booleaninit(RTPInterface iface, TransportType type) voidKeep Alive - call every 30 seconds to keep active.voidremoveChannel(RTPChannel channel) Remove RTPChannelstatic voidSets preferred range for client.voidsetInterface(RTPInterface iface) voidsetLog(int id) voidsetMTU(int mtu) Sets maximum packet size.static voidsetPortRange(int min, int max) Sets global RTP port range to use (should be set before calling init()).voidsetRawMode(boolean state) Sets raw mode
Packets are not decoded, they are passed directly thru RTPInterface.rtpPacket()
This is used by PBX to relay RTP packets between call originator and terminator.voidsetReceiveBufferSize(int bytes) static voidSets preferred range for server.booleanstart()Starts RTP session.voidstop()Stops RTP session and frees resources.voidstunPublicIP(STUN stun, String ip, int port) toString()voidvoidvoidvoidturnFailed(STUN stun) voidturnRefresh(STUN stun, int lifetime) voiduninit()Frees resources.protected voidprotected void
-
Field Details
-
sock1
-
sock2
-
active
public volatile boolean active -
iface
-
rawMode
protected boolean rawMode -
channels
-
now
public static long now -
log
public int log -
useTURN
protected static boolean useTURN -
turnHost
-
turnIP
-
turnUser
-
turnPass
-
stun1
-
stun2
-
turnToken
protected byte[] turnToken -
turnAllocExpires
protected long turnAllocExpires -
userobj
-
debug
public static boolean debug -
CODEC_UNKNOWN
-
CODEC_G711u
-
CODEC_GSM
-
CODEC_G711a
-
CODEC_G722
-
CODEC_G729a
-
CODEC_JPEG
-
CODEC_H263
-
CODEC_RFC2833
-
CODEC_SPEEX
-
CODEC_SPEEX16
-
CODEC_SPEEX32
-
CODEC_VP8
-
CODEC_VP9
-
CODEC_H263_1998
-
CODEC_H263_2000
-
CODEC_OPUS
-
CODEC_H264
-
CODEC_H265
-
bindingChannel
-
bindLock
-
-
Constructor Details
-
RTP
public RTP()
-
-
Method Details
-
setLog
public void setLog(int id) -
enableTURN
-
disableTURN
public static void disableTURN() -
getnextlocalrtpport
public static int getnextlocalrtpport() -
getlocalrtpport
public int getlocalrtpport() -
stunPublicIP
- Specified by:
stunPublicIPin interfaceSTUN.Listener
-
turnAlloc
- Specified by:
turnAllocin interfaceSTUN.Listener
-
turnBind
- Specified by:
turnBindin interfaceSTUN.Listener
-
turnRefresh
- Specified by:
turnRefreshin interfaceSTUN.Listener
-
turnFailed
- Specified by:
turnFailedin interfaceSTUN.Listener
-
turnData
- Specified by:
turnDatain interfaceSTUN.Listener
-
wait4reset
protected void wait4reset() -
wait4reply
- Throws:
Exception
-
init
-
init
-
setReceiveBufferSize
public void setReceiveBufferSize(int bytes) -
setMTU
public void setMTU(int mtu) Sets maximum packet size. Must call before start(). (default = 1500) -
getNextTURNChannel
protected short getNextTURNChannel() -
start
public boolean start()Starts RTP session. -
stop
public void stop()Stops RTP session and frees resources. -
uninit
public void uninit()Frees resources. Same as stop(); -
createChannel
Create a new RTP channel with a random ssrc id. -
createChannel
Create a new RTP channel with a specified ssrc id. -
removeChannel
Remove RTPChannel -
getDefaultChannel
Returns default RTP channel. -
findChannel
-
findChannel
-
setPortRange
public static void setPortRange(int min, int max) Sets global RTP port range to use (should be set before calling init()).- Parameters:
min- = lowest port to use (inclusive)max- = highest port to use (exclusive)
-
setServerPortRange
public static void setServerPortRange()Sets preferred range for server. -
setClientPortRange
public static void setClientPortRange()Sets preferred range for client. -
keepalive
public void keepalive()Keep Alive - call every 30 seconds to keep active. -
setRawMode
public void setRawMode(boolean state) Sets raw mode
Packets are not decoded, they are passed directly thru RTPInterface.rtpPacket()
This is used by PBX to relay RTP packets between call originator and terminator. -
getRawMode
public boolean getRawMode()Returns current raw mode -
getTurnIP
-
genIceufrag
-
genIcepwd
-
setInterface
-
toString
-