CSTADLL
2.1.2
The CSTADLL product is a Microsoft .NET 4.0 DLL that allows client code to use a single library to communicate with a PBX device, regardless of what CSTA phase that device uses. A version of the DLL built with .NET 3.5 is also provided in the kit.
The DLL uses the following namespaces:
-
Com.Objsys.Csta.Common
-
Com.Objsys.Csta.Devices
-
Com.Objsys.Csta.Phase1
-
Com.Objsys.Csta.Phase2
-
Com.Objsys.Csta.Phase3
The Com.Objsys.Csta.Common
namespace contains classes that are common to all CSTA phases.
The Com.Objsys.Csta.Devices
namespace contains classes that allow a caller to use specific PBX devices.
The Com.Objsys.Csta.Phase(n)
namespaces contain classes that are specific to the indicated phase. Most of these classes are generated by ASN1C from the CSTA and ACSE ASN.1 specifications. These generated classes are not documented here, but you can consult the ASN1C C# User Guide for information about how ASN.1 constructions are translated into C# classes.
Each namespace also contains several classes that are not generated by ASN1C. These classes are the ones documented in this manual.
The DLL allows a client to have a session with a single PBX system, during which the client can send ACSE and CSTA messages to the PBX and receive responses.
A typical way to use the DLL is to use the PBXSession
class to set up the communication to the PBX system via the constructor. If the PBX will be sending asynchronous data, such as monitor packets, to the client, the ClientCallback
property can be used to define a callback method to receive the asynchronous data. If no callback method is defined, asynchronous data will be ignored.
The CSTADLL kit includes several samples to guide you in writing your own code. The name of the sample conveys some information about the sample. If the name of the sample starts with DLL, it means the sample shows how to use one of the helper methods that the DLL exposes. If the name of the sample starts with CSTA, then that sample still shows a way to make use of the DLL, but instead of using one of the DLL's helper methods, the sample instead shows how to use the DLL to send to a PBX a CSTA message for which the DLL doesn't expose a helper method.
After either DLL or CSTA in the sample name is an indicator of what language the sample is written in. Cs is used to indicate that the sample is written in C#. Vb will be used to indicate that the sample is written in Visual BASIC. Similar codes will be used if samples are provided in other languages; e.g., perhaps CppCLI for samples written in C++/CLI.
For example, the sample DLLCsAnswerCall is a sample that shows how to use one of the DLL's helper methods in C# to instruct a PBX to answer a call. The sample CSTACsButtonPress shows how to use the DLL with C# to send a PBX the CSTA ButtonPress message, for which there is no exposed helper method.
The classes and methods exposed by the all-phases DLL within the CSTADLL package are probably sufficient to handle ACSE and CSTA operations for most PBX devices. But if needed, you can write a class of your own to handle ACSE and CSTA operations for a PBX device that the CSTADLL software doesn't explicitly support. The sample DLLCsNewPBX shows how this might be accomplished. This sample contains code for a small separate DLL that could be used to support a fictitious PBX device called the AwesomePBX100. The assumption in the sample is that this device uses standard phase 2 messages for all operations except for the ACSE make association message. This message is the one message that is most commonly different from one PBX to the next. The DLLCsNewPBX sample shows how the MakeACSEAssociation method within the GenericCSTAp2 class (the lowest level base class for this sample) can be overridden in a class that you can write. The override implementation handles the details that are specific to the device. Other methods within GenericCSTAp2 could also be overridden as needed.
The all-phases DLL can log message traffic between a client program and the PBX device if so desired. The logging is controlled by the LoggingEnabled
property with the PBXSessionHelper
class. The logging is off by default. Both of the provided sample clients enable the logging. The log file used is named cstadll_<program>.log
, where <program> is the name of the executable image that is using the DLL. The location of the log file is the folder where the executable image resides. If the log file grows to more than 5 Mb, it is copied to cstadll_<program>.backup.log
, and a new log file is opened. If there is already a file with the backup file name, it is overwritten.