org.mitre.jsip
Clase SipClient
- public class SipClient
- extends Thread
SipClient
protected SipClient()
- Creates a new SIP client with the specified explicit proxy. This starts up the client listening on a UDP port. By default, it tries to listen on port 5060, or whatever is specified in the sip.dissipate.port environment variable.
timerTask
public void timerTask()
- This call does the select on all the client's listening sockets and performs any pending actions. It should be called in some main loop somewhere. --- NOT USED!!!
- Parameters:
block
-
getContactUri
public SipUri getContactUri()
- Returns the full contact URI for this client. This is placed in all outgoing messages (except for when clearing registrations).
- Returns:
- SipUri
setContactUri
public void setContactUri(SipUri cUri)
- Allows us to set the contact uri
setContactCapabilities
public void setContactCapabilities(int capabilities)
- Allows us to set our capabilities
getRegisterContactUri
public SipUri getRegisterContactUri()
- Returns the contact URI the client will use when registering. This may contain some
methods
tags to support Sip.MESSAGE
and Sip.SUBSCRIBE
Contact uri's.
setDefaultUserMode
public void setDefaultUserMode(boolean onoff)
- Turn on default user mode. If incoming calls arrive at this client and there is no associated user matching the To line in the request, the default user will be used. Dissipate always uses a common contact URI for all registrations. This means that all incoming requests should have a request URI matching that of the announced Contact URI. So, in order to check for a matching user, we match on the To header. When default user mode is off and a message is received when there is no user associated, the call is rejected with a 404 Not Found.
- Parameters:
onoff
-
getDefaultUserMode
public boolean getDefaultUserMode()
- Returns true if we accept calls with a default user
- Returns:
- bool
getDefaultUser
public SipUser getDefaultUser()
- Returns the current default user.
- Returns:
- SipUser *
setDefaultUser
public void setDefaultUser(SipUser user)
- Sets the current default user.
- Parameters:
user
-
setCallForwardUri
public void setCallForwardUri(SipUri u)
- Sets the URI to forward calls to if call forwarding is enabled.
- Parameters:
u
-
getCallForwardUri
public SipUri getCallForwardUri()
- Returns the URI we are currently forwarding to.
- Returns:
- SipUri &
setCallForward
public void setCallForward(boolean onoff)
- Turns of or off call forwarding.
- Parameters:
onoff
-
getCallForward
public boolean getCallForward()
- Returns the current state of call forwarding.
- Returns:
- bool
setCallForwardMessage
public void setCallForwardMessage(String newmessage)
- Allows the user to set a message to be displayed when a client is forwarded.
- Parameters:
newmessage
-
getCallForwardMessage
public String getCallForwardMessage()
- Returns our current forward message.
- Returns:
- String
setBusy
public void setBusy(boolean onoff)
- Turns of or off busy mode.
- Parameters:
onoff
-
getBusy
public boolean getBusy()
- Returns the current state of busy mode.
- Returns:
- bool
setBusyMessage
public void setBusyMessage(String newmessage)
- Allows the user to set a message to be displayed when the client discovers we are busy.
- Parameters:
newmessage
-
getBusyMessage
public String getBusyMessage()
- Returns our current busy message.
- Returns:
- String
setExplicitProxyMode
public void setExplicitProxyMode(boolean eproxy)
- Turn on explicit proxying. When SipClient is acting in explicit proxy mode, all outgoing SIP messages will be sent to the proxy specified, regardless of what the Via dictates.
- Parameters:
eproxy
-
getExplicitProxyMode
public boolean getExplicitProxyMode()
- Returns true if we are currently sending outgoing requests to the explicit proxy.
- Returns:
- bool
setExplicitProxyAddress
public void setExplicitProxyAddress(String newproxy)
- Specify the explicit proxy address for this client. Address is in the format address[:port], defaulting to 5060 if the port is not specified.
- Parameters:
newproxy
-
setMaxForwards
public void setMaxForwards(int newmax)
- Sets our current max forwards.
- Parameters:
newmax
-
getMaxForwards
public int getMaxForwards()
- Returns our current max forwards.
- Returns:
- int
getExplicitProxyAddress
public String getExplicitProxyAddress()
- Returns the explicit proxy for this client, in the same format as above.
- Returns:
- String &
setHideViaMode
public void setHideViaMode(int newmode)
- Set Via hiding mode.
- Parameters:
newmode
-
getHideViaMode
public int getHideViaMode()
- Returns the current Via hiding mode.
- Returns:
- HideViaMode
getCallList
public ArrayList getCallList()
- Returns an iterator to teh list of active SIP calls.
- Returns:
- SipCallIterator
getUser
public SipUser getUser(SipUri userUri)
- Returns a user of this client.
- Returns:
- SipUser
getUserAgent
public String getUserAgent()
- Returns our User-Agent string (library version)
- Returns:
- String
incomingCall
public void incomingCall(SipCall call,
SipCallMember member)
- Initiated when a new SIP call is created from an incoming message.
incomingMessage
public void incomingMessage()
- An external trigger for checking incoming messages
callListUpdated
public void callListUpdated()
- Triggered when a call is deleted or added to the internal list of calls, or when a call has its type changed.
addCallListener
public synchronized void addCallListener(CallListener cl)
- Method for adding CallEvent listeners
removeCallListener
public synchronized void removeCallListener(CallListener cl)
- Method for removing CallEvent listeners
getCallListener
public CallListener getCallListener()
- Method for accessing the CallListener
setupSocket
private void setupSocket()
- setupSocketStuff
setupContactUri
private void setupContactUri()
- setupContactUri
incomingRequestMessage
private void incomingRequestMessage(SipRequestMessage currentMessage)
- incomingRequestMessage
incomingResponseMessage
private void incomingResponseMessage(SipResponseMessage currentMessage)
- Pass response message to its corresponding call
acceptHeaderBad
private boolean acceptHeaderBad(String acceptHeader)
- Check to see if what was sent in Accept: can be read here
getAcceptHeader
private String getAcceptHeader(SipRequestMessage message)
- determine an Accept header that is appropriate for this message
sendQuickResponse
public void sendQuickResponse(SipMessage origmessage,
SipStatus status)
- sendQuickResponse
sendQuickResponse
private void sendQuickResponse(SipMessage origmessage,
SipStatus status,
String body,
MimeContentType bodytype)
- sendQuickResponse
addUser
void addUser(SipUser user)
- addUser
- Parameters:
user
-
deleteUser
private void deleteUser(SipUser user)
- deleteUser
- Parameters:
user
-
addCall
public void addCall(SipCall call)
- addCall
- Parameters:
call
-
deleteCall
public void deleteCall(SipCall call)
- deleteCall
- Parameters:
call
-
sendRequest
void sendRequest(SipRequestMessage msg,
boolean contact)
- sendRequest
- Parameters:
msg
-
contact
-
sendResponse
public void sendResponse(SipResponseMessage msg,
boolean contact)
- sendResponse
- Parameters:
msg
-
contact
-
sendRaw
void sendRaw(SipRequestMessage msg)
- sendRaw
- Parameters:
msg
-
callTypeUpdated
void callTypeUpdated()
- callTypeUpdated
haveMessages
public boolean haveMessages()
- Check if incoming messages are available
main
public static void main(String[] args)
- Test method