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.

Trouble with CallNotifier plugin

Discussion in 'Windows' started by MWFBrad, Aug 11, 2016.

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

    Joined:
    Aug 11, 2016
    Messages:
    6
    Likes Received:
    0
    Hello,

    I'm trying to build a DLL based off this guide:
    http://www.3cx.com/blog/docs/3cxphone-for-windows-api/

    The goal is to launch a program when a call is finished, for now I'm just having it write to a file to show its working (it doesn't). Now I've followed all the steps in the above link, and it does not appear that 3CX is using my DLL. I don't see any smoking gun in the logs, and at this point I'm out of ideas.

    config file:
    http://pastebin.com/yV3TjUX0

    DLL code:
    http://pastebin.com/62HsFchx

    Logs:
    http://pastebin.com/2963AyZt

    the DLL is sitting in C:\ProgramData\3CXPhone for Windows\PhoneApp
     
  2. Tertius

    Joined:
    Feb 24, 2016
    Messages:
    43
    Likes Received:
    2
    Do you get any exceptions?

    Try something like this:

    Code:
    
            private void callHandler_OnMyPhoneStatusChanged(object sender, MyPhonePlugins.MyPhoneStatus status)
            {
                if (callInfo.State == CallState.Ended)
                {
                    string filePath = @"C:/Status.txt";
    
                    using (StreamWriter writer = new StreamWriter(filePath, true))
                    {
                        writer.WriteLine(callInfo.State);
                    }
                }
            }
            
    
     
  3. MWFBrad

    Joined:
    Aug 11, 2016
    Messages:
    6
    Likes Received:
    0

    Just tried that, no change and nothing in the logs that looks interesting.
     
  4. Tertius

    Joined:
    Feb 24, 2016
    Messages:
    43
    Likes Received:
    2
    Hello,

    Ensure you are using the correct Framework, 4.0. See Attachment.

    Also, make use of try catch blocks in your code. Catch any exceptions and write to text file - like this:

    Code:
    private MyCRMPlugin(MyPhonePlugins.IMyPhoneCallHandler callHandler)
            {
                try
                {
                    this.callHandler = callHandler;
                    callHandler.OnCallStatusChanged += new MyPhonePlugins.CallInfoHandler(callHandler_OnCallStatusChanged);
                    
                    callHandler.OnMyPhoneStatusChanged += new MyPhonePlugins.MyPhoneStatusHandler(callHandler_OnMyPhoneStatusChanged);
                }
                catch (Exception ex)
                {
                    string filePath = @"C:/Error.txt";
    
                    using (StreamWriter writer = new StreamWriter(filePath, true))
                    {
                        writer.WriteLine(DateTime.Now + Environment.NewLine + "Message: " + ex.ToString() + Environment.NewLine + "Stack Trace: " + ex.StackTrace);
                    }
                }
            }
     

    Attached Files:

  5. MWFBrad

    Joined:
    Aug 11, 2016
    Messages:
    6
    Likes Received:
    0
    I tried that. No luck, No Exceptions.

    Here's the code now: http://pastebin.com/DVLWvHbf
     

    Attached Files:

  6. MWFBrad

    Joined:
    Aug 11, 2016
    Messages:
    6
    Likes Received:
    0
    Quick update,

    I'm still trying to find a solution for this problem,

    At this point I've tried reinstalling 3cx on my computer, running it in administrator mode, replacing the file writing with launching an executable, and using the 3CX CRM template to create a new one from scratch.

    No luck, nothing works. If anyone has any ideas, I'm all ears.
     
  7. Tertius

    Joined:
    Feb 24, 2016
    Messages:
    43
    Likes Received:
    2
    Hello,

    1. Is your 3CX license edition PRO/Enterprise? This is a requirement for the Phone API.
    2. What OS are you working on?
     
  8. MWFBrad

    Joined:
    Aug 11, 2016
    Messages:
    6
    Likes Received:
    0
    We are using a Pro license, and I am running Windows 10 Pro.
     
  9. Tertius

    Joined:
    Feb 24, 2016
    Messages:
    43
    Likes Received:
    2
    Hello again,

    I just replicated your DLL and ran it in our environment. It worked as it should. I used your first pastebin DLL post.

    I'm also using Windows 10, version 1511, OS Build 10586.545

    It sounds like you were quite meticulous of the setup of your DLL and following the documentation closely, therefore I would suggest you look at your environment. Your DLL is fine.

    Good Luck!
     
  10. antyxsoft

    Joined:
    Feb 12, 2015
    Messages:
    2
    Likes Received:
    0
    Hi

    You should add a new line in the 3CXWin8Phone.user.config (the one with key="CRMPlugin") only if it does NOT exist.

    If such a line there is already there, then just add your plugin by appending a comma and the file name of your plugin .dll (without the .dll).

    E.g

    <add key="CRMPlugin" value="Plugin1,Plugin2,Plugin3,YourPlugin" />

    Theo
     
  11. Tertius

    Joined:
    Feb 24, 2016
    Messages:
    43
    Likes Received:
    2
    He has already done this. Check his 1st post, the Config File pastebin link.
     
  12. MWFBrad

    Joined:
    Aug 11, 2016
    Messages:
    6
    Likes Received:
    0

    Thats it!! Once I deleted the other CRMPlugin Line, it worked. Oh wow, thank you. I had a fairly large project hanging on getting this working, and was really feeling the pressure, thank you so much.
     

    Attached Files:

  13. antyxsoft

    Joined:
    Feb 12, 2015
    Messages:
    2
    Likes Received:
    0
    Glad to hear it.

    Theo.
     
Thread Status:
Not open for further replies.