3cxpscomcpp2.dll > Config server is not connected

Discussion in '3CX Phone System - General' started by skrae, Oct 14, 2015.

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

    Joined:
    Oct 14, 2015
    Messages:
    1
    Likes Received:
    0
    Hi there,

    I use the 3cxpscomcpp2.dll-assembly in a .NET 4.0 Windows Service to monitor incoming phone calls and protocol them in a SQL database. After installing the latest version (V14), the service throws the following exception: Config server is not connected. I saw that a new 3cxpscomcpp2.dll was delivered and I recompiled the project with the new assembly but the application still crashes.

    I use the following code from your example:
    Code:
    try
                {
                    #region phone system initialization(init db server)
                    PhoneSystem.ApplicationName = "SE.3CX";
                    RegistryKey regKeyAppRoot;
                    if (IntPtr.Size == 4)
                    {
                        regKeyAppRoot = Registry.LocalMachine.OpenSubKey("SOFTWARE\\3CX\\PhoneSystem");
                    }
                    else
                    {
                        regKeyAppRoot = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Wow6432Node\\3CX\\PhoneSystem");
                    }
                    String _appPath = (string)regKeyAppRoot.GetValue("AppPath");
                    String filePath = Path.Combine(_appPath, @"Bin\3CXPhoneSystem.ini");
                    String value = GetKeyValue("ConfService", "ConfPort", filePath);
                    Int32 port = 0;
                    if (!String.IsNullOrEmpty(value))
                    {
                        Int32.TryParse(value.Trim(), out port);
                        PhoneSystem.CfgServerPort = port;
                    }
                    value = GetKeyValue("ConfService", "confUser", filePath);
                    if (!String.IsNullOrEmpty(value))
                        PhoneSystem.CfgServerUser = value;
                    value = GetKeyValue("ConfService", "confPass", filePath);
                    if (!String.IsNullOrEmpty(value))
                        PhoneSystem.CfgServerPassword = value;
                    #endregion
    
                    Tenant[] tenantArr = PhoneSystem.Root.GetTenants();
                    if (tenantArr.Length == 0)
                    {
                        throw new Exception("Corrupted database");
                    }
    
                    PhoneSystem.Root.Inserted += new NotificationEventHandler(Root_Inserted);
                    PhoneSystem.Root.Updated += new NotificationEventHandler(Root_Updated);
                    PhoneSystem.Root.Deleted += new NotificationEventHandler(Root_Deleted);
                }
                catch (Exception ex)
                {
                    Library.WriteErrorLog(ex);
                }
    Many thanks in advance for your help!
     
  2. ForBetterSolutions

    Joined:
    Nov 2, 2015
    Messages:
    2
    Likes Received:
    0
    hi skrae

    I made an Import Tool thats configurable by an xml File and had the same problems with v14.

    After digging around I found that the problem was the reference to the 3cxPhoneSystem.ini on this line here:

    Program.cs
    Code:
    #region phone system initialization(init db server)
                    String filePath = @".\3CXPhoneSystem.ini";
    
    This will only work while your executable is in the bin folder of the correct instance. We added the path to our xml file and now everything is working as it should.

    Hope this helps you out!

    Greetings from Switzerland
     
  3. LuckyDog

    Joined:
    Jun 11, 2013
    Messages:
    3
    Likes Received:
    0
    I'm having the same issue - we have a click once application which is deployed on the 3CX server to log calls in our SQL database. This was working on version 12, but since we upgraded to v14, we get the same error message. I think it is generated when we hit this line in the code:

    Tenant[] tenantArr = PhoneSystem.Root.GetTenants();

    I was not sure if I was supposed to include the .ini file from the server or from the instance (neither had any effect, though the latter had the 'confuser' and 'confpass' key values.

    'ForBetterSolutions' - is your project a regular executable and just placing it in the instance\bin was the difference?
     
  4. LuckyDog

    Joined:
    Jun 11, 2013
    Messages:
    3
    Likes Received:
    0
    Here was my fix:
    Remove the code to find the registry key and just hard code the path to the .ini file.
    /*
    RegistryKey regKeyAppRoot;
    if (IntPtr.Size == 4)
    {
    regKeyAppRoot = Registry.LocalMachine.OpenSubKey("SOFTWARE\\3CX\\PhoneSystem");
    errorPosition = "4 size";
    }
    else
    {
    regKeyAppRoot = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Wow6432Node\\3CX\\PhoneSystem");
    errorPosition = "other size";
    }
    String _appPath = (string)regKeyAppRoot.GetValue("AppPath");
    errorPosition += "\r\n App path: " + _appPath;
    String filePath = Path.Combine(_appPath, @"Bin\3CXPhoneSystem.ini");

    */
    String filePath = @"C:\Program Files\3CX Phone System\Instance1\Bin\3CXPhoneSystem.ini";
     
Thread Status:
Not open for further replies.