3cx for Windows custom CRM API for V12.5?

Discussion in 'Windows' started by ClintIrving, Oct 1, 2015.

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

    Joined:
    Oct 1, 2015
    Messages:
    3
    Likes Received:
    0
    Hi 3CX forum,

    http://www.3cx.com/blog/docs/3cxphone-for-windows-api/ details how to write a plugin that allows for actions on call status change and phone status change which looks awesome! I've tried implementing this and plugging it into 3CX V12.5

    Stub code for the class looks like this:

    Code:
    using MyPhonePlugins;
    
    namespace IntegrationPlugin
    {
        [CRMPluginLoader]
        public class MyCrmPlugin
        {
            private static MyCrmPlugin _instance;
            private static IMyPhoneCallHandler _callHandler;
    
            [CRMPluginInitializer]
            public static void Loader(IMyPhoneCallHandler callHandler)
            {
                _instance = new MyCrmPlugin(callHandler);
            }
    
            public MyCrmPlugin(IMyPhoneCallHandler callHandler)
            {
                _callHandler = callHandler;
                _callHandler.OnCallStatusChanged += CallHandlerOnOnCallStatusChanged;
                _callHandler.OnMyPhoneStatusChanged += CallHandlerOnOnMyPhoneStatusChanged;
            }
    
            private void CallHandlerOnOnMyPhoneStatusChanged(object sender, MyPhoneStatus status)
            {
            }
    
            private void CallHandlerOnOnCallStatusChanged(object sender, CallStatus callInfo)
            {
            }
    
            public CallStatus MakeCall(string destination)
            {
                return _callHandler.MakeCall(destination);
            }
        }
    }
    
    And the 3CX configuration file now looks like this:

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
      </startup>
      <add key="CRMPlugin" value="CallNotifier,3CXPhoneTapiPlugin,IntegrationPlugin" />
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        etc...
      
    The IntegrationPlugin.dll file has been copied to the ProgramData\3CXPhone for Windows\PhoneApp directory, and I've double checked that the NTFS permissions for the file are the same as the other files in the directory.

    However, everytime I try to start up the 3CX client I get the following exception in the Windows Error log:

    Application: 3CXWin8Phone.exe
    Framework Version: v4.0.30319
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.TypeInitializationException
    Stack:
    at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
    at System.Windows.Threading.DispatcherOperation.InvokeImpl()
    at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object)
    at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
    at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
    at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
    at System.Windows.Threading.DispatcherOperation.Invoke()
    at System.Windows.Threading.Dispatcher.ProcessQueue()
    at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
    at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
    at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
    at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
    at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
    at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
    at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
    at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
    at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
    at System.Windows.Application.RunDispatcher(System.Object)
    at System.Windows.Application.RunInternal(System.Windows.Window)
    at System.Windows.Application.Run(System.Windows.Window)
    at _3CXWin8Phone.App.Main()

    Does the above perhaps not actually work for 3CX version 12.5?

    Can anyone spot anything that might be incorrect in the code?

    Thanks!
     
  2. linda0012

    Joined:
    Aug 26, 2015
    Messages:
    1
    Likes Received:
    0
    Do you want us to read the whole code? :idea:
     
  3. ClintIrving

    Joined:
    Oct 1, 2015
    Messages:
    3
    Likes Received:
    0
    No need to read the whole code - it should be identical to the code provided in the link at http://www.3cx.com/blog/docs/3cxphone-for-windows-api/ ... I just wanted to provide all the detail in case any eagle-eye can spot something in it that I've missed.

    My question is really - does the example at http://www.3cx.com/blog/docs/3cxphone-for-windows-api/ work for 3CX version 12.5?

    Thanks!
     
Thread Status:
Not open for further replies.