cnrg.itx.signal
Class DesktopSignaling

java.lang.Object
  |
  +--cnrg.itx.signal.DesktopSignaling

public class DesktopSignaling
extends java.lang.Object

The primary Signaling Object that allows the application to access all telephony services.


Inner Class Summary
 class DesktopSignaling.Result
          Inner Class containing the result of a Dial Sequence.
 
Field Summary
protected static int globalPhoneValue
          the number of digits that define a long distance phone call
protected  SignalingObserver myApp
          Application's (that implements SignalingObserver) Handle
protected  java.util.Hashtable myConnectionList
          Hashtable of all Signal connections
protected  long myConnSeqNumber
          Unique sequence number
protected  java.lang.String myDesc
          Description of application
protected  cnrg.itx.ds.DirectoryService myDirS
          Directory Service Handle
protected  DesktopSignalingServer myDSS
          DesktopSignalingServer Handle
protected  java.net.InetAddress myIAdd
          IP Address in InetAddress format
protected  cnrg.itx.ds.Location myLoc
          Location of this machine; Used by Server Thread, DS & App.
protected  java.lang.String myName
          String representation of IP Address
protected  cnrg.itx.ds.Password myPassword
          user's password
protected  int myServerPort
          Port Server Thread will listen on.
protected  cnrg.itx.ds.UserID myUID
          email address or phone number
protected static java.lang.String SIPContentType
          the type of media used for the body
protected static java.lang.String SIPTransport
          the transport protocol used when sending SIP packets
protected static java.lang.String SIPVersion
          the SIP version this DesktopSignaling implements
protected static int TIMEOUT
          Timeout value for all Signaling Sockets using TCP
protected static boolean useSIP
          true if this DesktopSignaling implements SIP; false otherwise
 
Constructor Summary
DesktopSignaling(SignalingObserver so)
          Constructor for DesktopSignaling for applications that run without a Directory Service - i.e.
DesktopSignaling(SignalingObserver so, int port)
          Constructor for DesktopSignaling for applications that run without a Directory Service - i.e.
DesktopSignaling(SignalingObserver so, java.lang.String uid, int port)
          Constructor for DesktopSignaling for applications that run without a Directory Service - i.e.
DesktopSignaling(SignalingObserver so, java.lang.String uid, java.lang.String pass)
          Constructor for a DesktopSignaling component for an application with no specified description and config file.
DesktopSignaling(SignalingObserver so, java.lang.String uid, java.lang.String pass, java.lang.String desc, java.lang.String config)
          Constructor for DesktopSignaling with an app description and config file for Directory Service
DesktopSignaling(SignalingObserver so, java.lang.String uid, java.lang.String pass, java.lang.String desc, java.lang.String config, boolean ifSIP)
          Constructor for DesktopSignaling as above with a boolean stating if this uses the SIP protocol
 
Method Summary
 SignalConnection Dial(cnrg.itx.ds.Location peerLoc)
          Returns a SignalConnection containing the data connection object to be used to transferring sound data.
 SignalConnection Dial(cnrg.itx.ds.Location peerLoc, cnrg.itx.datax.Channel cInput, cnrg.itx.datax.Channel cOutput)
          Returns a SignalConnection containing the data connection object to be used to transferring sound data.
 SignalConnection Dial(cnrg.itx.ds.Location peerLoc, cnrg.itx.datax.Channel cInput, cnrg.itx.datax.Channel cOutput, SignalConnectionObserver sco)
          Returns a SignalConnection containing the data connection object to be used to transferring sound data.
 SignalConnection Dial(cnrg.itx.ds.Location peerLoc, SignalConnectionObserver sco)
          Returns a SignalConnection containing the data connection object to be used to transferring sound data.
 SignalConnection Dial(java.lang.String userid)
          Dials a peer application and returns a SignalConnection containing the connection object to use for communication.
 SignalConnection Dial(java.lang.String userid, cnrg.itx.datax.Channel cInput, cnrg.itx.datax.Channel cOutput)
          Returns a SignalConnection containing the connection object to use for communication.
 SignalConnection Dial(java.lang.String userid, cnrg.itx.ds.Location peerLoc)
          Returns a SignalConnection containing the data connection object to be used to transferring sound data.
 SignalConnection Dial(java.lang.String userid, cnrg.itx.ds.Location destAdd, cnrg.itx.datax.Channel cInput, cnrg.itx.datax.Channel cOutput)
          This is the primary Location-based, blocking, Dial method.
 SignalConnection Dial(java.lang.String userid, cnrg.itx.ds.Location userLoc, cnrg.itx.datax.Channel cInput, cnrg.itx.datax.Channel cOutput, SignalConnectionObserver sco)
          Returns a SignalConnection containing the connection object to use for communication.
 SignalConnection Dial(java.lang.String userid, cnrg.itx.ds.Location userLoc, SignalConnectionObserver sco)
          Returns a SignalConnection containing the connection object to use for communication.
