3cx Call Control Api Connection Problem

Discussion in 'CRM / Helpdesk / App Integration' started by ibrahim akgün, Feb 26, 2018.

Tags:
Thread Status:
Not open for further replies.
  1. ibrahim akgün

    Joined:
    Feb 26, 2018
    Messages:
    29
    Likes Received:
    2
    Hi,
    I want to test simply 3cx call control api and i got a windows forms application. I have wrote server host port user passwords info and simply call MakeCall method for test but im getting an error like;

    [​IMG]

    "
    System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
    at TCX.Configuration.PhoneSystem.RegisterListener(MyPFN_UPDATE_LISTENER f)
    "


    // CODES

    static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)

    {
    var name = new AssemblyName(args.Name).Name;
    if (name == "3cxpscomcpp2")
    // return Assembly.LoadFrom(Path.Combine(instanceBinPath, name + ".dll"));
    return Assembly.LoadFrom("C:\\Program Files\\3CX Phone System\\Instance1\\Bin\\3cxpscomcpp2.dll");
    else
    throw new FileNotFoundException();
    }

    private void Form1_Load(object sender, EventArgs e)
    {

    AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
    }

    private void btnAra_Click(object sender, EventArgs e)
    {

    var a = new Random(Environment.TickCount);

    PhoneSystem.ApplicationName = "TestApi";
    PhoneSystem.ApplicationName = PhoneSystem.ApplicationName + a.Next().ToString();

    PhoneSystem.CfgServerHost = "127.0.0.1";
    PhoneSystem.CfgServerPort = 5485;
    PhoneSystem.CfgServerUser = "cfguser_default";
    PhoneSystem.CfgServerPassword = "o78xdakexc17";

    PhoneSystem.Root.MakeCall(txtArayan.Text, txtAranan.Text);

    }
     
  2. edossantos

    edossantos Support Team
    Staff Member 3CX Support

    Joined:
    Jun 27, 2007
    Messages:
    1,361
    Likes Received:
    109
    Try to run the program from the 3CX Phone System installation folder, as there are other DLLs that need to be loaded, not only 3cxpscomcpp2.dll... For example "tcxpscom_native.dll" and "sl.dll".
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. voiptoys

    voiptoys Active Member

    Joined:
    Feb 13, 2013
    Messages:
    727
    Likes Received:
    125
    Also compile your application as "Any CPU" or "x64"
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. ibrahim akgün

    Joined:
    Feb 26, 2018
    Messages:
    29
    Likes Received:
    2
    Thanks its solved after compile for x64 platform
     
Thread Status:
Not open for further replies.