Index: pjproject/trunk/aconfigure
===================================================================
--- pjproject/trunk/aconfigure	(revision 5734)
+++ pjproject/trunk/aconfigure	(revision 5735)
@@ -701,4 +701,5 @@
 ac_linux_poll
 ac_os_objs
+ac_target_arch
 EGREP
 GREP
@@ -5061,8 +5062,10 @@
 fi
 
+
 case $target in
     *android*)
 	$as_echo "#define PJ_ANDROID 1" >>confdefs.h
 
+	ac_target_arch=$TARGET_ABI
 	;;
     *mingw* | *cygw* | *win32* | *w32* )
@@ -5077,4 +5080,5 @@
 	$as_echo "#define PJ_DARWINOS 1" >>confdefs.h
 
+    	ac_target_arch=$ARCH_VAL
 	;;
     *linux*)
Index: pjproject/trunk/aconfigure.ac
===================================================================
--- pjproject/trunk/aconfigure.ac	(revision 5734)
+++ pjproject/trunk/aconfigure.ac	(revision 5735)
@@ -147,7 +147,9 @@
 dnl Legacy macros
 dnl
+AC_SUBST(ac_target_arch)
 case $target in
     *android*)
 	AC_DEFINE(PJ_ANDROID,1)
+	ac_target_arch=$TARGET_ABI
 	;;
     *mingw* | *cygw* | *win32* | *w32* )
@@ -158,4 +160,5 @@
     *darwin*)
 	AC_DEFINE(PJ_DARWINOS,1)
+    	ac_target_arch=$ARCH_VAL
 	;;
     *linux*)
Index: pjproject/trunk/build.mak.in
===================================================================
--- pjproject/trunk/build.mak.in	(revision 5734)
+++ pjproject/trunk/build.mak.in	(revision 5735)
@@ -8,4 +8,5 @@
 export HOST_NAME := unix
 export CC_NAME := gcc
+export TARGET_ARCH := @ac_target_arch@
 export TARGET_NAME := @target@
 export CROSS_COMPILE := @ac_cross_compile@
Index: pjproject/trunk/pjsip-apps/src/swig/Makefile
===================================================================
--- pjproject/trunk/pjsip-apps/src/swig/Makefile	(revision 5734)
+++ pjproject/trunk/pjsip-apps/src/swig/Makefile	(revision 5735)
@@ -2,8 +2,12 @@
 
 ifneq ($(findstring android,$(TARGET_NAME)),)
-  # no python for android
-  DIRS = java
+    # no python for android
+    DIRS = java csharp
 else
-  DIRS = python java
+    ifneq ($(findstring ios,$(TARGET_NAME)),)
+  	DIRS = csharp
+    else
+  	DIRS = python java
+    endif
 endif
 
@@ -29,4 +33,7 @@
 	done
 
+csharp:
+	$(MAKE) $(MAKE_FLAGS) -C csharp $@
+
 symbols.i: symbols.lst
 	@echo ** Warning **: file symbols.i is out of date. Run 'make symbol'.
Index: pjproject/trunk/pjsip-apps/src/swig/csharp/Makefile
===================================================================
--- pjproject/trunk/pjsip-apps/src/swig/csharp/Makefile	(revision 5735)
+++ pjproject/trunk/pjsip-apps/src/swig/csharp/Makefile	(revision 5735)
@@ -0,0 +1,65 @@
+include ../../../../build.mak
+include ../../../../build/common.mak
+
+ifneq ($(findstring android,$(TARGET_NAME)),)
+    OS=android
+else
+    ifneq ($(findstring ios,$(TARGET_NAME)),)
+	OS=ios
+    endif
+endif
+
+SWIG_FLAGS += -w312
+
+PROJ_NAME=pjsua2xamarin
+OUT_DIR=$(PROJ_NAME)/$(PROJ_NAME)/pjsua2
+NAMESPACE=$(PROJ_NAME).pjsua2
+
+ARCH=$(TARGET_ARCH)
+
+ifeq ($(OS),android)
+    LIBPJSUA2_DIR=$(PROJ_NAME)/Droid/lib/$(ARCH)
+    LIBPJSUA2=$(LIBPJSUA2_DIR)/libpjsua2.so
+endif
+ifeq ($(OS),ios)
+    LIBPJSUA2_DIR=$(PROJ_NAME)/iOS/lib/$(ARCH)
+    LIBPJSUA2=$(LIBPJSUA2_DIR)/libpjsua2.a
+endif
+
+# Build settings
+MY_CFLAGS	 := $(PJ_CXXFLAGS) $(CFLAGS)
+MY_LDFLAGS	 := $(PJ_LDXXFLAGS) $(PJ_LDXXLIBS) $(LDFLAGS)
+
+.PHONY: all install uninstall
+
+all: $(LIBPJSUA2) sample
+
+$(LIBPJSUA2): $(OUT_DIR)/pjsua2_wrap.o
+	mkdir -p $(LIBPJSUA2_DIR)
+ifeq ($(OS),android)
+	$(PJ_CXX) -shared -o $(LIBPJSUA2) $(OUT_DIR)/pjsua2_wrap.o \
+		$(MY_CFLAGS) $(MY_LDFLAGS)
+endif
+ifeq ($(OS),ios)
+	$(AR) $(LIBPJSUA2) $(AR_FLAGS) $(OUT_DIR)/pjsua2_wrap.o $(PJ_LIBXX_FILES)
+endif
+
+$(OUT_DIR)/pjsua2_wrap.o: $(OUT_DIR)/pjsua2_wrap.cpp
+	$(PJ_CXX) -c $(OUT_DIR)/pjsua2_wrap.cpp -o $(OUT_DIR)/pjsua2_wrap.o \
+		$(MY_CFLAGS)
+
+$(OUT_DIR)/pjsua2_wrap.cpp: ../pjsua2.i ../symbols.i Makefile $(SRCS)
+	mkdir -p $(OUT_DIR)
+	swig $(SWIG_FLAGS) -namespace $(NAMESPACE) -csharp -o $(OUT_DIR)/pjsua2_wrap.cpp ../pjsua2.i
+	
+sample: sample.cs
+	@echo "Copying sample code..."
+	cp sample.cs $(PROJ_NAME)/$(PROJ_NAME)
+
+clean distclean realclean:
+	rm -rf $(OUT_DIR)/*
+	rm -rf $(LIBPJSUA2_DIR)/*
+
+install:
+
+uninstall:
Index: pjproject/trunk/pjsip-apps/src/swig/csharp/sample.cs
===================================================================
--- pjproject/trunk/pjsip-apps/src/swig/csharp/sample.cs	(revision 5735)
+++ pjproject/trunk/pjsip-apps/src/swig/csharp/sample.cs	(revision 5735)
@@ -0,0 +1,89 @@
+﻿/* $Id $ */
+/*
+ * Copyright (C) 2018-2018 Teluu Inc. (http://www.teluu.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+using System;
+using pjsua2xamarin.pjsua2;
+
+namespace pjsua2xamarin
+{
+    public class MyAccount : Account
+    {
+        override public void onRegState(OnRegStateParam prm)
+        {
+	    AccountInfo ai = getInfo();
+	    Console.WriteLine("***" + (ai.regIsActive? "": "Un") +
+	    		      "Register: code=" + prm.code);
+        }
+    }
+
+    public class MyLogWriter : LogWriter
+    {
+        override public void write(LogEntry entry)
+        {
+            Console.WriteLine(entry.msg);
+        }
+    }
+
+    public class sample
+    {
+        public static Endpoint ep = new Endpoint();
+        public static MyLogWriter writer = new MyLogWriter();
+
+        public sample()
+        {
+        }
+
+        public void test1()
+        {
+            try {
+                ep.libCreate();
+
+                // Init library
+                EpConfig epConfig = new EpConfig();
+                epConfig.logConfig.writer = writer;
+                ep.libInit(epConfig);
+
+                // Create transport
+                TransportConfig tcfg = new TransportConfig();
+                tcfg.port = 5080;
+                ep.transportCreate(pjsip_transport_type_e.PJSIP_TRANSPORT_UDP,
+                		   tcfg);
+                ep.transportCreate(pjsip_transport_type_e.PJSIP_TRANSPORT_TCP,
+                		   tcfg);
+
+                // Start library
+                ep.libStart();
+                Console.WriteLine("*** PJSUA2 STARTED ***");
+
+                // Add account
+                AccountConfig accCfg = new AccountConfig();
+    		accCfg.idUri = "sip:test1@pjsip.org";
+    		accCfg.regConfig.registrarUri = "sip:sip.pjsip.org";
+    		accCfg.sipConfig.authCreds.Add(
+    		    new AuthCredInfo("digest", "*", "test1", 0, "test1") );
+                MyAccount acc = new MyAccount();
+                acc.create(accCfg);
+
+                ep.libDestroy();
+            } catch (Exception err) {
+                Console.WriteLine("Exception: " + err.Message);
+            }
+        }
+    }
+}
Index: pjproject/trunk/pjsip-apps/src/swig/symbols.i
===================================================================
--- pjproject/trunk/pjsip-apps/src/swig/symbols.i	(revision 5734)
+++ pjproject/trunk/pjsip-apps/src/swig/symbols.i	(revision 5735)
@@ -176,5 +176,5 @@
 typedef enum pjsua_create_media_transport_flag {PJSUA_MED_TP_CLOSE_MEMBER = 1} pjsua_create_media_transport_flag;
 
-typedef enum pjsua_snd_dev_id {PJSUA_SND_DEFAULT_CAPTURE_DEV = PJMEDIA_AUD_DEFAULT_CAPTURE_DEV, PJSUA_SND_DEFAULT_PLAYBACK_DEV = PJMEDIA_AUD_DEFAULT_PLAYBACK_DEV, PJSUA_SND_NO_DEV = PJMEDIA_AUD_INVALID_DEV, PJSUA_SND_NULL_DEV = -99} pjsua_snd_dev_id;
+typedef enum pjsua_snd_dev_id {PJSUA_SND_DEFAULT_CAPTURE_DEV = -1, PJSUA_SND_DEFAULT_PLAYBACK_DEV = -2, PJSUA_SND_NO_DEV = -3, PJSUA_SND_NULL_DEV = -99} pjsua_snd_dev_id;
 
 typedef enum pjsua_snd_dev_mode {PJSUA_SND_DEV_SPEAKER_ONLY = 1, PJSUA_SND_DEV_NO_IMMEDIATE_OPEN = 2} pjsua_snd_dev_mode;
