Asterisk CTI Server

Posted: December 23, 2015 in TSAPI

Introduction

The astCTI is a CTI server for Asterisk. The astCTI uses ARI to monitor agent extensions, it hides the technical details of ARI and provides ActiveX, REST and WebSocket interfaces for front end application development. Currently, the astCTI program only supports the following functions:

  • StartMonitor – Start monitor of agent extension
  • StopMonitor – Stop monitor of agent extension

Testing Program

  • I have prepared a testing program called “AstClientVC.exe” which uses the ActiveX to connect to the astCTI, the screenshot of the program is
  • AstClientVC

Preparation and Password Encryption

  • The access MDB file stored the ARI username and password of Asterisk server. For security reason, a tool called encryptpasswd.exe is provided for you to generate an encrypted password for the installation and configuration of the software
  • Execute the program, generate an encrypted password for the ARI user of Asterisk server, then paste the encrypted password to the parameter ivr_tlink. For example, the encrypted password for “p@ssword” is “R3NIw1yJMLlnPFzEQtuh2A==”
  • encryptpasswd

64 bit Windows System 

  • For 64 bit Windows system, please follow the steps below
    • Download and install the Microsoft Visual C++ 2008 Service Pack 1 Redistributable Package MFC Security Update http://www.microsoft.com/en-hk/download/details.aspx?id=26368, select the x86 version
    • Configure ODBC System DSN using
    • C:\Windows\SysWOW64\odbcad32.exe
    • Stop the Windows firewall because it enables by default and I don’t have time to figure out what ports are required to open, you need to find them out by yourself.

 Installation

  • Download the astCTI zip file here.
  • Follow the installation steps below to install the software.
    • Extract all the files into directory c:\program files\astCTI
    • Open Windows Command Prompt, enter the following commands to register the program as Windows Service
      • cd c:\program files\astCTI
      • astCTI -i
    • Open ODBC Setting, create a System DSN called ASTCTICFG for Microsoft Access Driver and point to astcti.mdb which is located in the directory c:\program files\astCTI
    • Open the Access file, edit the value of parameters acti_tlink_01 and acti_tlink_02 to define the ARI parameters of your Asterisk servers in the tParameter table. The format is ip#port#app,username,encryptpasswd. For example, my setting is 192.168.1.124#8088#astcti,astcti,R3NIw1yJMLlnPFzEQtuh2A==
    • Start the Windows Service astCTI
    • Telnet to localhost and port number 14021, enter username tcpgate and password tcpgate01 to access the program console
    • Enter the following command to add extension and monitored by astCTI
      • add extension 101 PJSIP
      • Hint: add extension 101 and monitored by astCTI
      • Hint: extension 101 is using technology PJSIP
    • Enter the following command in the program console to modify the default technology type of added extension
      • update parameter acti_defaultexttype PJSIP
    • Enter the following command in the program console, you will receive debug information
      • trace on asc
    • Enter the following command in the program console, you will get the help message
      • help

Add Asterisk REST Interface User 

  • The following screenshot is for FreePBX only
  • addrestuser

REST Interface

  • Enter the following command in the program console to add an ActiveX interface port
    • add tcp 9001 * * custom astctirest
  • ACD Login
  • ACD Logout
  • ACD SetState
  • MakeCall
  • Answer
  • Hangup
  • Hold
  • Retrieve
  • Transfer
  • Conference
  • Consultation
  • Reconnect
  • Alternate
  • DTMF
  • UserData

ActiveX Interface

  • Enter the following command in the program console to add an ActiveX interface port
    • add tcp 9002 * * custom astctiapi

WebSocket Interface 

  • Enter the following command in the program console to add a WebSocket interface port
    • add tcp 9003 * * custom astctiws
  • WebSocket interface accepts JSON request, returns JSON response and delivers unsolicited JSON events
  • The JSON strings for MakeCall request and response are
  • The JSON strings for Hold call request and response are
  • The JSON strings for Retrieve call request and response are
  • The JSON strings for Hangup call request and response are
  • The JSON strings for Answer call request and response are
  • The JSON strings for Consultation call request and response are
  • The JSON strings for Reconnect call request and response are
  • The JSON strings for Alternate call request and response are
  • The JSON strings for Transfer call request and response are
  • The JSON strings for Conference call request and response are
  • The JSON strings to send DTMF request and response are
  • The JSON strings for ACD Login request and response are
  • The JSON strings for ACD Logout request and response are
  • The JSON strings for ACD SetState request and response are
  • The JSON strings for StartMonitor extension
    • {id: “15”, request: “startmonitor”, extension: “101”}
    • {msgtype: “response”, id: “15”, result: “success”, error: “”}
  • The JSON strings for StopMonitor extension
    • {id: “16”, request: “stopmonitor”, extension: “101”}
    • {msgtype: “response”, id: “16”, result: “success”, error: “”}
  • The JSON strings for Alert UserData request and response are
  • The JSON strings for Hangup UserData request and response are
  • Please refer this post for JSON events

Uninstallation

  • Stop the Window Service astCTI
  • Open Windows Command Prompt, enter the following commands to uninstall the program from Windows Service
    • cd c:\program files\astCTI
    • astCTI -u

Support and License

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s