private  SignalConnection getConnection(java.lang.Long seq)
          Gets the SignalConnection object from the hashtable corresponding with a sequence number.
private  cnrg.itx.datax.Channel getDefaultInputChannel()
          returns the default input channel for data communications which is NetworkSource to speakers
private  cnrg.itx.datax.Channel getDefaultOutputChannel()
          returns the default output channel for data communications which is microphone to NetworkDestination
 cnrg.itx.ds.DirectoryService getDirectory()
          This method allows application to get a handle to a ready-to-use Directory Service.
 cnrg.itx.ds.LocationList getLocationList(java.lang.String userid)
          This method allows an application to get a list of possible locations for a given user.
 java.lang.String getName()
          Returns the name of the computer on which we are running
 int getPort()
          This method returns the port on which the SignalingServer is listening
private  java.lang.Long getSequence()
          Gets the current connection's sequence number.
 int getTimeout()
          This method returns the timeout value currently being used for socket connections by Signaling.
protected  void handleAliveInvite(AliveSignalEvent ase, java.net.Socket s)
          This method is used to handle an alive request.
protected  void handleDialInvite(InviteSignalEvent ise, java.net.Socket so)
          This method is used to handle an incoming call.
protected  void handleHangupInvite(HangupSignalEvent hse, java.net.Socket s)
          This method is used to handle a hangup request.
protected  void handlePeerNotAlive(SignalConnection sc)
          This method is used to clear up resources if the peer application is no longer active.
protected  void handleSendDTMFInvite(DTMFSignalEvent dtmfse, java.net.Socket s)
          This method is used to handle an incoming DTMF tone.
 void Hangup(SignalConnection sc)
          Hangs up a given SignalConnection being used for a call.
private  void initDeskSig(SignalingObserver so)
          Sets up selected fields in the DesktopSignaling object.
 boolean isAlive(SignalConnection sc)
          This method queries a peer application to check if it is still running.
 void logout()
          This method unregisters the Signaling Component with Directory Services (if myDirS is not null) and kills the server thread.
private  SignalConnection processResult(DesktopSignaling.Result ret, cnrg.itx.datax.AudioConnection ac, boolean outLast, boolean busyFlag, java.lang.String userid)
          processes the Result from tryDialSequence, which encapsulates our peer's reaction to our Invite.
private  void putConnection(java.lang.Long seq, SignalConnection sc)
          Places a SignalConnection object into the hashtable.
protected  void Register()
          This method registers the DesktopSignaling Component with DirectoryService.
private  void removeConnection(java.lang.Long seq)
          Removes a SignalConnection object from the hashtable.
 void sendDTMF(java.lang.String s, SignalConnection sc)
          This method sends a DTMF tone, as a string, to the destination on a given SignalConnection
protected  java.net.Socket sendNewPacket(SigPacket send, java.lang.String ip, int p)
          This method sends a packet over a TCP connection.
protected  void sendPacket(SigPacket send, java.net.Socket sock, java.lang.String topHeader, java.lang.String method)
          This method sends a packet over an TCP socket.
protected  void setServerPort(int p)
          The DesktopSignalingServer thread uses this method to register its port with DesktopSignaling.
 void setTimeout(int t)
          This method allows the application to set the timeout value to use for socket connections.
protected  DesktopSignaling.Result tryDialSequence(cnrg.itx.ds.UserID destUID, cnrg.itx.ds.Location destAdd, cnrg.itx.datax.Connection ac)
          This method performs a Dial Sequence including the 3-way handshake.
protected  int unRegister()
          This method Unregisters the DesktopSignaling Component on DirectoryService.
protected  SigPacket waitForPacket(java.net.Socket sock)
          This method waits for a packet on a given TCP socket.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

myUID

protected cnrg.itx.ds.UserID myUID
email address or phone number

myPassword

protected cnrg.itx.ds.Password myPassword
user's password

myDesc

