CAS ActiveX Interface

CAS Overview

The CAS ActiveX interface provides methods that create and manage CAS taglists, exchange taglists with NET SatisFAXtion servers, and provide debugging assistance during application development.    CAS ActiveX controls (available from the Downloads section of this website) must be installed on a computer before using the ActiveX interface.

When you are ready to send your first fax, make sure that you have examined the CAS Samples on this website.  The CAS Samples provide live demonstrations and example source code for the most commonly used CAS functions.  See the CAS Tags page for a listing of available CAS function and data tags.

Accessing the CAS ActiveX Interface

The first thing an application needs to do is create a reference (or pointer) to the CAS ActiveX interface, and then save that reference so that it can be used globally throughout the application.  All CAS ActiveX methods are available to an application once the reference to the interface has been created.  Although a single, global CAS reference should suffice, there is no harm in creating multiple references to the ActiveX interface within the same application.

The following examples demonstrate accessing the CAS ActiveX interface from VBScript, JavaScript, C++, and C# (.NET).  Although each language has a unique method of accessing the ActiveX interface, all languages use the interface similarly.


Select language: 
function AccessCAS()
  {
  var CAS, Instance, Tl;
  
  if (CAS = new ActiveXObject("CASX.CAS"))
    {
    if (Instance = CAS.Open(0,"",0))
      {
        // Create a taglist and delete it

      Tl = CAS.New();
      CAS.AddTag(Tl,"SUBJECT","Just an example");
      CAS.Delete(Tl);
      
      CAS.Close(Instance);
      }  
    delete CAS;
    }
  }

Working with Taglists

Taglists are constructed by first creating an empty taglist with the New method.  Tags are then added to the taglist with the AddTag method.  The only case when tag order is important involves the first tag in a taglist, which is typically a function tag. Tags are added to a taglist sequentially; there is no capability to insert a tag at a specific location.  As tags are added, the CAS driver increases the memory allocation for the taglist as necessary to include all tags and tag data.

Tl = CAS.New();
CAS.AddTag(Tl,"SEND_MESSAGE",0);
CAS.AddTag(Tl,"REGISTERED_NAME","User1");
CAS.AddTag(Tl,"REGISTERED_PASSWORD","");
CAS.AddTag(Tl,"TRANSFER_TYPE",0);

Sections are created by calling the CreateSection method.  Tags are added to section taglists with the same AddTag method. The section is closed by calling the CloseSection method.  Once a section is closed, no more tags can be added to it, but more tags and sections can be added to the root of the taglist.

Sl = CAS.CreateSection(Tl,"RECEIVER_ADDRESS","555-123-4567");
CAS.AddTag(Sl,"RECEIVER_NAME","MyRecipient");
CAS.CloseSection(Sl);

To work with response taglists from the fax server, the GetTag method is used to search for tags in taglists and to retrieve tag data.

stat = CAS.GetTag(Tl,"STATUS_NUM",0);

Tags within sections are accessed by first opening the section with the OpenSection method.  Once a section taglist is no longer needed, it is closed using the CloseSection method.

Sl = CAS.OpenSection(Tl,"MESSAGE_HANDLE[0]");
Handle = CAS.GetTag(Sl,"MESSAGE_HANDLE",0);
CAS.CloseSection(Sl);

CAS Communications

Once an application has a reference to the CAS ActiveX interface, it must call the Open method to establish a CAS "instance".  An instance maintains the identity of the CAS client on the network, and the state of the network session between the client and NET SatisFAXtion. The instance handle returned from the Open method must be saved such that it can be accessed throughout an application, as it is a required parameter for the Send method.  Before a CAS client terminates, it must pass the CAS instance handle to the Close method.

if (CAS_Instance = CAS.Open(0,"",0))
   {
     // Prepare and Send taglists...
 
   CAS.Close(
CAS_Instance);
   }

The Send method sends a function taglist to the CAS driver, to be processed by the CAS driver locally, or to be processed remotely by a NET SatisFAXtion server.  The state of the CAS instance determines whether the taglist is processed locally or remotely.  The taglist passed to the Send method is deleted as part of being processed by the CAS driver. The return value from the Send method is a new taglist containing the response from the function.  When the application is finished with the response taglist, it must be passed to the Delete method.

Response_Tl = CAS.Send(CAS_Instance,Send_Tl);

The CAS function tags LOGONOPEN_SESSION, CLOSE_SESSION and LOGOFF are used for session management, and are always processed by the local CAS driver.  All other function tags are ignored by the local CAS driver, but are significant when they reach a NET SatisFAXtion server.

