PBXSession Class Reference

List of all members.

Public Member Functions

delegate void AsyncCallback (PBXSession sessionObject, byte[] asyncData)
delegate void AsyncExceptionCallback (PBXSession sessionObject, PBXSessionException exception)
void Close (CSTAContext threadContext)
delegate void ConnectionCallback (PBXSession sessionObject)
void Open (CSTAContext threadContext)
 PBXSession (string pbxSystem, int port)
SocketState SendACSEMessage (byte[] message, int messageLength, Constants.ACSEMessageTypes messageType, CSTAContext threadContext)
void SendMessage (string messageType, byte[] message, int messageLength, CSTAContext threadContext)
void SendMessage (byte[] message, int messageLength, CSTAContext threadContext)
void SendXMLMessage (string messageType, string strMessage, CSTAContext threadContext)
void SendXMLMessage (string strMessage, CSTAContext threadContext)
SocketState SendXMLSession (string strMessage, Constants.XMLSessionMessageTypes enmMessageType, CSTAContext threadContext)
void WaitForROSEResponse (CSTAContext threadContext)
void WaitForXMLResponse (CSTAContext threadContext)
delegate void XMLAsyncCallback (PBXSession sessionObject, string message)

Properties

AsyncCallback ClientCallback [get, set]
ConnectionCallback ConnectionLostCallback [get, set]
bool DebugClientCallback [get, set]
bool DebugMode [get, set]
AsyncExceptionCallback ExceptionCallback [get, set]
int MaxReceiveTimeout [get, set]
Constants.Encoding MessageEncoding [get, set]
string PBXSystem [get]
int Port [get]
AsyncCallback SystemStatusCallback [get, set]
XMLAsyncCallback XMLClientCallback [get, set]
XMLAsyncCallback XMLSystemStatusCallback [get, set]

Detailed Description

This class manages communication with a PBX. One instance of this class should be created for each PBX with which a CSTADLL client application needs to exchange CSTA messages.

The CSTA worker classes (e.g., Alcatel4400, PanasonicNCP) hold a reference to a PBXSession object. If the constructor for the worker class that takes a PBX identification and a PBX port is used, a PBXSession object is created. Alternatively, the client application can create a PBXSession instance and pass a reference to the instance to the other worker class constructor signature.

Only one PBXSession instance for a PBX/port combination should be created. The behavior is undefined if multiple PBXSession instances are created for the same PBX and port.


Constructor & Destructor Documentation

PBXSession ( string  pbxSystem,
int  port 
)

Constructs a PBXSession object.

Parameters:
pbxSystem The name or IP address of the PBX system.
port The port on the PBX system to which the client is connecting.

Member Function Documentation

delegate void AsyncCallback ( PBXSession  sessionObject,
byte[]  asyncData 
)

Declaration of a callback function to be invoked when an asynchronous message is received, such as from a monitor session.

Parameters:
sessionObject The session object for the PBX that generated the asynchronous message.
asyncData The data received asynchronously from the PBX.
delegate void AsyncExceptionCallback ( PBXSession  sessionObject,
PBXSessionException  exception 
)

Declaration of a callback function to be invoked if a condition is encountered in the asynchronous I/O handler that would otherwise result in an exception being thrown. Note that in a couple of cases the asynchronous code will still throw an exception, even if this callback is defined.

Parameters:
sessionObject The session object for the PBX that sent a packet that triggered an exception condition.
exception The PBXSessionException object that would have been thrown in the asynchronous I/O handling code if this callback were not defined.
void Close ( CSTAContext  threadContext  ) 

Terminates the session to the PBX. This method can be used to terminate sessions with PBX devices that don't accept ACSE release association requests.

Parameters:
threadContext The context object for the caling thread.
delegate void ConnectionCallback ( PBXSession  sessionObject  ) 

Declaration of a callback function to be invoked if the connection to the PBX is lost.

Parameters:
sessionObject The session object for the PBX whose connection was lost.
void Open ( CSTAContext  threadContext  ) 

This method can be used to establish communication with a PBX device before any messages are actually sent to the device.

Parameters:
threadContext The thread context object.
SocketState SendACSEMessage ( byte[]  message,
int  messageLength,
Constants.ACSEMessageTypes  messageType,
CSTAContext  threadContext 
)

This method sends an ACSE message (either Make Association or Release Association) to the PBX and receives the response. This operation is done synchronously. If the Make Association needs to be done (usually it does), it must be done before any threads for sending and receiving CSTA messages are started.

This method is only intended to be used by client code that encodes its own ACSEMakeAssociation or ACSEReleaseAssociation message. Most clients can probably use the MakeACSEAssociation() and ReleaseACSEAssociation() methods that are in each phase's helper classes.