protected java.lang.String myDesc
Description of application

myName

protected java.lang.String myName
String representation of IP Address

myDirS

protected cnrg.itx.ds.DirectoryService myDirS
Directory Service Handle

myDSS

protected DesktopSignalingServer myDSS
DesktopSignalingServer Handle

myApp

protected SignalingObserver myApp
Application's (that implements SignalingObserver) Handle

myConnectionList

protected java.util.Hashtable myConnectionList
Hashtable of all Signal connections

myConnSeqNumber

protected long myConnSeqNumber
Unique sequence number

myIAdd

protected java.net.InetAddress myIAdd
IP Address in InetAddress format

myLoc

protected cnrg.itx.ds.Location myLoc
Location of this machine; Used by Server Thread, DS & App.

myServerPort

protected int myServerPort
Port Server Thread will listen on.

TIMEOUT

protected static int TIMEOUT
Timeout value for all Signaling Sockets using TCP

useSIP

protected static boolean useSIP
true if this DesktopSignaling implements SIP; false otherwise

SIPVersion

protected static java.lang.String SIPVersion
the SIP version this DesktopSignaling implements

SIPTransport

protected static java.lang.String SIPTransport
the transport protocol used when sending SIP packets

SIPContentType

protected static java.lang.String SIPContentType
the type of media used for the body

globalPhoneValue

protected static int globalPhoneValue
the number of digits that define a long distance phone call
Constructor Detail

DesktopSignaling

public DesktopSignaling(SignalingObserver so,
                        java.lang.String uid,
                        java.lang.String pass)
                 throws cnrg.itx.ds.DirectoryServiceException
Constructor for a DesktopSignaling component for an application with no specified description and config file.
Parameters:
so - the SignalingObserver handle for the Application
uid - the UserID of the user
pass - the password of the user
Throws:
cnrg.itx.ds.DirectoryServiceException -  
See Also:
DirectoryServiceException

DesktopSignaling

public DesktopSignaling(SignalingObserver so,
                        java.lang.String uid,
                        java.lang.String pass,
                        java.lang.String desc,
                        java.lang.String config)
                 throws cnrg.itx.ds.DirectoryServiceException
Constructor for DesktopSignaling with an app description and config file for Directory Service
Parameters:
so - the SignalingObserver handle for the Application
uid - the UserID of the user
pass - the password of the user
desc - the String representing the type of application instantiating this component
config - is the name of the configuration file to use for Directory Service
Throws:
cnrg.itx.ds.DirectoryServiceException -  
See Also:
DirectoryServiceException

DesktopSignaling

public DesktopSignaling(SignalingObserver so,
                        java.lang.String uid,
                        java.lang.String pass,
                        java.lang.String desc,
                        java.lang.String config,
                        boolean ifSIP)
                 throws cnrg.itx.ds.DirectoryServiceException
Constructor for DesktopSignaling as above with a boolean stating if this uses the SIP protocol
Parameters:
so - the SignalingObserver handle for the Application
uid - the UserID of the user
pass - the password of the user
desc - the String representing the type of application instantiating this component
config - is the name of the configuration file to use for Directory Service
ifSIP - true if DesktopSignaling uses SIP; false otherwise
Throws:
cnrg.itx.ds.DirectoryServiceException -  
See Also:
DirectoryServiceException

DesktopSignaling

public DesktopSignaling(SignalingObserver so)
Constructor for DesktopSignaling for applications that run without a Directory Service - i.e. they don't register themselves nor do they do directory lookups. This version of the constructor listens on a free port selected by the Java library.
Parameters:
so - - SignalingObserver that will handle SigEvents

DesktopSignaling

public DesktopSignaling(SignalingObserver so,
                        int port)
Constructor for DesktopSignaling for applications that run without a Directory Service - i.e. they don't register themselves nor do they do directory lookups. This version listens on a specified port.
Parameters:
this - - SignalingObserver that will handle SigEvents
port - - the port on which the server should listen. (If 0, the server will listen on any free port)

DesktopSignaling

public DesktopSignaling(SignalingObserver so,
                        java.lang.String uid,
                        int port)
Constructor for DesktopSignaling for applications that run without a Directory Service - i.e. they don't register themselves nor do they do directory lookups. This version listens on a specified port and specifies a the name of the user.
Parameters:
this - - SignalingObserver that will handle SigEvents
uid - - String representing the identity of the client.
port - - the port on which the server should listen. (If 0, the server will listen on any free port)
Method Detail

initDeskSig

private void initDeskSig(SignalingObserver so)
Sets up selected fields in the DesktopSignaling object. Invoked by the various constructors.
Parameters:
so - - SignalingObserver that will handle SigEvents
Returns:
None

Dial

public SignalConnection Dial(java.lang.String userid)
                      throws cnrg.itx.datax.DataException,
                             DesktopSignalingException,
                             cnrg.itx.ds.DirectoryServiceException
Dials a peer application and returns a SignalConnection containing the connection object to use for communication. This dial is blocking. It automatically tries all locations for the given user and returns the first established connection.
Parameters:
userid - the String representing the email address or phone number or userID to call
Returns:
a SignalConnection object for data transfer
Throws:
DesktopSignalingException -  
cnrg.itx.datax.DataException -  
cnrg.itx.ds.DirectoryServiceException -  
See Also:
SignalConnection, DataException, DesktopSignalingException, DirectoryServiceException

Dial

public SignalConnection Dial(java.lang.String userid,
                             cnrg.itx.datax.Channel cInput,
                             cnrg.itx.datax.Channel cOutput)
                      throws cnrg.itx.datax.DataException,
                             DesktopSignalingException,
                             cnrg.itx.ds.DirectoryServiceException
Returns a SignalConnection containing the connection object to use for communication. This dial is blocking. It automatically tries all locations for the given user and returns the first established connection. The application provides the input and output channels to use for the call.
Parameters:
userid - the String representing the email address or phone number or userID to call
cInput - Input Channel to add to result
cOutput - Output Channel to add to result
Returns:
a SignalConnection object for data transfer
Throws:
DesktopSignalingException -  
cnrg.itx.datax.DataException -  
cnrg.itx.ds.DirectoryServiceException -  
See Also:
SignalConnection, DataException, DesktopSignalingException, DirectoryServiceException

Dial

public SignalConnection Dial(java.lang.String userid,
                             cnrg.itx.ds.Location userLoc,
                             SignalConnectionObserver sco)
                      throws cnrg.itx.datax.DataException,
                             DesktopSignalingException
Returns a SignalConnection containing the connection object to use for communication. This dial is non-blocking and requires the application to implement the SignalConnectionObserver interface. The method returns immediately with a SignalConnection. The SignalConnection can then be used to control the call (eg. startCall, abortCall etc.)
Parameters:
userid - the String representing the email address or phone number or userID to call
userLoc - the Location object that needs to be dialed.
sco - the SignalConnectionObserver object that is used by the application to control the dial process
Returns:
a SignalConnection object for the call.
Throws:
DesktopSignalingException -  
cnrg.itx.datax.DataException -  
See Also:
SignalConnectionObserver, SignalConnection, DataException, DesktopSignalingException

Dial

public SignalConnection Dial(java.lang.String userid,
                             cnrg.itx.ds.Location userLoc,
                             cnrg.itx.datax.Channel cInput,
                             cnrg.itx.datax.Channel cOutput,
                             SignalConnectionObserver sco)
                      throws cnrg.itx.datax.DataException,
                             DesktopSignalingException
Returns a SignalConnection containing the connection object to use for communication. This dial is non-blocking and requires the application to implement the SignalConnectionObserver interface. This method allows the app to specify the input and output channels to use for data exchange. The method returns immediately with a SignalConnection. The SignalConnection can then be used to control the call (eg. startCall, abortCall etc.)
Parameters:
userid - the String representing the email address or phone number or userID to call
userLoc - the Location object that needs to be dialed
cInput - the input channel to use for data exchange
cOutput - the output channel to use for data exchange
sco - the SignalConnectionObserver object that is used by the application to control the dial process
Returns:
a SignalConnection object for the call.
Throws:
DesktopSignalingException -  
cnrg.itx.datax.DataException -  
See Also:
SignalConnectionObserver, SignalConnection, DataException, DesktopSignalingException

Dial

public SignalConnection Dial(cnrg.itx.ds.Location peerLoc)
                      throws cnrg.itx.datax.DataException,
                             DesktopSignalingException
Returns a SignalConnection containing the data connection object to be used to transferring sound data. This dial is blocking and returns to the user only when the invite has received a reply from the peer, or if we timeout. The default name of our peer application is "anonymous server", and default Channels are used for data communication (mic, speakers, network)
Parameters:
peerLoc - - the Location of our peer
Throws:
DesktopSignalingException - is thrown when
cnrg.itx.datax.DataException - is thrown when default audio connection could not be set up for some reason

