Trying to use lineMakeCall()

I am writing an application for a Windows Mobile device that makes voice calls and is able to send DTMF tones once the call has been established. I have been trying to port the Tapi2Lib library over to the Compact Framework V2 platform. Everything seems fine until I call lineMakeCall(). Once I do, I get a call request id of -2147483595. I run the GetLastWin32Error() method and it returns a value of 6. When I call GetLineDevStatus() I get LINEDEVSTATUSFLAGS_CONNECTED | LINEGETDEVSTATUSFLAGS_INSERVICE. That is the same status if I run that method after invoking the lineOpen() method. I do not understand what I am doing wrong. The lineOpen returns with what appears to be a valid, open line. Here is how I am calling lineMakeCall()

[DllImport("coredll.dll", CharSet=CharSet.Auto, SetLastError=true)]
internal static extern int lineMakeCall(IntPtr hLine, out IntPtr hCall,string DestAddress,uint CountryCode,IntPtr lpCallParams);

l_SizeOfCallParams = (uint)Marshal.SizeOf(l_callparams);
l_callparams.dwTotalSize = l_SizeOfCallParams+l_TranslateOutput.dwDisplayableStringSize;
l_callparams.dwBearerMode = (uint)LineBearerMode.LINEBEARERMODE_VOICE;
l_callparams.dwMediaMode = (uint)LineMediaMode.LINEMEDIAMODE_INTERACTIVEVOICE;
l_callparams.dwCallParamFlags = (uint)LineCallParamFlags.LINECALLPARAMFLAGS_IDLE;
l_callparams.dwAddressMode = (uint)LineAddressMode.LINEADDRESSMODE_ADDRESSID;
l_callparams.dwAddressID = Line.Addresses[0].AddressID;
l_callparams.dwDisplayableAddressSize = l_TranslateOutput.dwDisplayableStringSize;
l_callparams.dwDisplayableAddressOffset = l_SizeOfCallParams;
int rawsize = (int)l_SizeOfCallParams+(int)l_TranslateOutput.dwDisplayableStringSize;
IntPtr l_ParamBuffer = Marshal.AllocHGlobal( rawsize );
IntPtr l_PhoneBuffer = Marshal.AllocHGlobal( (int)l_TranslateOutput.dwDisplayableStringSize );
Marshal.StructureToPtr( l_callparams, l_ParamBuffer, false );
Marshal.Copy( l_buffer, (int)l_TranslateOutput.dwDialableStringOffset, l_PhoneBuffer, (int)l_TranslateOutput.dwDialableStringSize );
Marshal.WriteIntPtr(l_ParamBuffer, l_PhoneBuffer);

l_MakeCallRequestID = lineMakeCall(Line.hLine, out hCall,l_DialablePhoneNum, 0, l_ParamBuffer);

For the call params structure I did have to add the following element for it to compile

public uint dwAddressType;

Thanks

Harry



Answer this question

Trying to use lineMakeCall()

  • Kasper Schou

    You need to lookup the TAPI error received:-

    -2147483595

    which is

    0x80000035

    Which in tapi.h is

    LINEERR_INVALPOINTER 0x80000035

    This would indicate to me you have something wrong with your LINECALLPARAMS

    Peter



  • Trying to use lineMakeCall()