Solved Busy Light integration...

Status
Not open for further replies.

dcnigma

Joined
May 10, 2017
Messages
3
Reaction score
5
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
 
  • Like
Reactions: mortenjorge
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
 
  • Like
Reactions: dcnigma
  • Like
Reactions: MtechSolutions
Last edited:
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
 
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!
 
@dcnigma: thank you for sharing the plugin. it works fine!
 
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
112,323
Messages
591,894
Members
165,472
Latest member
arneg