Dial

public SignalConnection Dial(cnrg.itx.ds.Location peerLoc,
                             cnrg.itx.datax.Channel cInput,
                             cnrg.itx.datax.Channel cOutput)
                      throws cnrg.itx.datax.DataException,
                             DesktopSignalingException
Returns a SignalConnection containing the data connection object to be used to transferring sound data. This dial is blocking and returns to the user only when the invite has received a reply from the peer, or if we timeout. The default name of our peer application is "anonymous server".
Parameters:
peerLoc - - the Location of our peer
cInput - - Input channel to be used for data communications
cOuput - - output channel to be used for data communications
Throws:
DesktopSignalingException - is thrown when

Dial

public SignalConnection Dial(java.lang.String userid,
                             cnrg.itx.ds.Location peerLoc)
                      throws cnrg.itx.datax.DataException,
                             DesktopSignalingException
Returns a SignalConnection containing the data connection object to be used to transferring sound data. This dial is blocking and returns to the user only when the invite has received a reply from the peer, or if we timeout. Default channels are used for data communication (mic, speakers, and network)
Parameters:
userid - - name for server app, our peer
peerLoc - - the Location of our peer
Throws:
DesktopSignalingException - is thrown when
cnrg.itx.datax.DataException - is thrown when the default audio connection could not be set up for some reason

Dial

public SignalConnection Dial(java.lang.String userid,
                             cnrg.itx.ds.Location destAdd,
                             cnrg.itx.datax.Channel cInput,
                             cnrg.itx.datax.Channel cOutput)
                      throws cnrg.itx.datax.DataException,
                             DesktopSignalingException
This is the primary Location-based, blocking, Dial method. Returns a SignalConnection containing the data connection object to be used to transferring sound data. This dial is blocking and returns to the user only when the invite has received a reply from the peer, or if we timeout.
Parameters:
userid - - name for server app, our peer
destAdd - - the Location of our peer
cInput - - Input channel to be used for data communications
cOuput - - output channel to be used for data communications
Throws:
DesktopSignalingException - is thrown when
cnrg.itx.datax.DataException - is thrown when

Dial

public SignalConnection Dial(cnrg.itx.ds.Location peerLoc,
                             SignalConnectionObserver sco)
                      throws cnrg.itx.datax.DataException,
                             DesktopSignalingException
Returns a SignalConnection containing the data connection object to be used to transferring sound data. This dial is non-blocking and requires the application to implement the SignalConnectionObserver interface. This method returns immediately with a SignalConnection. The SignalConnection can then be used to control the call (e.g. startCall, abortCall, etc.) Default channels are used for data communication (mic, speakers, and network). Default userid of "anonymous server" is used.
Parameters:
peerLoc - - the Location of our peer
sco - the SignalConnectionObserver object that is used by the application to control the dial process
Returns:
a SignalConnection object for the call.
Throws:
DesktopSignalingException - is thrown when?
cnrg.itx.datax.DataException - is thrown when the default audio connection could not be set up for some reason.

Dial

public SignalConnection Dial(cnrg.itx.ds.Location peerLoc,
                             cnrg.itx.datax.Channel cInput,
                             cnrg.itx.datax.Channel cOutput,
                             SignalConnectionObserver sco)
                      throws cnrg.itx.datax.DataException,
                             DesktopSignalingException
Returns a SignalConnection containing the data connection object to be used to transferring sound data. This dial is non-blocking and requires the application to implement the SignalConnectionObserver interface. This method returns immediately with a SignalConnection. The SignalConnection can then be used to control the call (e.g. startCall, abortCall, etc.) Default userid of "anonymous server" is used.
Parameters:
peerLoc - - the Location of our peer
cInput - - Input channel to be used for data communications
cOutput - - Output channel to be used for data communications
sco - the SignalConnectionObserver object that is used by the application to control the dial process
Returns:
a SignalConnection object for the call.
Throws:
DesktopSignalingException - is thrown when?
cnrg.itx.datax.DataException - is thrown when the default audio connection could not be set up for some reason.

Hangup

public void Hangup(SignalConnection sc)
            throws ConnectException
Hangs up a given SignalConnection being used for a call.
Parameters:
sc - the SignalConnection to hangup
Returns:
void
Throws:
ConnectException -  

sendDTMF

public void sendDTMF(java.lang.String s,
                     SignalConnection sc)
              throws ConnectException
This method sends a DTMF tone, as a string, to the destination on a given SignalConnection
Parameters:
s - is the string representation of the DTMF tone.
sc - is the SignalConnection currently in use with the peer application.
Returns:
void
Throws:
ConnectException -  

isAlive

public boolean isAlive(SignalConnection sc)
                throws ConnectException
This method queries a peer application to check if it is still running. If the peer application does not respond then the data connection between them is closed and removed.
Parameters:
sc - is the SignalConnection currently in use with the peer application.
Returns:
TRUE if the application is still running, FALSE otherwise
Throws:
ConnectException -  

getDirectory

public cnrg.itx.ds.DirectoryService getDirectory()
This method allows application to get a handle to a ready-to-use Directory Service. The application needs to know the Directory Service API.
Parameters:
None. -  
Returns:
A handle to a DirectoryService Object

getLocationList

public cnrg.itx.ds.LocationList getLocationList(java.lang.String userid)
                                         throws cnrg.itx.ds.DirectoryServiceException
This method allows an application to get a list of possible locations for a given user. This should be used in conjuntion with the non-blocking dial to call specific locations.
Parameters:
userid - is the String representation of a user.
Returns:
A LocationList for the given userid.
Throws:
cnrg.itx.ds.DirectoryServiceException -  

setTimeout

public void setTimeout(int t)
This method allows the application to set the timeout value to use for socket connections.
Parameters:
t - is the timeout in milliseconds to be used for Sockets.
Returns:
void

getTimeout

public int getTimeout()
This method returns the timeout value currently being used for socket connections by Signaling.
Parameters:
None -  
Returns:
the integer value of the timeout

getPort

public int getPort()
This method returns the port on which the SignalingServer is listening
Parameters:
None -  
Returns:
the integer value of port on which we are listening

getName

public java.lang.String getName()
Returns the name of the computer on which we are running
Parameters:
None -  
Returns:
the string value of the the IP address of the computer on which we are running

logout

public void logout()
This method unregisters the Signaling Component with Directory Services (if myDirS is not null) and kills the server thread.
Parameters:
None. -  
Returns:
void

handleDialInvite

protected void handleDialInvite(InviteSignalEvent ise,
                                java.net.Socket so)
                         throws DesktopSignalingException,
                                cnrg.itx.datax.DataException
This method is used to handle an incoming call.
Parameters:
ise - is the InviteSignalEvent that contains all the necessary information about the peer
so - is the socket that should be used for communication.
Returns:
void
Throws:
DesktopSignalingException -  
See Also:
InviteSignalEvent

handleHangupInvite

protected void handleHangupInvite(HangupSignalEvent hse,
                                  java.net.Socket s)
This method is used to handle a hangup request.
Parameters:
hse - is the HangupSignalEvent that contains all the necessary information about the peer
s - is the socket that should be used for communication.
Returns:
void
See Also:
HangupSignalEvent

handleSendDTMFInvite

protected void handleSendDTMFInvite(DTMFSignalEvent dtmfse,
                                    java.net.Socket s)
This method is used to handle an incoming DTMF tone.
Parameters:
dtmfse - is the DTMFSignalEvent that contains all the necessary information about the peer
s - is the socket that should be used for communication.
Returns:
void
See Also:
DTMFSignalEvent

handleAliveInvite

protected void handleAliveInvite(AliveSignalEvent ase,
                                 java.net.Socket s)
This method is used to handle an alive request.
Parameters:
ase - is the AliveSignalEvent that contains all the necessary information about the peer
s - is the socket that should be used for communication.
Returns:
void
See Also:
AliveSignalEvent

handlePeerNotAlive

protected void handlePeerNotAlive(SignalConnection sc)
This method is used to clear up resources if the peer application is no longer active.
Parameters:
sc - is the SignalConnection that needs to be closed and removed
Returns:
void
See Also:
cnrg.itx.signal.client.SignalConnection

setServerPort

protected void setServerPort(int p)
The DesktopSignalingServer thread uses this method to register its port with DesktopSignaling.
Parameters:
p - is the port the Server thread is listening for requests.

tryDialSequence

protected DesktopSignaling.Result tryDialSequence(cnrg.itx.ds.UserID destUID,
                                                  cnrg.itx.ds.Location destAdd,
                                                  cnrg.itx.datax.Connection ac)
                                           throws ConnectException
