• V20: 3CX Re-engineered. Get V20 for increased security, better call management, a new admin console and Windows softphone. Learn More.

3cx Call Control Api Connection Problem

Status
Not open for further replies.

ibrahim akgün

Forum User
Basic Certified
Joined
Feb 26, 2018
Messages
99
Reaction score
10
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;



"
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);

}
 
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".
 
Also compile your application as "Any CPU" or "x64"
 
Thanks its solved after compile for x64 platform
 
Status
Not open for further replies.
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.