Connect. Communicate. Collaborate. Securely.

Home » Kerio User Forums » Kerio Operator » Intercept incoming call and execute something
  •  
genesiPC

Messages: 7
Karma: 1
Send a private message to this user
Hi all,
My objective is to make interaction between kerio operator and my desktop agenda software. From the desktop software I can call users (opening http s://OPERATOR/#clickToDial=<NUMBER>) w/o problems; I would that the agenda open the client page information when I receive a phone call from he.
Is there any settings in operator or else to know when a call was received by internal user (i.e. execute script when incoming call was accepted)?

I thought I would check active calls to locate the internal user and the external number, but it is too expensive (I should check it every second).
Any idea?

Thank you (and sorry my bad english)
  •  
Vladimir Toncar (Kerio)

Messages: 1696
Karma: 39
Send a private message to this user
This sounds like a typical PBX integration task. Operator supports the integration using the Asterisk Management Interface (AMI). The AMI can be used by both client applications (like desktop diallers) and for server-to-server integration (PBX-to-CRM).

To start reading about AMI, have a look at the following KB articles:
http://kb.kerio.com/category/kerio-operator/crm-integration- desktop-dialers/

  •  
genesiPC

Messages: 7
Karma: 1
Send a private message to this user
thank you Vladimir, I'm going to learn what you have suggested to me. Smile

[Updated on: Tue, 19 July 2016 14:56]

  •  
genesiPC

Messages: 7
Karma: 1
Send a private message to this user
I founded the solution Laughing

I post the code (in c#), maybe can help someone else:
I use AsterNET for PBX integration (open source library written in C# fork of asterisk.net)

*******
using AsterNET.Manager;
using AsterNET.Manager.Event;
using AsterNET.Manager.Action;
using AsterNET.Manager.Response;
using System.Diagnostics;

......

(after inizialization)
private ManagerConnection manager = null;
string address = <ip_host>;
int port = <port>;
string user = <username>;
string password = <password>;
.....
        private void connectToKerio()
        {
            manager = new ManagerConnection(address, port, user, password);
            manager.UnhandledEvent += new ManagerEventHandler(manager_Events);
            try
            {
                // Uncomment next 2 line comments to Disable timeout (debug mode)
                // manager.DefaultResponseTimeout = 0;
                // manager.DefaultEventTimeout = 0;
                manager.Login();
                manager.NewState += new NewStateEventHandler(Monitoring_NewState);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error connect\n" + ex.Message);
                manager.Logoff();
                this.Close();
            }
        }
        
        void manager_Events(object sender, ManagerEvent e)
        {
            Debug.WriteLine("Event : " + e.GetType().Name);
        }
        
        void disconnectFromKerio()
        {
            if (this.manager != null)
            {
                manager.Logoff();
                this.manager = null;
            }
        }

    private void Monitoring_NewState(object sender, NewStateEvent e)
    {
        string state = e.ChannelState;
        string callerID = e.CallerIdNum;
        if (e.ChannelState == "5")
        {
            String connectedLineNum;
            String connectedLineName;

            Dictionary<String, String> attributes = e.Attributes;
            attributes.TryGetValue("connectedlinenum", out connectedLineNum);
            attributes.TryGetValue("connectedlinename", out connectedLineName);
            // "callerID" - called phone number
            // "connectedLineNum" - calling phone number

            // CallOut. Outcoming call
            SIP_clientTEL = callerID;

            .....<make all that you want>........

        }
        else if (e.ChannelState == "4")
        {
            // CallIn. Incoming call
            comuni.SIP_clienteTEL = callerID;

            .....<make all that you want>........

        }
        else if ((state == "Up") | (e.ChannelState == "6"))
        {
            String connectedLineNum;
            String connectedLineName;


            Dictionary<String, String> attributes = e.Attributes;

            attributes.TryGetValue("connectedlinenum", out connectedLineNum);
            attributes.TryGetValue("connectedlinename", out connectedLineName);
            // "callerID" - called phone number
            // "connectedLineNum" - calling phone number

            // human lifted up the phone right now

            .....<make all that you want>........

        }
     }



in the form load event just write
connectToKerio();

When a call incoming or you make a call, the Monitoring_NewState get all information about the call (i.e. user, phone number, id etc.) and you can use it as you wish.

Sorry my long post and thank you again for the help Smile
  •  
Vladimir Toncar (Kerio)

Messages: 1696
Karma: 39
Send a private message to this user
Thanks for sharing the code. I believe this can be interesting for quite a few people here!
Previous Topic: Kerio Operator and Yeastar TG 800
Next Topic: ADAT not recognizing callers on incoming calls
Goto Forum:
  


Disclaimer:
Kerio discussion forums are intended for open communication between forum members and may contain information and material posted by members which may be useful in learning about Kerio products. The discussion forums are not intended to provide technical support for any specific product. Any information implied or expressed in the discussion forums is that of the posting member. Kerio is in no way responsible for the information posted in the forums, or its accuracy. Kerio employees may participate in the discussions, but their postings do not represent an offical position of the company on any issues raised or discussed. Kerio reserves the right to monitor and maintain the forums to promote free and accurate exchange of information.

Current Time: Fri Dec 02 20:47:51 CET 2016

Total time taken to generate the page: 0.05797 seconds
.:: Contact :: Home ::.
Powered by: FUDforum 3.0.4.