Parameters:
message An encoded ACSE Make Association or Release Association message.
messageLength The length of the encoded message.
messageType A constant telling whether the message is an ACSE Make Association or an ACSE Release Association.
threadContext The thread context object.
Returns:
A populated SocketState instance.
void SendMessage ( string  messageType,
byte[]  message,
int  messageLength,
CSTAContext  threadContext 
)

This method sends a message to the PBX using TCP/IP.

Parameters:
messageType A string token to help identify the message in the CSTADLL log file.
message Byte array containing the encoded message to send.
messageLength The length of the encoded message.
threadContext The thread context object.
void SendMessage ( byte[]  message,
int  messageLength,
CSTAContext  threadContext 
)

This method sends a message to the PBX using TCP/IP.

Parameters:
message Byte array containing the encoded message to send.
messageLength The length of the encoded message.
threadContext The thread context object.
void SendXMLMessage ( string  messageType,
string  strMessage,
CSTAContext  threadContext 
)

This method sends an XML message to the PBX using TCP/IP.

Parameters:
messageType A string token to help identify the message in the CSTADLL log file.
strMessage The XML message to send.
threadContext The thread context object.
void SendXMLMessage ( string  strMessage,
CSTAContext  threadContext 
)

This method sends an XML message to the PBX using TCP/IP.

Parameters:
strMessage The XML message to send.
threadContext The thread context object.
SocketState SendXMLSession ( string  strMessage,
Constants.XMLSessionMessageTypes  enmMessageType,
CSTAContext  threadContext 
)

This method sends an XML session management (ECMA-354) message to the PBX.

Parameters:
strMessage The text of the XML message to send.
enmMessageType A constant indicating what kind of session management message is being sent.
threadContext The thread context object.
Returns:
A populated SocketState instance if the message is a StartSession message. Null if the message is StopSession or ResetSession.
void WaitForROSEResponse ( CSTAContext  threadContext  ) 

This method waits for a response to a CSTA message sent with a ROSE header.

Parameters:
threadContext The CSTAContext object associated with the calling thread.
void WaitForXMLResponse ( CSTAContext  threadContext  ) 

This method waits for a response to an XML CSTA message.

Parameters:
threadContext The CSTAContext object associated with the calling thread.
delegate void XMLAsyncCallback ( PBXSession  sessionObject,
string  message 
)

Declaration of a callback function to be invoked when an asynchronous XML message is received, such as from a monitor session.

Parameters:
sessionObject The session object for the PBX that generated the asynchronous message.
message The text of the message received asynchronously from the PBX.

Property Documentation

AsyncCallback ClientCallback [get, set]

Holds a reference to an asynchronous callback function. This function will be invoked if data is received asynchronously from the PBX, such as from a monitor operation.

ConnectionCallback ConnectionLostCallback [get, set]

Holds a reference to an asynchronous callback function. This function will be invoked if the connection to the PBX is lost.

bool DebugClientCallback [get, set]

Enables easier debugging of asynchronous callback methods. If set to true, the read for the next message from the PBX won't occur until after the client callback method returns. Normally the read for the next message occurs before the client callback method is invoked. The default value for this property is false. This property must be set to false in order to send CSTA messages from a callback method.

bool DebugMode [get, set]

Enables behavior that facilitates debugging of the CSTADLL software. This property is most likely useful only to Objective Systems staff.

AsyncExceptionCallback ExceptionCallback [get, set]

Holds a reference to an asynchronous callback function. This function will be invoked if a condition occurs in the asynchronous I/O handler that otherwise would have resulted in an exception being thrown if this callback were not defined. Note that in a couple of cases the asynchronous code will still throw an exception, even if this callback is defined.

int MaxReceiveTimeout [get, set]

Specifies the amount of time, in milliseconds, to wait for a respone to arrive from the PBX. The default value is 5,000 milliseconds (5 seconds).

Constants.Encoding MessageEncoding [get, set]

Indicates how messages exchanges with this PBX are encoded.

string PBXSystem [get]

The TCIP/IP address or well-known name of the PBX.

int Port [get]

The port where the PBX listens for CSTA messages.

AsyncCallback SystemStatusCallback [get, set]

Holds a reference to an asynchronous callback function. This function will be invoked if a BER System Status message is received asynchronously from the PBX. The client application does NOT need to send a System Status Response, since that is taken care of by CSTADLL.

XMLAsyncCallback XMLClientCallback [get, set]

Holds a reference to an asynchronous XML callback function. This function will be invoked if an XML message is received asynchronously from the PBX, such as from a monitor operation.

XMLAsyncCallback XMLSystemStatusCallback [get, set]

Holds a reference to an asynchronous callback function. This function will be invoked if an XML System Status message is received asynchronously from the PBX. The client application does NOT need to send a System Status Response, since that is taken care of by CSTADLL.