Saint Petersburg
Lev Tolstoy st, №1-3, Saint Petersburg, Russian Federation, 197022
Mon-Fry, 9:00 - 18:00 (local time)
Sat-Sun, 10:00 - 18:00 (local time) Time zone: UTC+3
Barnaul
Depovskaya st, 7, office A1-116, Barnaul, Russian Federation, 656015
Mon-Fri 9:00 - 18:00 (local time)
Sat-Sun 10:00 -16:00 (local time) Time zone: UTC+7
CONTACT US
Follow us
Leave a request to get advice from our specialists without leaving the office

Configuring Asterisk PBX for integration with 1C

21.03.2018

Why integration is needed

When integrating 1C and Asterisk PBX, you get the opportunity to receive and make calls from 1C, listen to call recordings, see information about the company of the person calling you, and much more. In integration, work should be carried out from two sides: from the 1C side and from the Asterisk side. In this article, we will share what needs to be configured on the Asterisk server side.

 

A few words about port forwarding

As a rule, the entire system runs on the internal network of the enterprise and port forwarding is not required. However, during development and testing, it may be necessary to connect to individual system components "outside" the internal network. In order for this to become possible, you need to forward the appropriate server port from Asterisk. After the completion of development and testing, they can be closed, if in your case the system works completely in the internal network of the enterprise. There are many instructions on the internet on how to do this.

The scheme by which, in this case, the exchange of information will be carried out, is presented below. For greater security, it is recommended that you change the port to which requests will be sent from outside the network to prevent targeted attackers. An attacker would not understand that the open port belongs to AMI, MySQL, or some other service.

 

1. Setting up AMI

AMI is a programming interface through which you can receive events from Asterisk. Examples of such events are, for example, the beginning or end of a conversation. We receive the call start event and can show the counterparty card if the phone number is found in the database. You can also make calls directly from 1C.

In order for this functionality to be available, you need to create an AMI “manager” and provide information on how to connect to the PBX. For our part, we will set up communication between 1C and Asterisk.

The default port for AMI is 5038 via tcp protocol.

 

2. Setting the download of records

In order for the download of conversation recordings to work, you need to configure the server that will distribute these files. The Asterisk server must accept a GET request on port 5032, the path of which will contain the file name relative to the directory in which the conversation records are stored. The most desirable option is to store all records in one folder, but in our experience, this is not always the case. If Asterisk is located on the server with the address 192.168.0.13, then the conversation record with the name conversation-12345567.3245.wav, if all records are found in the same folder, should be downloaded by request 192.168.0.13:5032/conversation-12345567.3245.wav.

 

3. CDR Setting (Call Detailed Records)

CDR is a special table that records information about each conversation. Asterisk supports several CDR storage formats, but integration with 1C requires that this information be stored in some kind of relational database (the most popular option is MySQL). All you need is to install a DBMS server, create a database with a CDR table, configure ODBC and Asterisk to work with the database.

The default port for connecting to MySQL is 3306 via tcp. For other DBMS, refer to the technical documentation of the corresponding system.

 

4. Setting up a call plan

In order for the recordings of conversations to be listened to from 1C, a special context is needed that will be called from 1C. The context is usually called "1c-playfile" and has only one extension, which is reserved by Asterisk, s. Inside this dial plan, there must be a response and sequential playback of the files specified in the $ MSG (n) variable, where n is equal to the $ COUNT variable, also passed as an argument when invoking the AMI action.

In addition to the above, we need to know the context used for outgoing calls. If your dialing plan has complex logic for the formation of outgoing calls and there is no single context, then this can be solved with the include command, which includes the specified contexts in the general context. Moreover, using this method of organizing the recruitment plan is a beneficial practice in itself.

 

Conclusion

For more detailed information you can apply to the specialists of the ‘Automation Software Service’.

Яндекс.Метрика