SDK for communication between Asterisk and 1C: Enterprise 8

    For more than 3 years, we have been trying to configure the competent integration of 1C: Enterprise 8 and an Asterisk-based telephone exchange for our office. Whatever decision we take, we always get some crutches. This is very upsetting. But there really wasn’t a normal integration solution on the market. We tried different products, free and paid, spending more than one 10-thousand thousand rubles, but happiness did not come.

    Do you want it to be done well - do it yourself

    Actually, after another unsuccessful attempt, the idea of ​​doing everything from scratch on our own grabbed our mind, especially since the implementation lay on the surface itself, it was only necessary to take and do it.
    We decided that it is best to create a universal solution that is not tied to a specific 1C task. We need a "transparent proxy" from 1C to Asterisk and vice versa, with which, in the future, we will assemble our dream telephony panel, which we have been dreaming about 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 its own 1C: Enterprise 8 system programming interface. It supports the Windows and Linux operating systems, and makes it possible to create external components that work both under one and under another operating system. Components created using the Native API technology can be connected in the thick client, in the thin client, in the web client, in the external connection, and in the application server.

    Therefore, we, armed with the freshly purchased Visual Studo 2010, began to dive into the creative programming process.

    AJAM Asterisk interface

    For about a month, we studied various technologies for interacting with Asterisk external systems, tested, measured performance, and finally decided that “Asynchronous Javascript Asterisk Manger” suits us best. AJAM uses the HTTP protocol as a transport, supports Digiest authentication and SSL encryption, which increases the security of the connection, and also allows you to use 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 piecemeal a list of commands with a description of the parameters, a list of answers. Sometimes I had to read the listings of the Asterisk source code in order to understand how this or that command should look and what to pass in the parameters. We decided that development should be well-documented so that all methods and functions are described in one place. As a result, we had WIKI, in which we collected all the documentation on the Asterisk AMI protocol, and then based on these data we systematized a description of the internal functions of the developed component.

    What happened

    As it turned out, although the solution 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 component initialization in 1C, the whole range of Asterisk AMI commands becomes available, if memory serves me well, then a total of 103 functions.
    For example, the original call from 1C from the SIP / 26 number to the city 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";

    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 we can catch the state of the channels , information about the calling number, the status of the queues and even manage real-time call routing.

    A new level of interaction 1C and Asterisk

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

    Commercial product and affiliate network

    We liked to develop, describe, test a solution for integrating 1C and Asterisk. We decided not to stop and release our component as an SDK for 1C developers. We were engaged in product certification at 1C for 1C status: Compatible. Developed agent and affiliate programs.

    Component Demonstration

    Links to more detailed information

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

    Also popular now: