[dev] 3CXBlinkStick (USB LED notification for 3CX)

Status
Not open for further replies.

gdesnoues

Premier Customer
Joined
Dec 16, 2015
Messages
28
Reaction score
2
Hello everyone,

I am developped a dll interface between 3CX and a small USB LED card. :)
It's used to notify the 3CX status for all other, ideal for call center or hotline.

I use a BlinkStick square https://blinkstick.com/products/blinkstick-square
and a 3CX phone app in windows.

I have dev a dll (thanks for the suppor that helped me on some points)
It's my first dev in C# so my code may not be the best (you can help me if you want).

currently:
  • status color with 25% brightness for (Available: green / OutOfOffice : orange / DND : red)
  • Oncall : red (brightness 50%)
  • Dialing : slow blinking yelow (50%)
  • End of call : return to the last status color
  • Ringing: fast blinking red (100%)
  • Transfert : slow blinking yellow (50%)
  • Wainting (I don't now when this status is use) : slow blinking blue (50%)
  • change brightness and flashing speed with a XML file
futur:
  • if you want another fonctions

Are you interested about this dev ?
I'll put pictures if you wish.

sorry for my bad english, i'm french :D
 
Last edited:
For the Json file I have try to read it with Newtonsoft (JSON framework for .NET).
but when I call this fonction, my LED stop working.
I have problem in line "MyObject jsonObj...." but I don't know why (it OK in a console App)

Code:
// Get params from Json files
private void GetJsonFile()
{
    //OpenUrl("GetJsonFile");
    MyObject jsonObj = JsonConvert.DeserializeObject<MyObject>(File.ReadAllText(jsonPath));
    _softLightness = jsonObj.softLightness;
    _mediumLightness = jsonObj.mediumLightness;
    _hardLightness = jsonObj.hardLightness;
    _slowBlink = jsonObj.slowBlink;
    _fastBlink = jsonObj.fastBlink;
}

the Json file is :
Code:
{
    "softLightness":"20",
    "mediumLightness":"50",
    "hardLightness":"75",
    "slowBlink":"1500",
    "fastBlink":"50"
}
 
I decided to use a XML file instead of a Json file
so know we have :
Code:
<?xml version="1.0" encoding="UTF-8"?>
<My3CXBlinkStick>
    <debug>true</debug>
    <softLightness>25</softLightness>
    <mediumLightness>50</mediumLightness>
    <hardLightness>100</hardLightness>
    <slowBlink>1500</slowBlink>
    <fastBlink>200</fastBlink>
</My3CXBlinkStick>

and :
Code:
// Fonction to Extract XML File to an Object
public static T DeserializeXMLFileToObject<T>(string XmlFilename, string XmlRoot)
{
    T returnObject = default(T);
    if (string.IsNullOrEmpty(XmlFilename)) return default(T);
    try
    {
        StreamReader xmlStream = new StreamReader(XmlFilename);
        XmlSerializer serializer = new XmlSerializer(typeof(T), new XmlRootAttribute(XmlRoot));
        returnObject = (T)serializer.Deserialize(xmlStream);
    }
    catch (Exception ex)
    {
        //use XmlRoot for the Title
        MessageBox(new IntPtr(0), "we have problems in the XML File:\n"+ex.ToString(), XmlRoot, 0);
    }
    return returnObject;
}

// Get params from XML file
private void GetXmlFile()
{
    MyObject xmlObj = DeserializeXMLFileToObject<MyObject>(jsonPath, "My3CXBlinkStick");
    _debug = xmlObj.debug;
    if (xmlObj.softLightness > 0 && xmlObj.softLightness <= 100) { _softLightness = xmlObj.softLightness; }
    if (xmlObj.mediumLightness > 0 && xmlObj.mediumLightness <= 100) { _mediumLightness = xmlObj.mediumLightness; }
    if (xmlObj.hardLightness > 0 && xmlObj.hardLightness <= 100) { _hardLightness = xmlObj.hardLightness; }
    if (xmlObj.slowBlink > 0) {_slowBlink = xmlObj.slowBlink; }
    if (xmlObj.fastBlink > 0) {_fastBlink = xmlObj.fastBlink; }
}

I have put a MessageBox fonction to debug when XML file have a problem.
Forms is'nt présente in a DLL so I just use this on top of my class:
Code:
// Use DllImport to import the Win32 MessageBox function.
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern int MessageBox(IntPtr hWnd, String text, String caption, uint type);

Now my DLL work fine and I can change the Lightness (the 100% light power is to strong in my office) easily with de XML file :)
 
Last edited:
Hello gdesnoues,

Our company recently switched over to 3CX and this is something I have had on my list to look in to.

I like the use of the blinkstick, but I am curious if you are willing/able to explain how this works by pulling information from 3CX? Or is 3CX running this every time it changes status - then sending signal to the blinkstick?

If you can refer to any guides or installation manuals I would appreciate it. I am trying to learn a bit more about how this will integrate together.
 
Hello gdesnoues,

Our company recently switched over to 3CX and this is something I have had on my list to look in to.

I like the use of the blinkstick, but I am curious if you are willing/able to explain how this works by pulling information from 3CX? Or is 3CX running this every time it changes status - then sending signal to the blinkstick?

If you can refer to any guides or installation manuals I would appreciate it. I am trying to learn a bit more about how this will integrate together.

Hi Hypnolope,

My dll is a link between the BlinkStick dll and the 3CX API https://www.3cx.com/call-center/crm-integration/
Some function are called when 3CX status change (see 3cx doc). I send a command to the blinkstick during this status change.

I can send you my Dll if you want.

Actually I just have detect a problem when I receive a second call
- during the 1st call : red light
- incomming new call : red blink
- when the 2nd call stop (without answer) : the light go back to the last status color instead of red color (I'm steel on the 1st call)

I will fix it as soon as possible.
 
  • Like
Reactions: ArtR
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
112,323
Messages
591,896
Members
165,474
Latest member
costionofrei