cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
401
Views
0
Helpful
0
Comments
cdnadmin
Level 11
Level 11
This document was generated from CDN thread

Created by: Wolfgang Falk on 18-07-2012 05:16:26 AM
Hello,
 
i try to use the devspecific function for whispering and monitoring calls. on a 32bit platform (32 bit tsp) the application works like a charm, but when moving to a 64bit platform i always get a tsp error "dwSize mismatch". 
 
version is 8.6
 
i guess there is some problem in converting the struct to the byte array, here is the relevant source code in c#, maybe someone has an idea. 
 
the struct:
 
 
    public struct CiscoLineDevSpecificStartCallMonitoring
    {
        public int m_MsgType;
        public int m_PermanentLineID;
        public int m_MonitorMode; //0= NONE, 1=SILENT, 2=WHISPER, 3=ACTIVE
        public int m_ToneDirection; //0=LOCALONLY, 1=REMOTEONLY, 2=BOTH, 3=NOTLOCALORREMOTE
 
    }
 
 
here is the initialization:
 

        var cisco = new CiscoLineDevSpecificStartCallMonitoring
        {
            m_MsgType =(int) CiscoLineDevSpecificType.SLDST_START_CALL_MONITORING,
            m_PermanentLineID = agentLine.PermanentId,
            m_MonitorMode = 2,
            m_ToneDirection = 2
        };

 
and here is the calculation to get the parameter byte array (where i assume the problem):
 

        private static byte[] GetBytes(CiscoLineDevSpecificStartCallMonitoring msgMonitoring)
        {
            var size = Marshal.SizeOf(msgMonitoring);
            var arr = new byte;
            var ptr = Marshal.AllocHGlobal(size);
 
            Marshal.StructureToPtr(msgMonitoring, ptr, true);
            Marshal.Copy(ptr, arr, 0, size);
            Marshal.FreeHGlobal(ptr);
 
            return arr;
        }

 
Thanks for all suggestions, would like to avoid to go back to a 32bit machine...
 
rgds
Wolfgang
 

Subject: RE: TSP x64 DevSpecific dword size mismatch problem
Replied by: David Staudt on 12-09-2012 05:16:24 PM
Due to the nature of how dev-specific requests work - passing raw buffers to-from app/TSP via the OS layer - this problem is inherent to using a 32-bit app on a 64-bit TSP/OS.
 
Cisco supports only using a fully 32-bit or fully 64-bit stack, e.g.: 32-bit app/TSP/OS or 64-bit app/TSP/OS

Subject: RE: TSP x64 DevSpecific dword size mismatch problem
Replied by: Doug Routledge on 03-04-2013 08:50:47 AM
I have noticed the same issues.  If you switch from int to intptr that will be better for getting the code to run on 32 and 64.  For me this made the message lamp feature work in either.  That being said the monitoring functions all still fail with dword size errors when run on x64 against the 64 bit tsp or 8.x or 9.x.  When I debug the byte arrays they look like what I would expect, perhaps you can tell me if they seem wrong.
Working 32 bit Whisper Coach
[0] 0x00000013
[1] 0x00000000
[2] 0x00000000
[3] 0x00000000
[4] 0x00000007
[5] 0x00000000
[6] 0x00000000
[7] 0x00000000
[8] 0x00000002
[9] 0x00000000
[10] 0x00000000
[11] 0x00000000
[12] 0x00000003
[13] 0x00000000
[14] 0x00000000
[15] 0x00000000
 
Non Working 64 bit Whisper Coach
[0] 0x00000013
[1] 0x00000000
[2] 0x00000000
[3] 0x00000000
[4] 0x00000000
[5] 0x00000000
[6] 0x00000000
[7] 0x00000000
[8] 0x00000007
[9] 0x00000000
[10] 0x00000000
[11] 0x00000000
[12] 0x00000000
[13] 0x00000000
[14] 0x00000000
[15] 0x00000000
[16] 0x00000002
[17] 0x00000000
[18] 0x00000000
[19] 0x00000000
[20] 0x00000000
[21] 0x00000000
[22] 0x00000000
[23] 0x00000000
[24] 0x00000003
[25] 0x00000000
[26] 0x00000000
[27] 0x00000000
[28] 0x00000000
[29] 0x00000000
[30] 0x00000000
[31] 0x00000000
 
Working Lamp 32
[0] 0x00000001
[1] 0x00000000
[2] 0x00000000
[3] 0x00000000
[4] 0x00000002
[5] 0x00000000
[6] 0x00000000
[7] 0x00000000
 
Working Lamp 64
[0] 0x00000001
[1] 0x00000000
[2] 0x00000000
[3] 0x00000000
[4] 0x00000000
[5] 0x00000000
[6] 0x00000000
[7] 0x00000000
[8] 0x00000002
[9] 0x00000000
[10] 0x00000000
[11] 0x00000000
[12] 0x00000000
[13] 0x00000000
[14] 0x00000000
[15] 0x00000000

Subject: RE: TSP x64 DevSpecific dword size mismatch problem
Replied by: Davide Cocchi on 12-04-2013 02:03:52 AM
if you want to have a anycpu interop, you have to write your structures as follows (I post you an example of my implementation that works well...)
 
[StructLayout(LayoutKind.Sequential)]
struct CCiscoLineDevSpecificSetStatusMsgs
{
public uint m_MsgType;
public uint m_DevSpecificStatusMsgsFlag; // LINE_DEVSPECIFIC.
}
 
[StructLayout(LayoutKind.Explicit, Size = 16)]
struct CCiscoLineDevSpecificSetStatusMsgs_64
{
[FieldOffset(0)]
public uint m_MsgType;
[FieldOffset(8)]
public uint m_DevSpecificStatusMsgsFlag; // LINE_DEVSPECIFIC.
}
 
This because the compiler alignment used by cisco is the default one, 4byte at 32 bits, 8byte at 64 bits
Bye, D.
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links