Linphone C# wrapper

Version 25.1 by Sylvain Berfini on 2020/01/30 14:19

We provide a C# wrapper for LibLinphone that can be used in a Xamarin project.

Generating the C# wrapper

The C# wrapper is automatically generated from the documentation in the code (like the Python/C++ wrappers) which is created when Linphone is compiled.

So to generate the C# wrapper, you must first compile Linphone successfuly. Once you did it, go into the wrappers/csharp/ directory of the linphone repository, and execute the following command:

python genwrapper.py $LINPHONE_PATH/coreapi/help/doc/xml/

The output of is one file named LinphoneWrapper.cs that contains everything. Depending on your project structure, you must copy it to the right place (you can use genwrapper's -o argument to create the file directly at the right place):

  • If you use a Native Portable project (using Portable Class Library, PCL), LinphoneWrapper.cs can't go in it because DllImport ins't supported. This means you have to copy LinphoneWrapper.cs in each one of your target Projects (for example LinphoneXamarin.Droid, LinphoneXamarin.iOS, etc...) ;
  • If you use a Native Shared project, LinphoneWrapper.cs can go in the shared project as long as each target project references the shared one.

What about Xamarin ?

The C# wrapper has been implemented to enable the development of a Xamarin app based on LibLinphone.

You can find more information about it on this page.