Class SIPServer
java.lang.Object
javaforce.voip.SIP
javaforce.voip.SIPServer
- All Implemented Interfaces:
SIPInterface, TransportInterface
Handles the server end of a SIP link.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidenableQOP(boolean state) getCallDetailsServer(String callid) getCalls()booleaninit(int localport, SIPServerInterface iface, TransportType type) booleanissue(CallDetailsServer cd, String header, boolean sdp, boolean src) voidbooleanregister(String user, String pass, String remotehost, int remoteport, int expires, String did, String regcallid) booleanreply(CallDetailsServer cd, int code, String msg, String header, boolean sdp, boolean src) voidsetCallDetailsServer(String callid, CallDetailsServer cd) voiduninit()Closes the UDP port and frees resources.Methods inherited from class SIP
addCodec, buildsdp, convertParameters, delCodec, generatetag, getAuthResponse, getbranch, getbranch, getcallid, getCodec, getCodecName, getcseq, getcseqcmd, getexpires, getFlag2, getnonce, getNow, getremote_audio_rtp_port, getremote_video_rtp_port, getremotertphost, getRequest, getResponse, getResponseType, getrinstance, getroutelist, getSDP, gettag, gettupleid, geturi, getURI, getvialist, hasCodec, init, ishold, join, onConnect, onDisconnect, removetag, replacetag, resolve, send, setFlag2, setremoteport, setResolver, setResolver, splitModifier and TypeMethodDescriptionstatic Codec[]Adds a codec to a list of codecs.String[]buildsdp(CallDetails cd, CallDetails.SideDetails cdsd) Builds SDP packet.static String[]convertParameters(String ln, char delimit) Converts xml style parameters to HTTP style parameters while removing quotes around value.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(CallDetails cd, 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.static StringgetCodecName(int id) Returns string name of codec based on payload id (except dynamic ids 96-127).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.intgetexpires(String[] msg) Returns "expires" field from SIP headers.static StringReturns a flag in a To: From: field.protected Stringgetnonce()Returns a random nonce variable used in SIP authorization.protected longgetNow()Returns current time in seconds.protected 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.static SDPstatic 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, SIPInterface iface, boolean server, TransportType type) Opens the transport and sets the SIPInterface 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'.static String[]replacetag(String[] fields, String newfield) Replaces the 'tag' field from 'newfield' into '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.voidsetremoteport(int port) static voidSet resolver to system DNS client.static voidsetResolver(int transport, String server) Set resolver to custom DNS Server.static String[]Splits a To: or From: field in a SIP message into parts.
-
Constructor Details
-
SIPServer
public SIPServer()
-
-
Method Details
-
init
-
uninit
-
enableQOP
public void enableQOP(boolean state) -
getCallDetailsServer
-
setCallDetailsServer
-
issue
-
reply
public boolean reply(CallDetailsServer cd, int code, String msg, String header, boolean sdp, boolean src) -
getlocalRTPhost
- Specified by:
getlocalRTPhostin classSIP
-
register
-
clone
-
packet
- Specified by:
packetin interfaceSIPInterface
-
getCalls
-