This method performs a Dial Sequence including the 3-way handshake. The result of the handshake is returned to the callee method.
Parameters:
destUID - - the UserID of the callee
destAdd - - the IP address of the destination
ac - - the data connection that will be used to transmit data
Throws:
ConnectException - is thrown if

sendNewPacket

protected java.net.Socket sendNewPacket(SigPacket send,
                                        java.lang.String ip,
                                        int p)
                                 throws ConnectException
This method sends a packet over a TCP connection. A new socket is created.
Parameters:
send - is the SigPacket to send to the peer application
ip - is the String representation of the IP address of the destination
p - is the port of the destination application
Returns:
Socket that was created and used to send the packet
Throws:
DesktopSignalingException -  

sendPacket

protected void sendPacket(SigPacket send,
                          java.net.Socket sock,
                          java.lang.String topHeader,
                          java.lang.String method)
                   throws ConnectException
This method sends a packet over an TCP socket. No new socket is created.
Parameters:
send - is the SigPacket to send to the peer application
sock - is the existing socket to use
topHeader - the header for a SIP response; null if packet is a SIP request or DesktopSignaling does not use SIP
method - the SIP method involved; null if DesktopSignaling does not use SIP
Returns:
void
Throws:
DesktopSignalingException -  

waitForPacket

protected SigPacket waitForPacket(java.net.Socket sock)
                           throws java.io.InterruptedIOException
This method waits for a packet on a given TCP socket. The wait times out after the specified number of seconds (in DesktopSignaling.TIMEOUT) have passed.
Parameters:
sock - is the existing socket to wait on
Returns:
SigPacket that is received
Throws:
java.io.InterruptedIOException -  

Register

protected void Register()
                 throws cnrg.itx.ds.DirectoryServiceException
This method registers the DesktopSignaling Component with DirectoryService.
Parameters:
None. -  
Returns:
Void.

unRegister

protected int unRegister()
This method Unregisters the DesktopSignaling Component on DirectoryService.
Parameters:
None. -  
Returns:
integer indicating whether the unregistration succeeded 1 - successfully unregistered -1 - unregister failed

getSequence

private java.lang.Long getSequence()
Gets the current connection's sequence number.
Returns:
the sequence number

getConnection

private SignalConnection getConnection(java.lang.Long seq)
Gets the SignalConnection object from the hashtable corresponding with a sequence number.
Parameters:
seq - the sequence number of the connection
Returns:
the SignalConnection object

putConnection

private void putConnection(java.lang.Long seq,
                           SignalConnection sc)
Places a SignalConnection object into the hashtable.
Parameters:
seq - the sequence number of the connection
sc - the SignalConnection to be placed into the hashtable

removeConnection

private void removeConnection(java.lang.Long seq)
Removes a SignalConnection object from the hashtable.
Parameters:
seq - the sequence number of the connection

getDefaultInputChannel

private cnrg.itx.datax.Channel getDefaultInputChannel()
                                               throws cnrg.itx.datax.DataException
returns the default input channel for data communications which is NetworkSource to speakers
Parameters:
None -  
Throws:
cnrg.itx.datax.DataException - thrown when trying to add the same destination to a channel twice, or if there is no free port for the NetworkSource.

getDefaultOutputChannel

private cnrg.itx.datax.Channel getDefaultOutputChannel()
                                                throws cnrg.itx.datax.DataException
returns the default output channel for data communications which is microphone to NetworkDestination
Parameters:
None -  
Throws:
cnrg.itx.datax.DataException - thrown when trying to add the same destination to a channel twice, or microphone resources could not be allocated

processResult

private SignalConnection processResult(DesktopSignaling.Result ret,
                                       cnrg.itx.datax.AudioConnection ac,
                                       boolean outLast,
                                       boolean busyFlag,
                                       java.lang.String userid)
                                throws DesktopSignalingException
processes the Result from tryDialSequence, which encapsulates our peer's reaction to our Invite. This method either (1) returns with a valid SignalConnection or (2) throws an exception.
Parameters:
ret - - the Result of the tryDialSequence
ac - - the AudioConnection we intended to use. This will be closed if the result is not an Accept and this is the last location to be tried
outLast - - true if this is the last Location to be tried
busyFlag - - true if a previously dialled location was busy. This parameter carries history from a previous call.
userid - - userid string for use in exception message
Throws:
DesktopSignalingException - is thrown if the Dial was unsuccessful. The contained message explains why.