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!

MiTai SDK with .net 4

Status
Not open for further replies.

septopus

Programmer
Jun 18, 2009
4
0
0
US
Hello all, maybe somebody here can help me? I'm a .net programmer (mostly vb.net) and my company has purchased the MiTel SDKs, it appears that they only come with cpp native code dlls so.. Can anybody assist me with either platform invoke signatures or other code/info on how to use these within managed code(pref. vb.net but c# would be fine too..) Where to find the signatures/how to generate them/etc.. Or if there's an easier way to go about this?.. I'm starting to learn cpp but it'll be a while before I'm proficient enough to use cpp directly.
 
See Interop with Native code with .NET on MSDN.
You can identify entry points into MINET dlls and map them to methods of a class defined in managed code domain. It is a little bit tricky to convert structured data parameters and pointers but possible.
 
LOL - I'm only commenting because I find it hilarious that what you guys are communicating is complete and utter giberish to me. [3eyes]

*******************************************************
Occam's Razor - All things being equal, the simplest solution is the right one.
 
kwbMitel: Yeah, I can see that.. ;)

slapin:
Well, I'm quite familiar whith the general idea of how it's supposed to work.. I've read nearly every article on it (msdn or othewise) that google has to offer. I've used platform invoke before, interfacing the windows API and otherwise well documented APIs that have lots of examples available.

I've tried using the interop assistant to help generate the signatures, unfortunately it's erroring out when I attempt to load the DLL. "The module was expected to contain an assembly manifest.".. Nearly every other tool that I've found that is supposed to assist with this process has one or another problem that prevents my success.

Mitel's only sample code, their "MiTAI Browser" is huge, written in CPP and does absolutely EVERYTHING that the SDK allows, not to mention also has a UI and all sorts of other code that just confuses the heck out of me. Making it less than helpful for somebody with little to no CPP experience/knowledge.

If you have any tips/hints/links that you think might help me, I would be very greatful...
 
Drop me a message. tvman_us (replace with at sign) yahoo dot com. I'm interesing to take a look at the latest SDK :)
 
Hey slapin,

I'll drop you a line on monday. I'm not sure how much of a "look" I can give you regarding the SDK it's self.. Licensing issues and such, but I'll get ahold of you then and we'll go from there.
 
In the meantime, if any other programmers out there have any clue what I'm talking about it would be great to hear from you.. Please? ;) lol
 
I have a clue! We are in the process of writing a wrapper round the whole MitelClient80.dll

Progress is quite good so far, I don't know what I can do with it once I've finished, i.e. I don't know if Mitel will complain if I release it opensource. Here are some pointers:

DLL signature:
Code:
[DllImport(@"C:\Program Files\Mitel\MiSN_SDK\MiTAI\Bin\MitaiClient80.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl, EntryPoint = "#1")] public static extern int SXInit(__arglist);

Call:
Code:
    string LogDirectory = "c:\mitel_log";
    int result = ImportDLL.SXInit(__arglist(
        Constant.SX_STANDARD_CMD_RESPONSE_EVENT,
        Constant.SX_LOG_DIR, LogDirectory, 
        0));

    if (result != 0) throw Errors.trapError(result);
Callback delegate:
Code:
        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        public delegate void MyCallback(System.IntPtr pEvent, System.IntPtr lpData);
This code is c#.net, and we've done more with error handling (throws typed exceptions) and events (creates an event class) we are now working on setting up multicast delegates and raising events properly, once we've decided on the structure...

Steve.


 
Check Mitel licence agreement if you plan to release to open source. I think if you redistribute runtime package of MiTAI only it should not cause any issies.
 
Hi steeviet,

Do you have some c# code or a project for us?
 
Can you give a hint to monitoring a extension?

thanks
 
We are going to write a wrapper around the CPP Mitai library to use it in a c# environment. Can you share your code?

Thanks!

 
I'm currently discussing its release with Mitel, they seem quite positive and are reviewing my code.

You could expect a response sooner but I'm off work till 4th November getting married and enjoying my honeymoon :) I'm afraid you'll have to wait till I return for me to pass on the response.


Steve.

 
steeviet, Mitel are supporting C#? Because I thought they only support C++

 
No, I think we are some way from Mitel supporting c#, but who am I to say!

They have said in principle they would be supportive of making the wrapper I wrote available to other MSA developers through an open source or other similar model. I'm working with them so that I don't breach my companies agreement with Mitel by distributing copyright or proprietary code as open source.

Thinking ahead, Sourceforge and LGPL... any comments?


Steve
 
Even LGPL licensing can rise some questions regarding linking to proprietary library. The easy way would be implementing some sort of IPC interface which will communicate to closed source, but free wrapper around MiTAI lib. This way if wrapper is properly licensed and allowed for distribution, nothing will stop you from using it with open source connection library. I don't think it will introduce any significant overhead and slowdown the application.
 
Congratulations steeviet!

We are waiting news, I am stuck writing callbacks in C#.. if you can give me a hint i really apreciate.

 
we also have some big problems managing callback and retriving event detial using SXGetEvent()
 
Hi,

I was wondering if anyone had got any further with this?

I've been struggling with this for quite a while now, but I've been able to connect to the PBX, set monitors on the phones and get the call backs from the phones, but we are having some problems get the correct data from the SXEvent struct.

I've tried to convert the structs as best i can to c#, but i can't seem to get all of the data into the correct format, specifically anything that is defined as SXDigits.

I've tried defining SXDigits as char[30], which is how its referenced in the c++ program mitel provided, but I then get an error telling me that I can't mix reference types and value types in a struct. I've also tried defining it as an IntPtr, but this only allows me to get the first 4 digits and i can't seem to find a way to get the rest of the digits.

Any help anyone could give this would be greatly appreciated.

Thanks,

Ryan
 
Try this...

Not pretty but it works for me.

Code:
        public struct SXNumber
        {

            public CharsDN number;
            public uint data_type;
            public uint trunk_number;
            public uint number_type;
            public short so_main_dn;
            public short eo_main_dn;
            public short so_sub_dn;
            public short eo_sub_dn;
            public SXDigits networkNumber;
        }

        public struct SXDigits
        {
            public CharsDN digits;
        }

        public struct CharsDN
        {
            public char char00;
            public char char01;
            public char char02;
            public char char03;
            public char char04;
            public char char05;
            public char char06;
            public char char07;
            public char char08;
            public char char09;
            public char char0A;
            public char char0B;
            public char char0C;
            public char char0D;
            public char char0E;
            public char char0F;
            public char char10;
            public char char11;
            public char char12;
            public char char13;
            public char char14;
            public char char15;
            public char char16;
            public char char17;
            public char char18;
            public char char19;
            public char char1A;
            public char char1B;
            public char char1C;
            public char char1D;

            public override string ToString()
            {
                string retString = 
                char00.ToString() + char01.ToString() + char02.ToString() + char03.ToString() +
                char04.ToString() + char05.ToString() + char06.ToString() + char07.ToString() +
                char08.ToString() + char09.ToString() + char0A.ToString() + char0B.ToString() +
                char0C.ToString() + char0D.ToString() + char0E.ToString() + char0F.ToString() +
                char10.ToString() + char11.ToString() + char12.ToString() + char13.ToString() +
                char14.ToString() + char15.ToString() + char16.ToString() + char17.ToString() +
                char18.ToString() + char19.ToString() + char1A.ToString() + char1B.ToString() +
                char1C.ToString() + char1D.ToString();
                return retString.Remove(retString.IndexOf('\0'));
            }
        }

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top