You can use the below method which now return a string which will be your IMEI.
example on how to call is
string myIMEIstring = getIMEIInfo();
[DllImport("cellcore.dll")]
internal static extern int lineGetGeneralInfo(IntPtr hLine, byte[] bCache);
private string getIMEIInfo()
{
string IMEI;
Tapi t = new Tapi();
t.Initialize();
Line _line = t.CreateLine(0, LINEMEDIAMODE.INTERACTIVEVOICE, LINECALLPRIVILEGE.MONITOR);
byte[] buffer = new byte[512];
BitConverter.GetBytes(512).CopyTo(buffer, 0);
if (lineGetGeneralInfo(_line.hLine, buffer) != 0)
{
throw new System.ComponentModel.Win32Exception(System.Runtime.InteropServices.Marshal.GetLastWin32Error(), "TAPI Error: " + System.Runtime.InteropServices.Marshal.GetLastWin32Error().ToString("X"));
}
int serialsize = BitConverter.ToInt32(buffer, 36);
int serialoffset = BitConverter.ToInt32(buffer, 40);
IMEI = System.Text.Encoding.Unicode.GetString(buffer, serialoffset, serialsize);
IMEI = IMEI.Substring(0, IMEI.IndexOf(Convert.ToChar(0)));
_line.Dispose();
t.Shutdown();
return (IMEI);
}