CCA - CTI Exception - Agent Desktop

Aug 19, 2011 at 4:39 PM

Hi Matt,

We are integrating CCA with Avaya CTI. i installed TSAPI client in my development machine and using the existing TSAPI wrapper comes with CCA. i was getting the below error message while i run the CCA agent desktop,

Error message: A call to PInvoke function 'TapiWrapper!Microsoft.Uii.QuickStarts.Cti.TapiWrapper::setCallStateChangeCB' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

As suggested by "tsampath", i had to add  an attribute CallingConvention = CallingConvention.Cdecl at external interop method calls. but after added this, whenever call comes or if try to make outbound call the "Agent Desktop" closes automatically.

Please help me to resolve this. Thanks in advance.



Aug 19, 2011 at 4:42 PM

Hi Matt,

I am also facing exactly the same problem. Please let me know the solution for this as i am not able to continue development.



Aug 24, 2011 at 10:08 AM


During incoming call scenario, as soon as the call is landed the agent desktop is getting closed with the below error message,

"Run-time check failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention"

when i was debugging the "Microsoft.Uii.Csr.Cti.Tsapi" c++ project, i found that it throws an exception while calling the "callInfoChangeCB" delegate in "callStateChange" method of "CTsapiInterface.cpp".

Please let me know how to resolve this.



Sep 15, 2011 at 8:44 PM

The TSAPI bits that come with CCA are somewhat coded to work with the TAPI Demo tools that are provided for the 32bit clients.
There are a number of things that you need to do to make them work with Avaya TSAPI , the C++ files for the adapters are included in the sample’s directory of UII.

As a side note ( and a bit of a plug for MCS ) if you have Microsoft Consulting Services on your project, they have developed a Avaya specific TSAPI adapter.


Oct 7, 2011 at 11:35 AM

I prepared 32 bit environment to do the demo CTI feature, since this functionality is very important at the demo to get the project down to the company. But that feature didn’t work for me.

This has been raised at

Any idea on this Matt?