Experience integrating IP telephony with helpdesk through a gadget for Windows 7

    Task


    So, we wanted a strange thing: an employee is sitting on a support desk, if he received a call, then you need to automatically open a window with the existing helpdesk system, into which the phone number from which they are calling will be transmitted. For convenience - the call came, the specialist immediately sees what kind of computer it is, what its network name, username, what kind of hardware / software / services ... There is already a database of employees and everything else with their phones, now how to connect it on the machine?

    Proposed solution


    I must say right away that we have implemented IP-telephony on FreeSWITCH and the solution will be tailored for it.
    To contact helpdesk, it’s enough for us to call a browser window with a specific address bar to which the caller’s phone number should be added. Something like, for example: myserver.org/helpdesk/requests.php?command=new&phonenum=1072
    FreeSWITCH has a wonderful mod_event_socket module that allows you to communicate with FreeSWITCH through sockets. I wrote a PHP script that sits on a web server (it does not have to be on the same machine as FreeSWITCH), connects to FreeSWITCH and subscribes to receive call events.
    Next, we have a client HTML + Javascript + jQuery file that runs on the client on the machine and accesses this script (AJAX). After receiving the call event, another browser window is launched with a specific address to which the caller’s number is also transmitted.
    And another small point: every time I do not want to run this file, I need it to sit somewhere not very noticeably. It’s necessary - we’ll do it, but this was done by creating a gadget for Windows 7 / Vista. Well, it happened like this - we do not have Linux workstations. In principle, one could, of course, write a special program that would sit in the tray and do everything, but, but, I can’t give a logical explanation why I didn’t.
    Everything turned out quite small, I called this beast FreeSWITCH call popup (fscp).

    Server side


    The server part is made with one simple PHP script: fscp.php
    It can be hosted on any web server that has access to FreeSWITCH.
    Access is via mod_event_socket.
    At the very beginning of the file, variables are defined whose values ​​must be filled out from the autoload_configs / event_socket.conf.xml file:
    $FreeSWITCHserver = '127.0.0.1';	// параметр listen-ip
    $FreeSWITCHport = 8021;			// параметр listen-port
    $FreeSWITCHpassword = 'ClueCon';	// параметр password
    Of course, do not forget to include mod_event_socket in autoload_configs / modules.conf.xml
    To connect to FreeSWITCH we use inbound socket.
    We connect and subscribe to receive events:
    event plain ALL
    We set two filters:
    filter Event-Name HEARTBEAT
    filter Caller-Destination-Number account
    A heartbeat event in FreeSWITCH is generated every 20 seconds. We use it in order not to exceed the maximum execution time of the PHP script (max_execution_time) in the wait loop for the event from FreeSWITCH and exit the loop correctly.
    Further in the loop, we expect the event to arrive from FreeSWITCH. If the CHANNEL_CREATE event arrives, then we wrap it in a JSON response and forward it to the client.
    That's it, the script is quite simple.

    Client part


    Since we are applying for data to another site, the client part receives data from the server through JSONP. The client executes the AJAX request, waits until the desired event arrives, if the heartbeat event arrives, it is simply ignored and the request is re-executed. If the desired event arrives, then further actions are performed depending on the settings, but in any case, the call is recorded on the gadget screen.
    The following settings are made:
    Server address - URL where our script fscp.php is installed (the string must be specified in full, including http: // and the name of the script). For example: myserver.com/special/fscp.php
    Account - phone number (account) in FreeSWITCH, from which we are tracking events.
    Action- action when calling this number:
    no action - do nothing, the call simply appears in the gadget window
    show alert window - show the call alert window
    call address - call the browser with the specified address
    show prompt then call address - show the call alert window and only from it, when the user clicks the button, call the browser with the specified address. This is because there can be many calls, but not every action needs to be taken, for example, to record in helpdesk.
    The last two options involve calling a site. In this case, you must specify the call string in full, including http: //
    As a parameter, the system can transmit the phone number from which the call came. This parameter is% CALLERID% (case sensitive). For instance:
    myserver.com/helpdesk/add_call.php?number=%CALLERID%

    Conclusion


    Well, actually, the original problem was solved. In this solution, I see two drawbacks:
    1. There is no authorization, i.e. I can, in principle, indicate any phone number in the settings and see who is calling him. Is it bad - I can’t say for sure. For example, I don’t care who and when calls the CEO :-).
    2. The called window does not open on top of other windows, it must be "lifted" by yourself. If someone offers a solution to this problem - I will be very grateful!


    Files can be downloaded from here .

    Also popular now: