Integration of Nexus Cube API to the CTI Toolkit for a Web-based SoftPhone

I. Architecture

The Web SoftPhone interface from can integrate proprietary CTI software by using the CTI Toolkit of This requires insertion of API functions within the codes of CTI adapter. The CTI adapter serves a template for integration of CTI functions. The CAPI of NEXUSCUBE is used in the CTI solution which is written in C/C++. CAPI is used by application programs to call CTI functions and to read events inside the telephony system of a PBX.

This report is about our activities and findings in integrating CAPI to the CTI adapter of so that the CTI functions in NEXUSCUBE can be implemented to the Web SoftPhone. The real time events in CTI are sent by the adapter to Web SoftPhone like dialing, receiving calls and end calls. The illustration below (Figure 1) shows the integration of Nexus CAPI using the CTI adapter. Functions from CAPI are coded inside the modules of CTI Adapter.


< Figure 1. Architecture of CTI implementation in the Web using a CTI adapter >

The HTTP server logical functions are hidden in the servers. The Web SoftPhone is implemented in HTML and JavaScript for the use of agents in call center. To communicate with the HTTP server, a BrowserListener is used which is coded in C#. The BrowserListener establishes a mini web server in the local computer system and uses the CTI adapter to interact with CTI. The CTI adapter is contained with modules for the CTI events and an interface for the Web SoftPhone interactions. Also, the customization of the Web SoftPhone is done within the codes of the interface module.

II. CTI Adapter Components and CAPI Functions

This section discusses the components of CTI adapter (A) and function integration of the CTI using CAPI (B).

A. Components of CTI Toolkit

BrowserConnector – this project is consisted of modules to communicate with the web server and client browser. This is also linked to the CTI adapter to get events and send commands from CTI

CTIAdapterLib –this project is consisted of modules to convert XML messages to CTI command messages. The messages from Web SoftPhone are mapped inside the library and then commands are processed in the CDemoAdapter to interact with the CTI. Moreover, the variables for customization of the Web SoftPhone are located in this library.

CDemoAdapter - this project is the place where CTI functions are integrated. It consists of two modules to integrate the interaction of CTI which is specified in the following:

BrowserConnector – this project is consisted of modules to communicate with the web server and client browser. This is also linked to the CTI adapter to get events and send commands from CTI

· DemoEventSink – this module is used to listen with events and triggers change of interface in the Web SoftPhone according to the event it received.

· DemoUserInterface – this module is used to integrate CTI function through its API. Moreover, the customization of Web SoftPhone is done in this module.

B. CAPI Functions and its Mapping to CTI Adapter

nxcapiOpenServer – this function is integrated in the CDemoUserInterface::CTIConnect

nxcapiCloseServer – this function is integrated in the termination line of CDemoEventSink::ReceiveGetEvent which is triggered by CDemoEventSink::StopReceivingEvent

nxcapiMonitorStart– this function is integrated in the CDemoUserInterface::CTIConnect

nxcapiMonitorStop– this function is integrated in the termination line of CDemoEventSink::ReceiveGetEvent triggered by CDemoEventSink::StopReceivingEvent

nxcapiMakeCall – this function is integrated in the CDemoUserInterface::OnCallDialing

nxcapiClearConnection – this function is integrated in the CDemoUserInterface::OnCallEnd

nxcapiAnswerCall – this function is integrated in the CDemoUserInterface::CallAnswer

nxcapiGetEvent– this function is integrated in the CDemoEventSink::ReceiveGetEvent looped by a switch case

nxcapiDelivered– this is a state of a call where a call is not yet answered. This state is mapped in the loop event of CDemoEventSink::ReceiveGetEvent and triggers the ringing state of Web SoftPhone

nxcapiEstablished - this is a state of the call where a call is answered and triggers the call answered state of the Web SoftPhone

III. Communication of Components

The communication from the web server ( to BrowserListener (mini web server) uses the AJAX and REST in exchanging messages. Although the web server functions are completely hidden, the common functions of an HTTP server can be viewed in ProcessRequest procedure of BrowserListener written in C#. Moreover, the connector page (ConnectorPage.html) of the mini web browser contains Javascript codes in performing AJAX functions. Figure 2 shows a sample format of XML message used by the BrowserListener.

        <PARAMETER  NAME=”DN” VALUE=”1234”/>    

< Figure 2. A sample format of XML message >

The messages passed from BrowserListener to CTI adapter are mapped using the module in CTIUserInterface. In the module of CTIUserInterface, the messages are parsed and processed by a mapping in UIHandleMessage procedure. Variables to map each message command are defined in a header module. The mapping of XML message in figure 2 is transformed into string arrays shown in Figure 3.

    std::wstring  message = DIAL
    PARAM_MAP (map<std::wstring, std::wstring >)  mapInfoFields
    mapInfoFields[KEY_DN] = KEY_1223
    mapInfoFields[LINE_NUMBER] = KEY_1

< Figure 3. A sample format of an adapter command message >

IV. Implementation

Following are the equipments we used to test and integrate our CAPI and CTI toolkit:

PBX servers ( and

NEXUSCUBE Test Program

CAPI header files (.h) and libraries website

The proponents who were involved in this activity are the following:

Mike – team leader and activity coordinator

Eric – CAPI expert integrator

Mark – assigned to integrate CAPI to the CTI Adapter

This activity was done by the following procedures.

1. Analyzed the workflow of the programs in CTI Toolkit

2. Familiarized with the modules of CTI Adapter

3. Studied the CAPI and the basic functions to integrate to the Web SoftPhone

4. Identified the line of codes where to insert the codes of CAPI

5. Started integrating CAPI functions to CTI Adapter

6. Debugged each function

7. Finalized and completed the basic functions of CAPI

In Figure 4, the workflow of each module from CTI Toolkit is shown. There were three workflows identified in Figure 4 which are the 1) initialization of both CTI adapter and web client program, 2) CTI to web event and 3) web event to CTI. We observed that the CTI adapter and web client browser are required to be executed. The Web SoftPhone will not be displayed until CTI Adapter is detected running in the local computer. In the CTI to Web Event, the CTI adapter continuously reads the event. Each event is mapped using a switch case to trigger the UIRefresh. In the Web Event to CTI interaction, every interaction from Web Softphone like clicking its dialing buttons is sent to BrowserListener and then the BrowserListener will send this to the CTI adapter to process a function to the CTI.


< Figure 4. Work flow of the Web SoftPhone and CTI Adapter with CAPI integration >

In our activity, the main functions were only considered in the implementation to test a two way communication which includes the initialization functions like Open/Close Server and Start/Stop Monitoring. The functions MakeCall, AnswerCall and CloseConnection were integrated into the CTI adapter. Figure 5 illustrates the summary implementation of these functions.


< Figure 5. Implementation of the Web SoftPhone using CTI Adapter >

V. Conclusion

In this report, our CTI solution was successfully implemented to the Web via the CTI adapter. Functions in Nexus CAPI were coded inside the CTI adapter to use the function of CTI. We found out that a mini web server was needed to communicate with the web server and change the Web SoftPhone interface. AJAX and REST were also used to transfer message to the CTI Adapter where these messages were mapped within the interface module to process the CTI functions. The integration only considered the main functions of the CTI where in other functions for agent monitoring and call routing are still in progress.