CAS ActiveX clients initiate connections with NET SatisFAXtion servers in a two-step process:

  • First, the client logs on to a NET SatisFAXtion domain with the LOGON function.  Every NET SatisFAXtion domain includes a connection router that acts like a switchboard, connecting clients to the server that they want to communicate with.

    Tl = CAS.New();
    CAS.AddTag(Tl,"LOGON","");
    CAS.AddTag(Tl,"LOGON_NAME","MyUniqueLogonName");
    CAS.AddTag(Tl,"DOMAIN_NAME","\\\\CASDEV\\NETSATISFAXTION");
    CAS.AddTag(Tl,"PROTOCOL",2); // IP

    Tl = CAS.Send(
    CAS_Instance,Tl);
    StatusNum = CAS.GetTag(Tl,"STATUS_NUM",0);
    CAS.Delete(Tl);
        
    if (StatusNum == 0)
      {
        // Logged on
      }

  • Second, the client opens a session with a specific server within the NET SatisFAXtion domain using the OPEN_SESSION function.

    Tl = CAS.New();
    CAS.AddTag(Tl,"OPEN_SESSION","");
    CAS.AddTag(Tl,"REMOTE_LOGON_NAME","NETSATISFAXTION");
      
    Tl = CAS.Send(
    CAS_Instance,Tl);
    StatusNum = CAS.GetTag(Tl,"STATUS_NUM",0);
    CAS.Delete(Tl);
          
    if (StatusNum == 0)
      {
        // Session is open
      }

After a successful LOGON and OPEN_SESSION, the client sends a function taglist to the server, and the server replies.  If the client has more taglists to send, either immediately or in a short time, it can send repeatedly on the same session.

When the client has no more to send to the server, it closes the session with the CLOSE_SESSION function.  If the session is inadvertently left open, it will eventually time out.  If the client is completely done sending to the server, it logs off to release all network resources, with the LOGOFF function.

Tl = CAS.New();
CAS.AddTag(Tl,"CLOSE_SESSION","");
Tl = CAS.Send(
CAS_Instance,Tl);
CAS.Delete(Tl);
      
Tl = CAS.New();
CAS.AddTag(Tl,"LOGOFF","");
Tl = CAS.Send(
CAS_Instance,Tl);
CAS.Delete(Tl);

The following diagrams illustrate the different types of connections that CAS ActiveX clients can make, based on the protocol being used.

    Client Runs on Server
    Client <-- Direct Memory --> Fax Server
    Client Connects to Server Over Local Area Network
    Client <-- IP/NetBIOS --> Fax Server

CAS ActiveX Methods

Select a link below for a detailed description of a CAS ActiveX method.

Returns Method Parameters
Initialization
LONG  Open Mode, DebugFile, MinBufSize
VOID Close Instance
Communication
LONG  Send Instance, TagList
Primary Taglist Handling
LONG  New None
LONG  AddTag TagList, TagName, TagData
VOID Delete TagList
BSTR  GetTag TagList, TagName, TagIndex
LONG  GetTagCount TagList, TagName
LONG  CreateSection TagList, TagName, TagData
LONG  OpenSection TagList, TagPath
VOID CloseSection TagList
LONG  GetSectionCount TagList, TagName
Advanced Taglist Handling     (Most applications do not require these Advanced methods.)
LONG  GetTagId TagName
LONG  GetTagType TagName
BSTR GetTagName TagId
LONG  GetTagHandle TagList, TagName, TagIndex
BSTR GetTagData TagHandle
LONG  GetTagDataLength TagHandle
LONG  GetTagDataType TagHandle
LONG GetIdFromHandle TagHandle
VOID RetTagHandle TagHandle
VOID DeleteTag TagHandle
Utility
LONG  DupTagList TagList
VOID DumpString Str
BSTR DumpTagList TagList, Header
BSTR GetDbgDump None
BSTR EncryptOnce Password
VOID Sleep Milliseconds

CAS ActiveX Controls

When CAS ActiveX is installed, a small ensemble of files are included that provide CAS taglist and utility functions, as well as CAS networking services.  The CAS ActiveX controls are copied to the directory "\Program Files\Common Files\FaxBack Shared\CASx".  These shared files remain in this directory until all applications that use CAS are uninstalled.  The core CAS ActiveX modules are as follows:

CASx.dll CAS ActiveX interface
CAS20.dll CAS 2.0 driver
WKTags.dll CAS tag database of "well known" tags
NETx32.dll Communications driver for IP, NetBIOS and IPX protocols
HTMLHelp.dll Run-time library for CAS application development
FaxBackX.dll Methods to assist applications that use the CAS XML interface

CAS ActiveX controls can be installed from the Downloads section of this website.