Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SXOpenPBX in C# 1

Status
Not open for further replies.

majidjm

Programmer
Aug 4, 2010
37
0
0
Hi every one
I insttaled Mitel SDK for 3300 CXI. after that, I open the sample which is C++. I saw the SXOpenPBX function there that it has 6 parameters like this:
int iRet = SXOpenPBX(
SX_PBX_HANDLE_PTR, &g_hPBX,
SX_PBX_IPADDRESS, srcSwitchIP,
SX_COMMS_ERROR_PROC, &CommErrorProc,
SX_COMMS_ERROR_DATA_PTR, NULL,
SX_KEEPALIVE_INTERVAL, 40,
NULL);
then I ran MitaiBrowser80.exe and checked the "open ICP" function there which calls SXOpenPBX function too. but here SXOpenPBX function calls deferente parameters type.

I wante to use this function in C# application.
I will appreciate you if you let me know how I can use SXOpenPBX function in C#
thanks again
 
You need to create a wrapper DLL which will marshal all parameters and returns from unmanaged to managed code. There is no standard library for it.
 
would you please write a sample for it (SXOpenPBX)?
I will appreciate you if you give me a sample.
 
would you please write a sample for it (SXOpenPBX) in C#?
I will appreciate you if you give me a sample.
 
how can I create wrapper dll which will marshal all parameters and returns from unmanaged code?
 
I am really suprised that you need to ask these questions.
As a MSA partner you should have access to all the resources and info you require.
Best advice is to call Mitel or arrange for a partner training programme.

Share what you know - Learn what you don't
 
Hi slapin
Thank you for your guid.
I think I couldn't ask my question clear.

I need some information about SXOpenPBX function.

I will appreciate you if you help me and let me know how I can call SxOpenPBX function by C#?
I called it:

[DllImport @"E:\Project\MitelSample\MitelSample\bin\MitaiClient80.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl, EntryPoint = "#1")]
public static extern int SXOpenPBX(__arglist);

private void button1_Click(object sender, EventArgs e)
{
int result, result2 = 0;
if (InitializServer())
{
result = SXOpenPBX(__arglist(false, "192.168.1.1", "8000", "", "40"));
....
}
}

but I got result=1404 and it mean is false. I don't have 2 NIC cards. but I don't know what it's problem.

I real appreciated.
 
First of all you should not use MitaiClient80.dll directly. It expects variable number of arguments and the last one should be NULL. Also it requires to provice a pointer to a callback function. Tipically it is very hard to maintain persistent pointer in managed memory because you disturb normal garbage collector functionality and you can endup with some memory management issues in your application. What you do is creating a hybrid DLL written in C which knows how to work in both worlds, managed and unmanaged.

Also SDK will provide you a number of symbols available in header files in order to maintain consistent naming conventions and interoperability.
 
Hi
How can I set hmonitor_objp parameter in SXMonitor function in C#?
 
Hi
How can I set hmonitor_objp parameter in SXMonitor function in C#?
I read Mitel developer kit but I couldn't understand it.
I will appreciate you if you give me a sample for this problem.
htnaks
 
Please let me know it is correct?
I have to get callback from SXSetCallback and SX_CALLBACK_PROC which sets a callback after SXMonitor in a loop (thread)?

I will appreciate you if you help me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top