Asterisk integration basics
The functionality is relevant to Classic UI.
Use AMI (Asterisk Manager Interface) to interact with the Asterisk server. The API enables client programs to connect to Asterisk server by using TCP/IP protocol. The Application Programming Interface enables you to process events in the digital multiplex system (DMS), and send commands to control calls.
Currently the integration of Creatio with Asterisk is supported up to version 13.
A client uses a simple text protocol for communication between the Asterisk and the connected Manager API: "parameter: value". The end of a string is determined by the sequence of Carriage Return and Line Feed (CRLF).
In the future, for a set of strings like "parameter: value", followed by a blank line containing only a CRLF, for simplicity the term "package" will be used.
Set up the configuration file of the Messaging Service to integrate Asterisk to Creatio
For integration to work with Creatio, you need to install Terrasoft Messaging Service (TMS) on a dedicated computer that will be used as the integration server. You must set the following parameters for Asterisk in the Terrasoft.Messaging.Service.exe.config
configuration file:
<asterisk filePath="" url="Name_or_address_of_Asterisk_server" port="Asterisk_server_port"
userName="Asterisk login" secret="Asterisk password" originateContext="Originate context" parkingLotContext="Parking lot context"
autoPauseOnCommutationStart="true" queueExtensionFormat="Local/{0}@from-queue/n" asyncOriginate="true" sendRingStartedOnRingingState="true"
traceQueuesState="false" packetInfoConfig="Additional package parameters to be processed in configuration" />
Ports for Asterisk integration with Creatio
- TMS accepts WebSocket connection to the 2013 port via TCP.
- TMS connects to the Asterisk server by default via the 5038 port.
The Terrasoft Messaging Service for Asterisk integration with Creatio
The integration part of the Messaging Service is implemented in the main Creatio solution kernel in the Terrasoft.Messaging.Asterisk
library.
Library main classes:
AsteriskAdapter
– an Asterisk class that transforms events to the top-level call model events used in Creatio integration.AsteriskManager
– a class that creates and deletes user connections to the Asterisk server.AsteriskConnection
– a class that represents the user connection for integration with Asterisk.AsteriskClient
– a class used to send commands to the Asterisk server.
Example of CtiModel, Terrasoft Messaging Service and Asterisk Manager API interaction
Operator outgoing call to a subscriber: putting a call on hold, putting off hold by a subscriber and finishing the call by the operator.
The order of events during a call for the current example:
The table shows an example of event processing including how the event data is interpreted by TMS and which values from the listed events are used when processing an incoming call.
Asterisk log | TMS | Action | Client |
---|---|---|---|
| A channel is created and added to a collection
| ||
| Search for the channel by | PutHoldAction | Processing the PutHoldAction and displaying the call on hold. |
| Search for the channel by | EndHoldAction | Processing the EndHoldAction and displaying the call on hold. |
| Search for the channel by | RingFinished | Processing event and displaying the call end. |
| Search for the channel by | RingStarted | Processing the |
| Search for the channel by | CommutationStarted | Processing the CommunicationStarted event and displaying the communication. |
Clicking the "Answer" button initiates a new event in Asterisk. |
Asterisk events
A detail list of events and information about their parameters is described in the Asterisk documentation.