ConfigServer is not connected exception - v15 API

Discussion in '3CX Phone System - General' started by francek_ide3, Dec 13, 2017.

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

    Joined:
    Dec 12, 2017
    Messages:
    8
    Likes Received:
    0
    Hello everyone,

    I am having trouble starting the sample code that is provided at the official page http://downloads.3cx.com/downloads/misc/callcontrolapi/3CXCallControlAPI_v15.zip.
    After some trouble with compiling the program i got it right but now i get this exception:
    TCX.Configuration.Exceptions.PhoneSystemException: ConfigServer is not connected

    these are the steps i already made towards making the sample API work:

    the .exe is located on the same server as 3CX (F:\Program Files\3CX Phone System\Instance1\Bin OR
    F:\Program Files\3CX Phone System\Bin)

    the variable PhoneSystem.ApplicationName has a unique name

    i have included 3cxpscomcpp2.dll, tcxpscom_native.dll

    i am using the 3CXPhoneSystem.ini that was in the Instance1\Bin folder

    i checked all the logs and didn't seem to find anything that was related to this exception

    Please provide support for this error, thank you!
     
  2. NickD_3CX

    NickD_3CX Support Team
    Staff Member 3CX Support

    Joined:
    Jun 2, 2014
    Messages:
    1,255
    Likes Received:
    63
    Are the 3CX service running? This Exception is usually thrown when the 3CX services aren't running....
     
  3. francek_ide3

    Joined:
    Dec 12, 2017
    Messages:
    8
    Likes Received:
    0
    The 3CX server is running and we are using the phone system, do I need to enable some additional services?
     
  4. NickD_3CX

    NickD_3CX Support Team
    Staff Member 3CX Support

    Joined:
    Jun 2, 2014
    Messages:
    1,255
    Likes Received:
    63
    No, the data pulled from the .ini file should be what is needed to connect. I am not a developer myself, but I have played around with the API to know some things about it. Could you paste the code you have written to connect to the API? Maybe I can check it out later.
     
  5. francek_ide3

    Joined:
    Dec 12, 2017
    Messages:
    8
    Likes Received:
    0
    Here is the code:

    code.png

    And here is the error that im getting:
    error_1.png
     
  6. NickD_3CX

    NickD_3CX Support Team
    Staff Member 3CX Support

    Joined:
    Jun 2, 2014
    Messages:
    1,255
    Likes Received:
    63

    Attached Files:

  7. NickD_3CX

    NickD_3CX Support Team
    Staff Member 3CX Support

    Joined:
    Jun 2, 2014
    Messages:
    1,255
    Likes Received:
    63
  8. francek_ide3

    Joined:
    Dec 12, 2017
    Messages:
    8
    Likes Received:
    0
    I downloaded your code, compiled to Instance1/Bin started and got the following error:

    Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
    at ConsoleApp1.Program.GetInstanceBinPath() in C:\Users\fran.raknic\Desktop\ConsoleApp1\ConsoleApp1\Program.cs:line 73
    at ConsoleApp1.Program.ConnectToInstance() in C:\Users\fran.raknic\Desktop\ConsoleApp1\ConsoleApp1\Program.cs:line 37
    at ConsoleApp1.Program.Main(String[] args) in C:\Users\fran.raknic\Desktop\ConsoleApp1\ConsoleApp1\Program.cs:line 21

    I am trying to figure out what isn't working and would appreciate your further assistance very much!
     
  9. francek_ide3

    Joined:
    Dec 12, 2017
    Messages:
    8
    Likes Received:
    0
    Ok for some reason the line:
    RegistryKey regKeyAppRoot = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Wow6432Node\\3CX\\PhoneSystem");

    Pulls data from my machine, not from the 3CX server machine.
    Btw i am connecting from the internal network to the server, i mapped a network drive, when i build the solutions i set the output to the 3cx server... just letting you know!
     
  10. NickD_3CX

    NickD_3CX Support Team
    Staff Member 3CX Support

    Joined:
    Jun 2, 2014
    Messages:
    1,255
    Likes Received:
    63
    Don't do it like that, that's probably why you're getting errors. Install 3CX Phone System locally where you are compiling and testing, even if just with using a PBX Edition Key, then test. I doubt I'll be able to connect from anywhere else to the service other than localhost....
     
  11. francek_ide3

    Joined:
    Dec 12, 2017
    Messages:
    8
    Likes Received:
    0
    I am running all the programs from the localhost (where 3CX) is installed, i am just developing on my computer.
    Is there any way to re-generate the 3CXPhoneSystem.ini file?

    Also I do not understand why does the line:

    RegistryKey regKeyAppRoot = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Wow6432Node\\3CX\\PhoneSystem");

    in your console aplication does not read from the machine that is running it (the 3CX server), I am not a Microsoft developer and i am not that familiar with C# and my goal here is to get this api running and then develop the REST API and expose it to provide functionality of 3CX anywhere in our applications. This has been a major time sink with no results. Please help me get this API going so we can continue development.
     
  12. NickD_3CX

    NickD_3CX Support Team
    Staff Member 3CX Support

    Joined:
    Jun 2, 2014
    Messages:
    1,255
    Likes Received:
    63
    That I had done in an attempt to not have to run the .exe from the Bin folder and to catch cases where the install folder was not in the default location, which I used to be able to do in V14, but not now. Ignore it and replace as you see fit, it was just some experimenting I was doing, non the less, it works on mine.

    Unfortunately, this is the extent to what I can help you with as I am neither a developer, this is just some code I've managed to put together in my own free time.
     
  13. francek_ide3

    Joined:
    Dec 12, 2017
    Messages:
    8
    Likes Received:
    0
    I have hard-coded the path that you were getting from the registry and your Console Application runs but i get the same error:
    Config Server is not connected

    I am starting to think that there is a problem with the username and password in the configuration.ini. Is there any way to generate a new 3CXPhoneSystem.ini file? Or some way to get the usernames and passwords for the configuration server?
    Thank you very much for your help, even tough we didn't solve the problem yet you have been very helpful.
     
  14. NickD_3CX

    NickD_3CX Support Team
    Staff Member 3CX Support

    Joined:
    Jun 2, 2014
    Messages:
    1,255
    Likes Received:
    63
    Not that I'm aware of, no, but you could always re-install 3CX and have it generate all the files again that way.
     
  15. francek_ide3

    Joined:
    Dec 12, 2017
    Messages:
    8
    Likes Received:
    0
    Ok, follow up.
    I installed a fresh 3CX server on my local machine, compiled the sample (and your program) and got the same error:
    ConfigServer is not connected

    If there is someone on the support team who can provide further support please reply to this thread.
    I have completely run out of ideas, and any help/suggestion would be more then welcome.
     
  16. NickD_3CX

    NickD_3CX Support Team
    Staff Member 3CX Support

    Joined:
    Jun 2, 2014
    Messages:
    1,255
    Likes Received:
    63
    Unfortunately as stated in the 3CX Call Control API page, no support is given by 3CX for the API.

    Maybe some other forum member though could check it out....
     
Thread Status:
Not open for further replies.