Dismiss Notice
We would like to remind you that we’re updating our login process for all 3CX forums whereby you will be able to login with the same credentials you use for the Partner or Customer Portal. Click here to read more.

Solved Busy Light integration...

Discussion in 'CRM / Helpdesk / App Integration' started by dcnigma, May 11, 2017.

Thread Status:
Not open for further replies.
  1. dcnigma

    Joined:
    May 10, 2017
    Messages:
    3
    Likes Received:
    4
    Hey All,

    I am trying to integrate busy Light for 3CX but i am not that good in C#

    Want to change the the light colour if there is a call or the person available.

    Got it working partially but i have some trouble reading the status of the 3CX.

    Here is the code i written:

    Code:
    using BusylightTester;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using System.IO;
    using MyPhonePlugins;
    
    namespace MyCRMPlugins
    {
        [CRMPluginLoader]
        public class MyCrmPlugin
        {
            private static MyCrmPlugin _instance;
            private static IMyPhoneCallHandler _callHandler;
            private Busylight.SDK busylight = null;
    
            [CRMPluginInitializer]
    
            public static void Loader(IMyPhoneCallHandler callHandler)
            {
    //show busylight form
                frmMain frm = new frmMain();
                frm.Show();
                _instance = new MyCrmPlugin(callHandler);
    
            }
    
            public MyCrmPlugin(IMyPhoneCallHandler callHandler)
            {
                _callHandler = callHandler;
                _callHandler.OnCallStatusChanged += CallHandlerOnOnCallStatusChanged;
                _callHandler.OnMyPhoneStatusChanged += CallHandlerOnOnMyPhoneStatusChanged;
            }
    
            private void CallHandlerOnOnMyPhoneStatusChanged(object sender, MyPhoneStatus status)
            {
                frmMain frm = new frmMain();
                frm.busylight.Light(Busylight.BusylightColor.Green);
            }
    
            private void CallHandlerOnOnCallStatusChanged(object sender, CallStatus callInfo)
            {
                frmMain frm = new frmMain();
                frm.busylight.Light(Busylight.BusylightColor.Red);
    
            }
            private void callhandler_OnCallStatusChanged(object sender, CallStatus callInfo)
            {
                frmMain frm = new frmMain();
                frm.busylight.Light(Busylight.BusylightColor.Red);
      
            }
    
            public CallStatus MakeCall(string destination)
            {
                frmMain frm = new frmMain();
                frm.busylight.Light(Busylight.BusylightColor.Red);
                return _callHandler.MakeCall(destination);
            }
    
            }
        }
    
    Hope you guys can help me :)

    Thanks in advance
     
    mortenjorge likes this.
  2. Andreas Paradisiotis

    Joined:
    Apr 7, 2017
    Messages:
    53
    Likes Received:
    12
    Hello dcnigma


    In method CallHandlerOnOnCallStatusChanged there is a parameter callInfo of type CallStatus.
    callInfo.State is going to give the current status of client

    Here is CallState enum

    public enum CallState
    {
    Undefined,
    Ringing,
    Dialing,
    Connected,
    WaitingForNewParty,
    TryingToTransfer,
    Ended,
    }


    So you need to get the status and based on the status change the color accordingly
    Example

    private void CallHandlerOnOnCallStatusChanged(object sender, CallStatus callInfo)
    {
    if (callInfo.State == CallState.Connected)
    {
    frmMain frm = new frmMain();
    frm.busylight.Light(Busylight.BusylightColor.Red);
    }

    }


    Thanks
     
    dcnigma likes this.
  3. dcnigma

    Joined:
    May 10, 2017
    Messages:
    3
    Likes Received:
    4
    Hey Andreas,
    that is the solution in needed, a super thank you for you :D

     
  4. dcnigma

    Joined:
    May 10, 2017
    Messages:
    3
    Likes Received:
    4
    #4 dcnigma, May 11, 2017
    Last edited: May 11, 2017
    jub, mortenjorge and StefanW like this.
  5. fas

    fas

    Joined:
    Mar 9, 2009
    Messages:
    6
    Likes Received:
    0
    Hi I have the 3CX Phone 15.5.1694.0 on my Windows 10 Laptop and I extracted and copied all in the Folder you described. Then I rebooted the Laptop. I did not install any Software from bizylight at all. And I also did not edit any files. What I make wrong, because the Bizylight does not work at all. It's really all, just copying the files and it should work? Or did I misunderstand something?

    Thanks for your help
    Mario
     
  6. fas

    fas

    Joined:
    Mar 9, 2009
    Messages:
    6
    Likes Received:
    0
    o.k. I got it. I did copy all in the Folder first, but I had only to copy the files in “/Release/Copy 2 3CXphone” in the 3CXPhone folder. Actually, I did not copy the 3CXWin8Phone.user.config file. I edited it by myself and added "MyCRMPlugin" in the “key="CRMPlugin"” string because we had more active plugins then you had in your example. Now it works perfect. Thanks for your work!
     
  7. mtnsms

    Joined:
    Aug 16, 2017
    Messages:
    1
    Likes Received:
    0
    @dcnigma: thank you for sharing the plugin. it works fine!
     
Thread Status:
Not open for further replies.