📜 ⬆️ ⬇️

SDK for Asterisk and 1C: Enterprise 8 communication

For more than 3 years, we have tried to set up a competent integration of 1C: Enterprise 8 and a telephone PBX based on Asterisk for our office. For whatever decision we took, there were always some crutches. This is very sad. But there really wasn’t a normal integration solution on the market. We tried different products, free and paid, having spent more than one ten thousand rubles, but there was no happiness.

Do you want to be done well - do it yourself


Actually, after another unsuccessful attempt, the idea to do everything from scratch on our own, captured our mind, all the more, the realization lay on the surface itself, it was necessary only to undertake and do it.
We decided that it is best to create a universal solution that is not tied to a specific task on 1C. We need a “transparent proxy” from 1C to Asterisk and back, with the help of which, in the future, we will assemble our panel of telephony of dreams, about which we have been dreaming for 3 years.

NativeAPI technology


The 1C: Enterprise 8 platform allows the connection of external modules in the form of dynamic libraries, but there are special requirements for the libraries themselves. According to the requirements of 1C, the library should be developed using NativeAPI technology.

The Native API technology is a proprietary system programming interface 1C: Enterprise 8. It supports Windows and Linux operating systems, and allows you to create external components that work under one or under another operating system. Components created by the Native API technology can be connected in a thick client, in a thin client, in a web client, in an external connection, and in an application server.
')
Because we, armed with the freshly bought Visual Studo 2010, began to dive into the creative programming process.

Asterisk AJAM Interface


For about a month, we studied various Asterisk interfacing technologies with external systems, experimented, measured performance, and eventually decided that “Asynchronous Javascript Asterisk Manger” was best for us. AJAM as a transport uses the HTTP protocol, supports Digiest authentication and SSL encryption, which increases the security of the connection, and also allows the use of Asterisk, located in the cloud. The answers transmitted by the Asterisk server can be represented as XML structures, which are very convenient to work with in 1C: Enterprise 8.

Asterisk and component documentation


On the Internet, you can find a lot of scattered knowledge about Asterisk, but in one place they are not, and we had to collect in parts a list of commands with a description of parameters, a list of answers. Sometimes you had to read the Asterisk source code listings in order to understand how this or that command should look and what to pass in the parameters. We decided that the development should be well documented so that all methods and functions were described in one place. As a result, we got WIKI, into which we collected all the documentation for the Asterisk AMI protocol, and then, on the basis of this data, systematized the description of the internal functions of the developed component.

What happened


As it turned out, although the decision lay on the surface, the entire development and writing of documentation took more than 3 months of work of several highly qualified specialists.



As a result, after initializing the components in 1C, the whole range of AMI commands of Asterisk becomes available, if my memory serves me, then a total of 103 functions.
For example, the origin of a call from 1C from SIP / 26 to city number 74952293042 looks like this:

Channel = "SIP / 26"
Context = "from-internal";
Exten = "74952293042";
Priority = "1";
Timeout = "";
CallerID = "MIKO_Abonent";
Variable = "";
Account = "miko";
Application = "";
Data = "";
Async = "1";
ActionID = "114";
Result = "";

Component .Originate (Channel, Context, Exten, Priority, Timeout, CallerID, Variable, Account, Application, Data, Async, ActionID, Result)

During an active connection, the component calls external event handlers in 1C, so that we can catch the state of the channels, information about the calling number, the status of queues, and even manage the call routing in real time.

New level of interaction 1C and Asterisk


As a result, we moved to a new level of development of 1C business solutions integrated with Asterisk-based telephony. Now the 1C developer can use all the available PBX functionality in the 1C: Enterprise 8 environment that is clear to him, and the solution functionality is limited only by his imagination.
As a sample, based on the components, we developed the Asterisk Telephony Panel for 1C: CRM, which we use in our company, added client smart routing to the responsible manager using only 1C logic, taught the panel to save the conversation record in the Event document , worked out the mechanisms for transferring call history from Asterisk to 1C, as well as managing various call forwardings and calls directly from 1C: Enterprise 8. We got a rather convenient telephony panel, and after 3 years of throwing we created what we wanted from Initially from third-party developers.

Commercial product and partner network


We liked to develop, describe, test the solution for the integration of 1C and Asterisk. We decided not to stop and release our component as an SDK for 1C developers. Engaged in product certification in the company 1C on the status of 1C: Compatible. Developed agency and partner programs.

Demonstration of the component




Links to more detailed information




upd. February 24, the SDK was certified for 1C: Compatible . As a result, we made the first 1C certified solution for integrating 1C and Asterisk.

Source: https://habr.com/ru/post/137999/


All Articles