org.mitre.jsip
Class SipClient

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--org.mitre.jsip.SipClient
All Implemented Interfaces:
java.lang.Runnable

public class SipClient
extends java.lang.Thread


Field Summary
static int DontHideVia
           
static int HideHop
           
static int HideRoute
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Method Summary
 void addCall(SipCall call)
          addCall
 void addCallListener(CallListener cl)
          Method for adding CallEvent listeners
 void callListUpdated()
          Triggered when a call is deleted or added to the internal list of calls, or when a call has its type changed.
 void deleteCall(SipCall call)
          deleteCall
 java.lang.String getAcceptLanguage()
           
 boolean getBusy()
          Returns the current state of busy mode.
 java.lang.String getBusyMessage()
          Returns our current busy message.
 boolean getCallForward()
          Returns the current state of call forwarding.
 java.lang.String getCallForwardMessage()
          Returns our current forward message.
 SipUri getCallForwardUri()
          Returns the URI we are currently forwarding to.
 java.util.ArrayList getCallList()
          Returns an iterator to teh list of active SIP calls.
 CallListener getCallListener()
          Method for accessing the CallListener
 SipUri getContactUri()
          Returns the full contact URI for this client.
 SipCallMember getCurrentCallMemb()
           
 SipUser getDefaultUser()
          Returns the current default user.
 boolean getDefaultUserMode()
          Returns true if we accept calls with a default user
 java.lang.String getExplicitProxyAddress()
          Returns the explicit proxy for this client, in the same format as above.
 boolean getExplicitProxyMode()
          Returns true if we are currently sending outgoing requests to the explicit proxy.
 int getHideViaMode()
          Returns the current Via hiding mode.
 int getMaxForwards()
          Returns our current max forwards.
 SipUri getRegisterContactUri()
          Returns the contact URI the client will use when registering.
static SipClient getSipClient()
           
 SipUser getUser(SipUri userUri)
          Returns a user of this client.
 java.lang.String getUserAgent()
          Returns our User-Agent string (library version)
 boolean haveMessages()
          Check if incoming messages are available
 void incomingCall(SipCall call, SipCallMember member)
          Initiated when a new SIP call is created from an incoming message.
 void incomingMessage()
          An external trigger for checking incoming messages
 void kill()
           
static void main(java.lang.String[] args)
          Test method
 void removeCallListener(CallListener cl)
          Method for removing CallEvent listeners
 void run()
           
 void sendQuickResponse(SipMessage origmessage, SipStatus status)
          sendQuickResponse
 void sendResponse(SipResponseMessage msg, boolean contact)
          sendResponse
 void setAcceptLanguage(java.lang.String languages)
           
 void setBusy(boolean onoff)
          Turns of or off busy mode.
 void setBusyMessage(java.lang.String newmessage)
          Allows the user to set a message to be displayed when the client discovers we are busy.
 void setCallForward(boolean onoff)
          Turns of or off call forwarding.
 void setCallForwardMessage(java.lang.String newmessage)
          Allows the user to set a message to be displayed when a client is forwarded.
 void setCallForwardUri(SipUri u)
          Sets the URI to forward calls to if call forwarding is enabled.
 void setContactCapabilities(int capabilities)
          Allows us to set our capabilities
 void setContactUri(SipUri cUri)
          Allows us to set the contact uri
 void setCurrentCallMemb(SipCallMember callMemb)
           
 void setDefaultUser(SipUser user)
          Sets the current default user.
 void setDefaultUserMode(boolean onoff)
          Turn on default user mode.
 void setExplicitProxyAddress(java.lang.String newproxy)
          Specify the explicit proxy address for this client.
 void setExplicitProxyMode(boolean eproxy)
          Turn on explicit proxying.
 void setHideViaMode(int newmode)
          Set Via hiding mode.
 void setMaxForwards(int newmax)
          Sets our current max forwards.
 void timerTask()
          This call does the select on all the client's listening sockets and performs any pending actions.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DontHideVia

public static final int DontHideVia

HideHop

public static final int HideHop

HideRoute

public static final int HideRoute
Method Detail

getSipClient

public static SipClient getSipClient()

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(java.lang.String newmessage)
Allows the user to set a message to be displayed when a client is forwarded.
Parameters:
newmessage -  

getCallForwardMessage

public java.lang.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(java.lang.String newmessage)
Allows the user to set a message to be displayed when the client discovers we are busy.
Parameters:
newmessage -  

getBusyMessage

public java.lang.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(java.lang.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 java.lang.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 java.util.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 java.lang.String getUserAgent()
Returns our User-Agent string (library version)
Returns:
String

setAcceptLanguage

public void setAcceptLanguage(java.lang.String languages)

getAcceptLanguage

public java.lang.String getAcceptLanguage()

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 void addCallListener(CallListener cl)
Method for adding CallEvent listeners

removeCallListener

public void removeCallListener(CallListener cl)
Method for removing CallEvent listeners

getCallListener

public CallListener getCallListener()
Method for accessing the CallListener

run

public void run()
Overrides:
run in class java.lang.Thread

kill

public void kill()

getCurrentCallMemb

public SipCallMember getCurrentCallMemb()

setCurrentCallMemb

public void setCurrentCallMemb(SipCallMember callMemb)

sendQuickResponse

public void sendQuickResponse(SipMessage origmessage,
                              SipStatus status)
sendQuickResponse

addCall

public void addCall(SipCall call)
addCall
Parameters:
call -  

deleteCall

public void deleteCall(SipCall call)
deleteCall
Parameters:
call -  

sendResponse

public void sendResponse(SipResponseMessage msg,
                         boolean contact)
sendResponse
Parameters:
msg -  
contact -  

haveMessages

public boolean haveMessages()
Check if incoming messages are available

main

public static void main(java.lang.String[] args)
Test method