Currently I have the problem that I should migrate a tool which communicates via Cisco TAPI. Currently it is running under a 32bit compilation.
If I switch the compilation set to 64bit and update the nuget package "ATAPI" (by Mark Smith <2>) to the 64bit version.
If I build this and test it, the TAPI logs writes there is a dwSize mismatch. I tried to set an explicity StructLayout for the CiscoDevSpecific-structs (like suggested here <1>) . But the same error appears in the log file.
error message
15:44:51.105 | TSPI_lineGetAddressStatus() TSPI_lineGetAddressStatus returns = 0x00000000
15:44:51.106 | TSPI_lineDevSpecific()
dwRequestID: 0x000105AF hdLine: 0x175B4B30 dwAddressID: 0x00000000 hdCall: 0x00000000 lpParams: 0x202D6E98 dwSize: 32
15:44:51.106 | CSelsiusTSPLine::DevSpecific() [0x00000D32] *ERROR* dwSize mis-match 0x00000020
15:44:51.106 | TSPI_lineDevSpecific() TSPI_lineDevSpecific returns = 0x80000048
eg The struct for a StartCallMonitotoring looks like
[StructLayout(LayoutKind.Explicit, Size = 32)]
public struct CiscoLineDevSpecificStartCallMonitoring
{
[FieldOffset(0)]
public int m_MsgType;
[FieldOffset(8)]
public int m_PermanentLineID;
[FieldOffset(16)]
public int m_MonitorMode; //0= NONE, 1=SILENT, 2=WHISPER, 3=ACTIVE
[FieldOffset(24)]
public int m_ToneDirection; //0=LOCALONLY, 1=REMOTEONLY, 2=BOTH, 3=NOTLOCALORREMOTE
}
The initiliziation like
var cisco = new CiscoLineDevSpecificStartCallMonitoring
{
m_MsgType = (int)CiscoLineDevSpecificType.SLDST_START_CALL_MONITORING,
m_PermanentLineID = permanentIdOfTargetLine,
m_MonitorMode = (int)monitorMode,
m_ToneDirection = (int)PlayToneDirection.PlayToneDirectionNoLocalOrRemote
};
And the calculation of the Bytes looks like:
private static byte[] GetBytes(object msg)
{
var size = Marshal.SizeOf(msg);
var arr = new byte[size];
var ptr = Marshal.AllocHGlobal(size);
Marshal.StructureToPtr(msg, ptr, true);
Marshal.Copy(ptr, arr, 0, size);
Marshal.FreeHGlobal(ptr);
return arr;
}
Thank you for your responds.
<1> https://community.cisco.com/t5/collaboration-documents/tsp-x64-devspecific-dword-size-mismatch-problem/ta-p/3613828 <2> https://github.com/markjulmar/atapi.net
I am experiencing same issue. I didn't fully resolve it but I think I can provide some info to help. I know this is not a complete solutions but no one has responded in 7 months.
The first point is the structure we have to marshal. I couldn't decompile cisco classes (don't have access to them) but if you have a look at cisco dev guide:
So inheritance is involved then some bytes for padding/aligment are expected.
The second point is that DWORD is not 8 bytes size but 4 bytes even in x64 OS.
With that in mind my proposal por the struct shoud be something like this :
With this structure I can get:
I am not a C++ developer, but i've prepared a small C++ program to inspect the elements offset of the derived class and found these paddings. I don't know where they came from.
As I mentioned it is still not working in my infra. After this I recieve:
But may be this is because of configuration issues. Any case I wanted to provide this point of view so we can reach a complete solution soon.