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 ?

/!\ iOS SDK doesn't build for now, please prefer to download a pre-compiled SDK at : https://www.linphone.org/snapshots/xamarin/

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

To obtain the SDK and wrapper you either :

  • download it here and unzip the precomiled SDK ;
  • clone the linphone-xamarin repo : git://git.linphone.org/linphone-xamarin.git and run the following commands :
./prepare.py -c
./prepare.py
make

If you only want to build the SDK for Android or iOS you can the following options to your prepare.py command : "-DENABLE_ANDROID=OFF" or "-DENABLE_IOS=OFF".

You can, now, find here how to get started with a LibLinphone Xamarin project !