diff --git a/daemon/configure.ac b/daemon/configure.ac
index c53f29b53338c831a910c682705dccb725d6029f..bcb9cd866365eada3b3b20f09bec4779fffa9dde 100644
--- a/daemon/configure.ac
+++ b/daemon/configure.ac
@@ -44,6 +44,8 @@ case "${host_os}" in
     SYS=linux
     # Necessary for linking .a to a .so
     LDFLAGS+=" -Wl,-Bsymbolic"
+    # Needed for plugin system
+    LDFLAGS+=" -ldl"
     ;;
   darwin*)
     SYS=darwin
@@ -343,6 +345,18 @@ AS_IF([test "x$with_dbus" = "xyes"], [
        AM_CONDITIONAL(RING_DBUS, false));
 
 
+dnl Check for libav
+PKG_CHECK_MODULES(LIBAVCODEC, libavcodec >= 53.5.0,, AC_MSG_ERROR([Missing libavcodec development files]))
+LIBAVCODEC_CFLAGS="${LIBAVCODEC_CFLAGS} -D__STDC_CONSTANT_MACROS"
+
+PKG_CHECK_MODULES(LIBAVFORMAT, libavformat >= 54.20.3,, AC_MSG_ERROR([Missing libavformat development files]))
+
+PKG_CHECK_MODULES(LIBSWSCALE, libswscale >= 1.1.0,, AC_MSG_ERROR([Missing libswscale development files]))
+
+PKG_CHECK_MODULES(LIBAVDEVICE, libavdevice >= 53.0.0,, AC_MSG_ERROR([Missing libavdevice development files]))
+
+PKG_CHECK_MODULES(LIBAVUTIL, libavutil >= 51.0.0,, AC_MSG_ERROR([Missing libavutil development files]))
+
 dnl Video is default-enabled
 AC_ARG_ENABLE([video], AS_HELP_STRING([--disable-video], [Disable video]))
 
@@ -350,30 +364,12 @@ AS_IF([test "x$enable_video" != "xno"],
       [
         AC_DEFINE(RING_VIDEO, [], [Video support enabled])
         AM_CONDITIONAL(RING_VIDEO, true)
-
-        PKG_CHECK_MODULES(LIBAVCODEC, libavcodec >= 53.5.0,, AC_MSG_ERROR([Missing libavcodec development files]))
-        LIBAVCODEC_CFLAGS="${LIBAVCODEC_CFLAGS} -D__STDC_CONSTANT_MACROS"
-
-        PKG_CHECK_MODULES(LIBAVFORMAT, libavformat >= 54.20.3,, AC_MSG_ERROR([Missing libavformat development files]))
-
-        PKG_CHECK_MODULES(LIBSWSCALE, libswscale >= 1.1.0,, AC_MSG_ERROR([Missing libswscale development files]))
-
-        PKG_CHECK_MODULES(LIBAVDEVICE, libavdevice >= 53.0.0,, AC_MSG_ERROR([Missing libavdevice development files]))
-
-        PKG_CHECK_MODULES(LIBAVUTIL, libavutil >= 51.0.0,, AC_MSG_ERROR([Missing libavutil development files]))
-
         PKG_CHECK_MODULES(UDEV, libudev,, AC_MSG_ERROR([Missing libudev development files]))
     ],
     [
      AM_CONDITIONAL(RING_VIDEO, false)
-     AC_DEFINE_UNQUOTED([USE_CCRTP], 1, [Use ccrtp instead of libavformat])
      ]);
 
-LIBCCRTP_MIN_VERSION=1.3.0
-PKG_CHECK_MODULES([CCRTP], [libccrtp] >= ${LIBCCRTP_MIN_VERSION},, [
-                   PKG_CHECK_MODULES([CCRTP], [libccrtp1] >= ${LIBCCRTP_MIN_VERSION},, AC_MSG_ERROR([Missing ccrtp development files]))
-        ])
-
 dnl TLS support is enabled if it's installed and up to date
 AC_ARG_WITH([tls],
   [AS_HELP_STRING([--with-tls],
@@ -388,25 +384,6 @@ AS_CASE(["$with_tls"],
 AC_DEFINE_UNQUOTED([HAVE_TLS], `if test $HAVE_GNUTLS -eq 1; then echo 1; else echo 0; fi`, [Define if you have tls support])
 AM_CONDITIONAL(BUILD_TLS, test "$HAVE_GNUTLS" -eq 1)
 
-# ZRTP
-# required dependency(ies): libzrtp
-dnl Check for libzrtpcpp, a ccRTP extension providing zrtp key exchange
-AC_ARG_WITH([zrtp],
-    [AS_HELP_STRING([--without-zrtp], [disable support for zrtp])],
-    [],
-    [with_zrtp=no])
-AS_IF([test "x$with_zrtp" = "xyes"], [
-       PKG_CHECK_MODULES([ZRTPCPP], libzrtpcpp >= 2.3.0, [with_zrtp_configure=yes],
-           dnl Fallback to older version
-           [PKG_CHECK_MODULES([ZRTPCPP], libzrtpcpp >= 1.3.0, [with_zrtp_configure=no],
-               AC_MSG_ERROR([Missing zrtp development files]))])
-    ]);
-
-dnl This is a workaround until libzrtpcpp gets a version macro
-AC_DEFINE_UNQUOTED([HAVE_ZRTP], `if test "x$with_zrtp" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have zrtp support])
-AC_DEFINE_UNQUOTED([HAVE_ZRTP_CONFIGURE], `if test "x$with_zrtp_configure" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have zrtp >= 2.3.0])
-AM_CONDITIONAL(BUILD_ZRTP, test "x$with_zrtp" = "xyes" )
-
 # Instant Messaging
 # required dependency(ies): libxpat
 AC_ARG_WITH([instant_messaging],
@@ -598,22 +575,23 @@ AC_CONFIG_FILES([Makefile \
                  src/im/Makefile \
                  src/iax/Makefile \
                  src/ringdht/Makefile \
-                 src/audio/Makefile \
-                 src/audio/audiortp/Makefile \
-                 src/audio/pulseaudio/Makefile \
-                 src/audio/alsa/Makefile \
-                 src/audio/opensl/Makefile \
-                 src/audio/jack/Makefile \
-                 src/audio/coreaudio/Makefile \
-                 src/audio/sound/Makefile \
-                 src/audio/codecs/Makefile \
+                 src/media/Makefile \
+                 src/media/audio/Makefile \
+                 src/media/audio/audiortp/Makefile \
+                 src/media/audio/pulseaudio/Makefile \
+                 src/media/audio/alsa/Makefile \
+                 src/media/audio/opensl/Makefile \
+                 src/media/audio/jack/Makefile \
+                 src/media/audio/coreaudio/Makefile \
+                 src/media/audio/sound/Makefile \
+                 src/media/audio/codecs/Makefile \
                  src/config/Makefile \
                  src/client/Makefile \
                  src/hooks/Makefile \
                  src/history/Makefile \
-                 src/video/Makefile \
-                 src/video/v4l2/Makefile \
-                 src/video/test/Makefile \
+                 src/media/video/Makefile \
+                 src/media/video/v4l2/Makefile \
+                 src/media/video/test/Makefile \
                  test/Makefile \
                  ringtones/Makefile \
                  man/Makefile \
diff --git a/daemon/contrib/src/ccrtp/SHA512SUMS b/daemon/contrib/src/ccrtp/SHA512SUMS
deleted file mode 100644
index 9701adead230a13e77e2ed2bf2053c947cbd440e..0000000000000000000000000000000000000000
--- a/daemon/contrib/src/ccrtp/SHA512SUMS
+++ /dev/null
@@ -1 +0,0 @@
-8eb07e2119903bf52dfcc6a7932843bdf14ef686302f333844713c48ba723b5c0211c4b893f29024d4875c3f747fe94eaeadc8a9a4b9993b9766a1373f486062  ccrtp-6d4f1b9ebe9a9b93ec45927b7d8bcda497cc19f6.tar.gz
diff --git a/daemon/contrib/src/ccrtp/rules.mak b/daemon/contrib/src/ccrtp/rules.mak
deleted file mode 100644
index 73de7b448680561767d229d53bf76143b3f1d52e..0000000000000000000000000000000000000000
--- a/daemon/contrib/src/ccrtp/rules.mak
+++ /dev/null
@@ -1,27 +0,0 @@
-# CCRTP
-# FIXME: switch to next release when it's out
-CCRTP_VERSION := 6d4f1b9ebe9a9b93ec45927b7d8bcda497cc19f6
-CCRTP_URL := $(GNUTELEPHONY)/ccrtp/archive/$(CCRTP_VERSION).tar.gz
-
-PKGS += ccrtp
-ifeq ($(call need_pkg,'libccrtp >= 2.0.3'),)
-PKGS_FOUND += ccrtp
-endif
-
-DEPS_ccrtp = ucommon gcrypt gnutls
-
-$(TARBALLS)/ccrtp-$(CCRTP_VERSION).tar.gz:
-	$(call download,$(CCRTP_URL))
-
-.sum-ccrtp: ccrtp-$(CCRTP_VERSION).tar.gz
-
-ccrtp: ccrtp-$(CCRTP_VERSION).tar.gz .sum-ccrtp
-	$(UNPACK)
-	$(UPDATE_AUTOCONFIG) && cd $(UNPACK_DIR)
-	$(MOVE)
-
-.ccrtp: ccrtp
-	mkdir -p $</m4 && $(RECONF)
-	cd $< && $(HOSTVARS) ./configure $(HOSTCONF)
-	cd $< && $(MAKE) install
-	touch $@
diff --git a/daemon/contrib/src/libav/rules.mak b/daemon/contrib/src/libav/rules.mak
index db962b67486710ffd12440ae0279c4bfc387fb37..42962e38d10a97d14acf55a9df181358aa071311 100644
--- a/daemon/contrib/src/libav/rules.mak
+++ b/daemon/contrib/src/libav/rules.mak
@@ -1,6 +1,8 @@
 HASH=HEAD
 LIBAV_SNAPURL := http://git.libav.org/?p=libav.git;a=snapshot;h=$(HASH);sf=tgz
 
+PKGS += libav
+
 LIBAVCONF = \
         --cc="$(CC)"                 \
         --pkg-config="$(PKG_CONFIG)" \
@@ -104,13 +106,6 @@ else # !Windows
 LIBAVCONF += --enable-pthreads
 endif
 
-# Only build on Linux for now, since no one else has implemented video
-ifdef HAVE_LINUX
-ifndef HAVE_ANDROID
-PKGS += libav
-endif
-endif
-
 ifeq ($(call need_pkg,"libavcodec >= 53.5.0 libavformat >= 54.20.3 libswscale libavdevice >= 53.0.0 libavutil >= 51.0.0"),)
 PKGS_FOUND += libav
 endif
diff --git a/daemon/contrib/src/ucommon/rules.mak b/daemon/contrib/src/ucommon/rules.mak
deleted file mode 100644
index 8f86dccece8a56258fbe286c028f39c311f9e83c..0000000000000000000000000000000000000000
--- a/daemon/contrib/src/ucommon/rules.mak
+++ /dev/null
@@ -1,33 +0,0 @@
-# UCOMMON
-# FIXME: switch to next release when it's out
-UCOMMON_VERSION := 907e98d36cdffa1a0c6c0344993fe0a86f1f239f
-UCOMMON_URL := $(GNUTELEPHONY)/ucommon/archive/$(UCOMMON_VERSION).tar.gz
-
-UCOMMON_OPTIONS := --enable-stdcpp --with-pkg-config --disable-utils --disable-tests
-
-ifeq ($(call need_pkg,'ucommon >= ${UCOMMON_VERSION} commoncpp >= ${UCOMMON_VERSION}'),)
-PKGS_FOUND += ucommon
-endif
-
-DEPS_ucommon = gnutls
-
-$(TARBALLS)/ucommon-$(UCOMMON_VERSION).tar.gz:
-	$(call download,$(UCOMMON_URL))
-
-.sum-ucommon: ucommon-$(UCOMMON_VERSION).tar.gz
-	$(warning $@ not implemented)
-	touch $@
-
-ucommon: ucommon-$(UCOMMON_VERSION).tar.gz .sum-ucommon
-	$(UNPACK)
-ifdef HAVE_WIN32
-	$(APPLY) $(SRC)/ucommon/windows_platform.patch
-endif
-	$(UPDATE_AUTOCONFIG) && cd $(UNPACK_DIR)
-	$(MOVE)
-
-.ucommon: ucommon
-	mkdir -p $</m4 && $(RECONF)
-	cd $< && $(HOSTVARS) ./configure $(HOSTCONF) $(UCOMMON_OPTIONS)
-	cd $< && $(MAKE) install
-	touch $@
diff --git a/daemon/contrib/src/ucommon/windows_platform.patch b/daemon/contrib/src/ucommon/windows_platform.patch
deleted file mode 100644
index f6163e406cca8f93f6d2cbcd98d2040af253c1a8..0000000000000000000000000000000000000000
--- a/daemon/contrib/src/ucommon/windows_platform.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- ucommon/inc/ucommon/platform.h.orig	2014-09-09 15:45:10.488481802 -0400
-+++ ucommon/inc/ucommon/platform.h	2014-09-09 15:45:39.268482233 -0400
-@@ -161,7 +161,7 @@
- #if defined(UCOMMON_RUNTIME) || defined(UCOMMON_STATIC)
- #define __SHARED
- #else
--#define __SHARED __EXPORT
-+#define __SHARED __declspec(dllimport) // Fix compile error.
- #endif
-
- #elif UCOMMON_VISIBILITY > 0
diff --git a/daemon/contrib/src/zrtpcpp/SHA512SUMS b/daemon/contrib/src/zrtpcpp/SHA512SUMS
deleted file mode 100644
index efcd32a904e49daf075e511db4176a4822bce54d..0000000000000000000000000000000000000000
--- a/daemon/contrib/src/zrtpcpp/SHA512SUMS
+++ /dev/null
@@ -1 +0,0 @@
-8166fdf7cc0cf9f35ca3245e6152be23e30010bf2113bc4be03c3cafb7c300fd8bd065829c151d05fda748c62d79d4d5d696524b2298effcac2498efd84420d0  libzrtpcpp-2.3.3.tar.gz
diff --git a/daemon/contrib/src/zrtpcpp/forcegcrypt.patch b/daemon/contrib/src/zrtpcpp/forcegcrypt.patch
deleted file mode 100644
index 194d802430e79a895ad40365bb29cfc19db0eca5..0000000000000000000000000000000000000000
--- a/daemon/contrib/src/zrtpcpp/forcegcrypt.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/CMakeLists.txt.orig   2014-05-06 19:35:46.443707232 -0400
-+++ b/CMakeLists.txt    2014-05-06 19:13:04.235686028 -0400
-@@ -107,7 +107,7 @@
- endif()
- 
- # now get info about crypto libraries
--pkg_check_modules(OPENSSL libcrypto>=0.9.8)
-+#pkg_check_modules(OPENSSL libcrypto>=0.9.8)
- if (OPENSSL_FOUND)
-   set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${OPENSSL_INCLUDE_DIRS}) #update include files search directory
-   check_include_files(openssl/bn.h HAVE_OPENSSL_BN_H)
diff --git a/daemon/contrib/src/zrtpcpp/nodemo.patch b/daemon/contrib/src/zrtpcpp/nodemo.patch
deleted file mode 100644
index 977af3bb9093de5c73bc92f78462b7b97486b55e..0000000000000000000000000000000000000000
--- a/daemon/contrib/src/zrtpcpp/nodemo.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- zrtpcpp/CMakeLists.txt.orig	2014-08-01 13:09:30.402259035 -0400
-+++ zrtpcpp/CMakeLists.txt	2014-08-01 13:09:35.089304129 -0400
-@@ -167,10 +167,6 @@
-
- add_subdirectory(src)
-
--if (enable_ccrtp)
--    add_subdirectory(demo)
--endif()
--
- if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/package/)
-     MESSAGE(STATUS "package dir not found")
-     file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/package/)
diff --git a/daemon/contrib/src/zrtpcpp/rules.mak b/daemon/contrib/src/zrtpcpp/rules.mak
deleted file mode 100644
index cd26c18656c059908c7993503db05b6f28470003..0000000000000000000000000000000000000000
--- a/daemon/contrib/src/zrtpcpp/rules.mak
+++ /dev/null
@@ -1,33 +0,0 @@
-# ZRTPCPP
-ZRTPCPP_VERSION := 2.3.3
-ZRTPCPP_URL := $(GNUTELEPHONY)/ZRTPCPP/archive/v$(ZRTPCPP_VERSION).tar.gz
-
-PKGS += zrtpcpp
-ifeq ($(call need_pkg,'libzrtpcpp >= 2.0.0'),)
-PKGS_FOUND += zrtpcpp
-endif
-
-DEPS_zrtpcpp = ccrtp ucommon gcrypt
-
-ZRTPCPP_CMAKECONF := -DBUILD_STATIC:BOOL=ON \
-                     -DBUILD_SHARED:BOOL=OFF \
-                     -DBUILD_SHARED_LIBS:BOOL=OFF
-
-$(TARBALLS)/libzrtpcpp-$(ZRTPCPP_VERSION).tar.gz:
-	$(call download,$(ZRTPCPP_URL))
-
-.sum-zrtpcpp: libzrtpcpp-$(ZRTPCPP_VERSION).tar.gz
-
-zrtpcpp: libzrtpcpp-$(ZRTPCPP_VERSION).tar.gz .sum-zrtpcpp
-	$(UNPACK)
-	mv ZRTPCPP-$(ZRTPCPP_VERSION) libzrtpcpp-$(ZRTPCPP_VERSION)
-	$(APPLY) $(SRC)/zrtpcpp/forcegcrypt.patch
-	$(APPLY) $(SRC)/zrtpcpp/threadcbsupdate.patch
-	$(APPLY) $(SRC)/zrtpcpp/standardheader.patch
-	$(APPLY) $(SRC)/zrtpcpp/nodemo.patch
-	$(MOVE)
-
-.zrtpcpp: zrtpcpp toolchain.cmake
-	cd $< && $(HOSTVARS) $(CMAKE) . $(ZRTPCPP_CMAKECONF)
-	cd $< && $(MAKE) install VERBOSE=1
-	touch $@
diff --git a/daemon/contrib/src/zrtpcpp/standardheader.patch b/daemon/contrib/src/zrtpcpp/standardheader.patch
deleted file mode 100644
index 9f5faedcf252a6f59515dae6f8517ed43318e90d..0000000000000000000000000000000000000000
--- a/daemon/contrib/src/zrtpcpp/standardheader.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/src/libzrtpcpp/crypto/gcrypt/InitializeGcrypt.cpp.orig	2014-06-25 20:40:20.000000000 -0400
-+++ b/src/libzrtpcpp/crypto/gcrypt/InitializeGcrypt.cpp	2014-06-25 20:40:32.000000000 -0400
-@@ -17,7 +17,7 @@
- 
- #include <stdio.h>
- 
--#include <malloc.h>
-+#include <stdlib.h>
- #include <errno.h>
- #include <gcrypt.h>
diff --git a/daemon/contrib/src/zrtpcpp/threadcbsupdate.patch b/daemon/contrib/src/zrtpcpp/threadcbsupdate.patch
deleted file mode 100644
index 6a9ddb29dd34e317f2fd7cd577c6e41d12960c04..0000000000000000000000000000000000000000
--- a/daemon/contrib/src/zrtpcpp/threadcbsupdate.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- a/src/libzrtpcpp/crypto/gcrypt/InitializeGcrypt.cpp.orig	2014-06-12 17:36:14.367890764 -0400
-+++ b/src/libzrtpcpp/crypto/gcrypt/InitializeGcrypt.cpp	2014-06-12 17:36:52.899889626 -0400
-@@ -68,9 +68,12 @@
- }
-  
- static struct gcry_thread_cbs gcry_threads = { 
--    GCRY_THREAD_OPTION_PTHREAD, NULL,
-+    GCRY_THREAD_OPTION_PTHREAD,
-+#if 0
-+    NULL,
-     gcry_thread_mutex_init, gcry_thread_mutex_destroy,
-     gcry_thread_mutex_lock, gcry_thread_mutex_unlock 
-+#endif
- };
- 
- #else
diff --git a/daemon/globals.mak b/daemon/globals.mak
index 90f2f5162de1a6c46364c2bee1dd6a17e6e39fb3..c6e53e47bb0f85af1d0394d3808623fcc819df8f 100644
--- a/daemon/globals.mak
+++ b/daemon/globals.mak
@@ -24,6 +24,7 @@ endif
 AM_CPPFLAGS = \
 	-I$(src)/src \
 	-I$(src)/src/config \
+	-I$(src)/src/media \
 	-I$(src)/test \
 	-I$(src)/src/public \
 	$(SIP_CFLAGS) \
diff --git a/daemon/src/Makefile.am b/daemon/src/Makefile.am
index 37535306928462a9844d78220cc7ebbb592382ca..efa64bd00906f589797d091403ae8323923001ac 100644
--- a/daemon/src/Makefile.am
+++ b/daemon/src/Makefile.am
@@ -1,9 +1,8 @@
 include ../globals.mak
 
 if RING_VIDEO
-RING_VIDEO_SUBDIR = video
-RING_VIDEO_LIBS=./video/libvideo.la \
-			   ./video/v4l2/libv4l2.la
+RING_VIDEO_LIBS=./media/video/libvideo.la \
+			   ./media/video/v4l2/libv4l2.la
 endif
 
 if BUILD_INSTANT_MESSAGING
@@ -35,7 +34,7 @@ TLS_LIB = @GNUTLS_LIBS@
 TLS_CFLAGS = @GNUTLS_CFLAGS@
 endif
 
-SUBDIRS = client audio config hooks history sip $(IAX_SUBDIR) $(RINGACC_SUBDIR) $(INSTANT_MESSAGING_SUBDIR) $(RING_VIDEO_SUBDIR)
+SUBDIRS = client media config hooks history sip $(IAX_SUBDIR) $(RINGACC_SUBDIR) $(INSTANT_MESSAGING_SUBDIR) $(RING_VIDEO_SUBDIR)
 
 # libring
 
@@ -43,7 +42,7 @@ lib_LTLIBRARIES = libring.la
 
 libring_la_LIBADD = \
 	./sip/libsiplink.la \
-	./audio/libaudio.la \
+	./media/libmedia.la \
 	./client/libclient.la \
 	./config/libconfig.la \
 	./hooks/libhooks.la \
@@ -54,9 +53,7 @@ libring_la_LIBADD = \
 	$(RING_VIDEO_LIBS)
 
 libring_la_LDFLAGS = \
-		@ZRTPCPP_LIBS@ \
 		@PJPROJECT_LIBS@ \
-		@CCRTP_LIBS@ \
 		@ALSA_LIBS@ \
 		@PULSEAUDIO_LIBS@ \
 		@SAMPLERATE_LIBS@ \
@@ -72,10 +69,13 @@ if USE_DHT
 libring_la_LDFLAGS += $(OPENDHT_LIBS)
 endif
 
+if HAVE_OSX
+#FIXME necessary for -lintl
+libring_la_LDFLAGS += -L/usr/local/opt/gettext/lib
+endif
+
 libring_la_CFLAGS = \
-		@ZRTPCPP_CFLAGS@ \
 		@PJPROJECT_CFLAGS@ \
-		@CCRTP_CFLAGS@ \
 		@ALSA_CFLAGS@ \
 		@PULSEAUDIO_CFLAGS@ \
 		@SAMPLERATE_CFLAGS@ \
@@ -131,5 +131,4 @@ libring_la_SOURCES = conference.cpp \
 		string_utils.h \
 		string_utils.cpp \
 		rw_mutex.h \
-		ring.h \
 		ring_api.cpp
diff --git a/daemon/src/account.cpp b/daemon/src/account.cpp
index 8d6de36d9dadbbfc0d379ef898cf5be8f696c785..78c014b0c9615c247c1c6d856f2474535e00f3a7 100644
--- a/daemon/src/account.cpp
+++ b/daemon/src/account.cpp
@@ -39,7 +39,7 @@
 #include <iterator>
 
 #ifdef RING_VIDEO
-#include "video/libav_utils.h"
+#include "libav_utils.h"
 #endif
 
 #include "logger.h"
diff --git a/daemon/src/audio/audiortp/Makefile.am b/daemon/src/audio/audiortp/Makefile.am
deleted file mode 100644
index b1e36b05f9a09827cd19ce533bbbe0391d12964b..0000000000000000000000000000000000000000
--- a/daemon/src/audio/audiortp/Makefile.am
+++ /dev/null
@@ -1,37 +0,0 @@
-include $(top_srcdir)/globals.mak
-
-noinst_LTLIBRARIES = libaudiortp.la
-
-if BUILD_ZRTP
-RING_ZRTP_SRC=audio_zrtp_session.h audio_zrtp_session.cpp zrtp_session_callback.cpp zrtp_session_callback.h
-endif
-
-libaudiortp_la_SOURCES = \
-		$(RING_ZRTP_SRC) \
-		base64.c base64.h
-
-if RING_VIDEO
-libaudiortp_la_SOURCES += \
-		avformat_rtp_session.cpp \
-		avformat_rtp_session.h
-
-AM_CXXFLAGS = @LIBAVFORMAT_CFLAGS@
-
-else
-libaudiortp_la_SOURCES += \
-		audio_rtp_session.cpp \
-		audio_symmetric_rtp_session.cpp \
-		audio_rtp_stream.cpp \
-		audio_rtp_factory.cpp \
-		audio_srtp_session.cpp \
-		audio_rtp_session.h \
-		dtmf_event.h \
-		dtmf_event.cpp \
-		audio_rtp_stream.h \
-		audio_rtp_factory.h \
-		audio_symmetric_rtp_session.h \
-		audio_srtp_session.h
-endif
-
-# FIXME
-AM_CPPFLAGS += -I$(top_srcdir)/src
diff --git a/daemon/src/audio/audiortp/audio_rtp_factory.cpp b/daemon/src/audio/audiortp/audio_rtp_factory.cpp
deleted file mode 100644
index e10c4d78026fc6e31a9ceace80a3a74b1fca3b57..0000000000000000000000000000000000000000
--- a/daemon/src/audio/audiortp/audio_rtp_factory.cpp
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- *  Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
- *  Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com>
- *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *  Additional permission under GNU GPL version 3 section 7:
- *
- *  If you modify this program, or any covered work, by linking or
- *  combining it with the OpenSSL project's OpenSSL library (or a
- *  modified version of that library), containing parts covered by the
- *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
- *  grants you additional permission to convey the resulting work.
- *  Corresponding Source for a non-source form of such a combination
- *  shall include the source code for the parts of OpenSSL used as well
- *  as that of the covered work.
- */
-
-#include "audio_rtp_factory.h"
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#if HAVE_ZRTP
-#include "audio_zrtp_session.h"
-#endif
-#include "audio_symmetric_rtp_session.h"
-#include "manager.h"
-#include "sip/sdp.h"
-#include "sip/sipcall.h"
-#include "sip/sipaccount.h"
-#include "logger.h"
-
-namespace ring {
-
-AudioRtpFactory::AudioRtpFactory(SIPCall *ca) : rtpSession_(),
-    audioRtpThreadMutex_(), srtpEnabled_(false), helloHashEnabled_(false),
-    remoteOfferIsSet_(false), call_(ca),
-    keyExchangeProtocol_(NONE)
-{
-    // FIXME: workaround for uncatchable ost::Socket "exceptions"
-    ost::Thread::setException(ost::Thread::throwNothing);
-}
-
-AudioRtpFactory::~AudioRtpFactory()
-{}
-
-void AudioRtpFactory::initConfig()
-{
-    stop();
-
-    const std::string accountId(call_->getAccountId());
-
-    const auto sipaccount = Manager::instance().getAccount<SIPAccount>(accountId);
-
-    if (sipaccount) {
-        srtpEnabled_ = sipaccount->getSrtpEnabled();
-        std::string key(sipaccount->getSrtpKeyExchange());
-
-        if (srtpEnabled_) {
-#if HAVE_ZRTP
-
-            if (key == "sdes")
-                keyExchangeProtocol_ = SDES;
-            else if (key == "zrtp")
-                keyExchangeProtocol_ = ZRTP;
-
-#else
-            keyExchangeProtocol_ = SDES;
-#endif
-        } else {
-            keyExchangeProtocol_ = NONE;
-        }
-
-        helloHashEnabled_ = sipaccount->getZrtpHelloHash();
-    } else {
-        srtpEnabled_ = false;
-        keyExchangeProtocol_ = NONE;
-        helloHashEnabled_ = false;
-    }
-}
-
-void AudioRtpFactory::initSession()
-{
-    std::lock_guard<std::mutex> lock(audioRtpThreadMutex_);
-
-    if (srtpEnabled_) {
-
-        switch (keyExchangeProtocol_) {
-#if HAVE_ZRTP
-            case ZRTP: {
-                const std::string zidFilename(Manager::instance().voipPreferences.getZidFile());
-                rtpSession_.reset(new AudioZrtpSession(*call_, zidFilename, call_->getLocalIp()));
-
-                // TODO: be careful with that. The hello hash is computed asynchronously. Maybe it's
-                // not even available at that point.
-                if (helloHashEnabled_)
-                    call_->getSDP().setZrtpHash(static_cast<AudioZrtpSession *>(rtpSession_.get())->getHelloHash());
-                break;
-            }
-#endif
-
-            case SDES: {
-                rtpSession_.reset(new AudioSrtpSession(*call_));
-                break;
-            }
-
-            default:
-                throw UnsupportedRtpSessionType("Unsupported Rtp Session Exception Type!");
-        }
-    } else {
-#if HAVE_IPV6
-        if (call_->getLocalIp().isIpv6()) {
-            rtpSession_.reset(new AudioSymmetricRtpSessionIPv6(*call_));
-        } else
-#endif
-        {
-            rtpSession_.reset(new AudioSymmetricRtpSession(*call_));
-        }
-    }
-}
-
-std::vector<long>
-AudioRtpFactory::getSocketDescriptors()
-{
-    std::lock_guard<std::mutex> lock(audioRtpThreadMutex_);
-    if (!rtpSession_)
-        throw AudioRtpFactoryException("RTP session was null when trying to get socket descriptors");
-    return rtpSession_->getSocketDescriptors();
-}
-
-void AudioRtpFactory::start(const std::vector<AudioCodec*> &audioCodecs)
-{
-    std::lock_guard<std::mutex> lock(audioRtpThreadMutex_);
-    if (!rtpSession_)
-        throw AudioRtpFactoryException("RTP session was null when trying to start audio thread");
-
-    rtpSession_->startRtpThreads(audioCodecs);
-}
-
-void AudioRtpFactory::stop()
-{
-    std::lock_guard<std::mutex> lock(audioRtpThreadMutex_);
-    rtpSession_.reset();
-}
-
-void AudioRtpFactory::updateSessionMedia(const std::vector<AudioCodec*> &audioCodecs)
-{
-    std::lock_guard<std::mutex> lock(audioRtpThreadMutex_);
-    if (!rtpSession_)
-        throw AudioRtpFactoryException("rtpSession_ was NULL when trying to update IP address");
-
-    rtpSession_->updateSessionMedia(audioCodecs);
-}
-
-void AudioRtpFactory::updateDestinationIpAddress()
-{
-    std::lock_guard<std::mutex> lock(audioRtpThreadMutex_);
-    if (!rtpSession_)
-        throw AudioRtpFactoryException("RTP session was null when trying to update IP address");
-
-    rtpSession_->updateDestinationIpAddress();
-}
-
-#if HAVE_ZRTP
-AudioZrtpSession * AudioRtpFactory::getAudioZrtpSession()
-{
-    std::lock_guard<std::mutex> lock(audioRtpThreadMutex_);
-    if (rtpSession_ and keyExchangeProtocol_ == ZRTP)
-        return static_cast<AudioZrtpSession *>(rtpSession_.get());
-    else
-        throw AudioRtpFactoryException("rtpSession_ is NULL in getAudioZrtpSession");
-}
-#endif
-
-void AudioRtpFactory::initLocalCryptoInfo()
-{
-    std::lock_guard<std::mutex> lock(audioRtpThreadMutex_);
-
-    if (rtpSession_ && keyExchangeProtocol_ == SDES) {
-        AudioSrtpSession *srtp = static_cast<AudioSrtpSession*>(rtpSession_.get());
-        // the context is invalidated and deleted by the call to initLocalCryptoInfo
-        srtp->initLocalCryptoInfo();
-        call_->getSDP().setLocalSdpCrypto(srtp->getLocalCryptoInfo());
-    }
-}
-
-void AudioRtpFactory::initLocalCryptoInfoOnOffHold()
-{
-    std::lock_guard<std::mutex> lock(audioRtpThreadMutex_);
-
-    if (rtpSession_ && keyExchangeProtocol_ == SDES) {
-        AudioSrtpSession *srtp = static_cast<AudioSrtpSession*>(rtpSession_.get());
-        // the context is invalidated and deleted by the call to initLocalCryptoInfo
-        srtp->initLocalCryptoInfoOnOffhold();
-        call_->getSDP().setLocalSdpCrypto(srtp->getLocalCryptoInfo());
-    }
-}
-
-
-void AudioRtpFactory::setRemoteCryptoInfo(SdesNegotiator& nego)
-{
-    std::lock_guard<std::mutex> lock(audioRtpThreadMutex_);
-    if (!rtpSession_)
-        throw AudioRtpFactoryException("rtpSession_ is NULL in setRemoteCryptoInfo");
-
-    if (keyExchangeProtocol_ == SDES) {
-        AudioSrtpSession *srtp = static_cast<AudioSrtpSession *>(rtpSession_.get());
-        try {
-            srtp->setRemoteCryptoInfo(nego);
-        } catch (const AudioSrtpException &e) {
-            throw AudioRtpFactoryException(e.what());
-        }
-    } else {
-        RING_ERR("Should not store remote crypto info for non-SDES sessions");
-    }
-}
-
-void AudioRtpFactory::setDtmfPayloadType(unsigned int payloadType)
-{
-    std::lock_guard<std::mutex> lock(audioRtpThreadMutex_);
-    if (rtpSession_)
-        rtpSession_->setDtmfPayloadType(payloadType);
-}
-
-void AudioRtpFactory::sendDtmfDigit(int digit)
-{
-    std::lock_guard<std::mutex> lock(audioRtpThreadMutex_);
-    if (rtpSession_)
-        rtpSession_->putDtmfEvent(digit);
-}
-
-void AudioRtpFactory::saveLocalContext()
-{
-    std::lock_guard<std::mutex> lock(audioRtpThreadMutex_);
-    if (rtpSession_ and keyExchangeProtocol_ == SDES)
-        cachedAudioRtpState_.reset(rtpSession_->saveState());
-}
-
-void AudioRtpFactory::restoreLocalContext()
-{
-    std::lock_guard<std::mutex> lock(audioRtpThreadMutex_);
-    if (rtpSession_ and keyExchangeProtocol_ == SDES)
-        rtpSession_->restoreState(*cachedAudioRtpState_);
-}
-}
diff --git a/daemon/src/audio/audiortp/audio_rtp_factory.h b/daemon/src/audio/audiortp/audio_rtp_factory.h
deleted file mode 100644
index 12a4deed75e4ba2245f8456cd929f21c0d7e55de..0000000000000000000000000000000000000000
--- a/daemon/src/audio/audiortp/audio_rtp_factory.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- *  Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
- *  Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com>
- *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *  Additional permission under GNU GPL version 3 section 7:
- *
- *  If you modify this program, or any covered work, by linking or
- *  combining it with the OpenSSL project's OpenSSL library (or a
- *  modified version of that library), containing parts covered by the
- *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
- *  grants you additional permission to convey the resulting work.
- *  Corresponding Source for a non-source form of such a combination
- *  shall include the source code for the parts of OpenSSL used as well
- *  as that of the covered work.
- */
-
-#ifndef __AUDIO_RTP_FACTORY_H__
-#define __AUDIO_RTP_FACTORY_H__
-
-#include <stdexcept>
-#include <mutex>
-#include <memory>
-#include "audio_rtp_session.h"
-#include "audio_srtp_session.h"
-#include "noncopyable.h"
-
-class SdesNegotiator;
-class SIPCall;
-
-namespace ring {
-
-#if HAVE_ZRTP
-class AudioZrtpSession;
-#endif
-class AudioCodec;
-
-class UnsupportedRtpSessionType : public std::logic_error {
-    public:
-        UnsupportedRtpSessionType(const std::string& msg = "") : std::logic_error(msg) {}
-};
-
-class AudioRtpFactoryException : public std::logic_error {
-    public:
-        AudioRtpFactoryException(const std::string& msg = "") : std::logic_error(msg) {}
-};
-
-class AudioRtpFactory {
-    public:
-        AudioRtpFactory(SIPCall *ca);
-        ~AudioRtpFactory();
-
-        std::vector<long>
-        getSocketDescriptors();
-
-        void initConfig();
-
-        /**
-         * 	Lazy instantiation method. Create a new RTP session of a given
-         * type according to the content of the configuration file.
-         * @param ca A pointer on a SIP call
-         * @return A new AudioRtpSession object
-         */
-        void initSession();
-
-        /**
-         * Start the audio rtp thread of the type specified in the configuration
-         * file. initAudioSymmetricRtpSession must have been called prior to that.
-         * @param None
-         */
-        void start(const std::vector<AudioCodec*> &audioCodecs);
-
-        /**
-         * Stop the audio rtp thread of the type specified in the configuration
-         * file. initAudioSymmetricRtpSession must have been called prior to that.
-         * @param None
-         */
-        void stop();
-
-        /**
-         * Dynamically update session media
-         */
-        void updateSessionMedia(const std::vector<AudioCodec*> &audioCodecs);
-
-        /**
-         * Update current RTP destination address with one stored in call
-         * @param None
-         */
-        void updateDestinationIpAddress();
-
-        bool isSdesEnabled() const {
-            return srtpEnabled_ and keyExchangeProtocol_ == SDES;
-        }
-
-        /**
-         * Manually set the srtpEnable option (usefull for RTP fallback)
-         */
-        void setSrtpEnabled(bool enable) {
-            srtpEnabled_ = enable;
-        }
-
-#if HAVE_ZRTP
-        /**
-         * Get the current AudioZrtpSession. Throws an AudioRtpFactoryException
-         * if the current rtp thread is null, or if it's not of the correct type.
-         * @return The current AudioZrtpSession thread.
-         */
-        ring::AudioZrtpSession* getAudioZrtpSession();
-#endif
-
-        void initLocalCryptoInfo();
-        void initLocalCryptoInfoOnOffHold();
-
-        /**
-         * Set remote cryptographic info. Should be called after negotiation in SDP
-         * offer/answer session.
-         */
-        void setRemoteCryptoInfo(ring::SdesNegotiator& nego);
-
-        void setDtmfPayloadType(unsigned int);
-
-        /**
-         * Send DTMF over RTP (RFC2833).
-         * The timestamp and sequence number must be incremented
-         * as if it was microphone audio. This function change the payload type
-         * of the rtp session, send the appropriate DTMF digit using
-         * this payload, discard corresponding data from RingBufferPool and get
-         * back the codec payload for further audio processing.
-         */
-        void sendDtmfDigit(int digit);
-
-        void saveLocalContext();
-
-        void restoreLocalContext();
-
-    private:
-        NON_COPYABLE(AudioRtpFactory);
-        enum KeyExchangeProtocol { NONE, SDES, ZRTP };
-        std::unique_ptr<AudioRtpSession> rtpSession_;
-        std::unique_ptr<CachedAudioRtpState> cachedAudioRtpState_;
-        std::mutex audioRtpThreadMutex_;
-
-        // Field used when initializing audio rtp session
-        // May be set manually or from config using initAudioRtpConfig
-        bool srtpEnabled_;
-
-        // Field used when initializinga udio rtp session
-        // May be set manually or from config using initAudioRtpConfig
-        bool helloHashEnabled_;
-
-        /** Used to make sure remote crypto context not initialized twice. */
-        bool remoteOfferIsSet_;
-
-        SIPCall *call_;
-        KeyExchangeProtocol keyExchangeProtocol_;
-};
-}
-#endif // __AUDIO_RTP_FACTORY_H__
diff --git a/daemon/src/audio/audiortp/audio_rtp_session.cpp b/daemon/src/audio/audiortp/audio_rtp_session.cpp
deleted file mode 100644
index 51d51a7fafce4b58b08ea487381768b0025e6b21..0000000000000000000000000000000000000000
--- a/daemon/src/audio/audiortp/audio_rtp_session.cpp
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- *  Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
- *  Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com>
- *  Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>
- *  Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
- *  Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
- *  Author: Yan Morin <yan.morin@savoirfairelinux.com>
- *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *  Additional permission under GNU GPL version 3 section 7:
- *
- *  If you modify this program, or any covered work, by linking or
- *  combining it with the OpenSSL project's OpenSSL library (or a
- *  modified version of that library), containing parts covered by the
- *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
- *  grants you additional permission to convey the resulting work.
- *  Corresponding Source for a non-source form of such a combination
- *  shall include the source code for the parts of OpenSSL used as well
- *  as that of the covered work.
- */
-
-#include "audio_rtp_session.h"
-#include "logger.h"
-#include "sip/sdp.h"
-#include "sip/sipcall.h"
-#include "intrin.h"
-
-#ifdef RTP_DEBUG
-#include <numeric>
-#include <algorithm>
-#endif
-
-namespace ring {
-AudioRtpSession::AudioRtpSession(SIPCall &call, ost::RTPDataQueue &queue) :
-    isStarted_(false)
-    , queue_(queue)
-    , call_(call)
-    , timestamp_(0)
-    , timestampIncrement_(0)
-    , rtpStream_(call.getCallId())
-    , transportRate_(20)
-    , remoteIp_()
-    , rxLastSeqNum_(0)
-#ifdef RTP_DEBUG
-    , rxLast_()
-    , rxJitters_()
-    , jitterReportInterval_(0)
-#endif
-    , dtmfQueue_()
-    , dtmfPayloadType_(101) // same as Asterisk
-    , loop_([] { return true; },
-            std::bind(&AudioRtpSession::process, this),
-            [] {})
-{
-    queue_.setTypeOfService(ost::RTPDataQueue::tosEnhanced);
-}
-
-AudioRtpSession::~AudioRtpSession()
-{
-    loop_.join();
-}
-
-void AudioRtpSession::updateSessionMedia(const std::vector<AudioCodec*> &audioCodecs)
-{
-    if (rtpStream_.codecsDiffer(audioCodecs))
-        setSessionMedia(audioCodecs);
-}
-
-void AudioRtpSession::setSessionMedia(const std::vector<AudioCodec*> &audioCodecs)
-{
-    rtpStream_.setRtpMedia(audioCodecs);
-
-    // G722 requires timestamp to be incremented at 8kHz
-    const ost::PayloadType payloadType = rtpStream_.getEncoderPayloadType();
-
-    if (payloadType == ost::sptG722) {
-        const int G722_RTP_TIME_INCREMENT = 160;
-        timestampIncrement_ = G722_RTP_TIME_INCREMENT;
-    } else
-        timestampIncrement_ = rtpStream_.getEncoderFrameSize();
-
-    const AudioFormat encoderFormat(rtpStream_.getEncoderFormat());
-
-    if (payloadType == ost::sptG722) {
-        const int G722_RTP_CLOCK_RATE = 8000;
-        queue_.setPayloadFormat(ost::DynamicPayloadFormat(payloadType, G722_RTP_CLOCK_RATE));
-    } else {
-        if (rtpStream_.hasDynamicPayload())
-            queue_.setPayloadFormat(ost::DynamicPayloadFormat(payloadType, encoderFormat.sample_rate));
-        else
-            queue_.setPayloadFormat(ost::StaticPayloadFormat(static_cast<ost::StaticPayloadType>(payloadType)));
-    }
-
-    transportRate_ = rtpStream_.getTransportRate();
-    RING_DBG("Switching to a transport rate of %d ms", transportRate_);
-}
-
-void AudioRtpSession::sendDtmfEvent()
-{
-    DTMFEvent &dtmf(dtmfQueue_.front());
-    RING_DBG("Send RTP Dtmf (%d)", dtmf.payload.event);
-
-    const int increment = getIncrementForDTMF();
-    if (dtmf.newevent)
-        timestamp_ += increment;
-
-    // discard equivalent size of audio
-    rtpStream_.processDataEncode();
-
-    // change Payload type for DTMF payload
-    queue_.setPayloadFormat(ost::DynamicPayloadFormat((ost::PayloadType) dtmfPayloadType_, 8000));
-
-    // Set marker in case this is a new Event
-    if (dtmf.newevent)
-        queue_.setMark(true);
-
-    // Send end packet three times (without changing it). Sequence number is
-    // incremented automatically by ccrtp, which is the correct behaviour.
-    const unsigned repetitions = dtmf.payload.ebit ? 3 : 1;
-    for (unsigned i = 0; i < repetitions; ++i)
-        queue_.sendImmediate(timestamp_, (const unsigned char *)(& (dtmf.payload)), sizeof(ost::RTPPacket::RFC2833Payload));
-
-    // This is no longer a new event
-    if (dtmf.newevent) {
-        dtmf.newevent = false;
-        queue_.setMark(false);
-    }
-
-    // restore the payload to audio
-    const int pt = rtpStream_.getEncoderPayloadType();
-    const AudioFormat encoderFormat = rtpStream_.getEncoderFormat();
-    if (rtpStream_.hasDynamicPayload()) {
-        const ost::DynamicPayloadFormat pf(pt, encoderFormat.sample_rate);
-        queue_.setPayloadFormat(pf);
-    } else {
-        const ost::StaticPayloadFormat pf(static_cast<ost::StaticPayloadType>(pt));
-        queue_.setPayloadFormat(pf);
-    }
-
-    // decrease length remaining to process for this event
-    dtmf.length -= increment;
-    dtmf.payload.duration++;
-
-    // next packet is going to be the end packet (transmitted 3 times)
-    if ((dtmf.length - increment) < increment)
-        dtmf.payload.ebit = true;
-
-    if (dtmf.length < increment)
-        dtmfQueue_.pop_front();
-}
-
-
-void AudioRtpSession::receiveSpeakerData()
-{
-    const ost::AppDataUnit* adu = queue_.getData(queue_.getFirstTimestamp());
-
-    if (!adu)
-        return;
-
-#ifdef RTP_DEBUG
-    // Compute and print RX jitter
-    auto rxTime = std::chrono::high_resolution_clock::now();
-    rxJitters_.push_back(std::chrono::duration_cast<std::chrono::duration<double, std::milli>>(rxTime - rxLast_).count());
-    rxLast_ = rxTime;
-    if (++jitterReportInterval_ == 100) {
-        if (rxJitters_.size() > 1000)
-            rxJitters_.erase(rxJitters_.begin(), rxJitters_.begin() + (rxJitters_.size() - 1000));
-        const double jit_mean = std::accumulate(rxJitters_.begin(), rxJitters_.end(), 0.0) / rxJitters_.size();
-        const double jit_sq_sum = std::inner_product(rxJitters_.begin(), rxJitters_.end(), rxJitters_.begin(), 0.0);
-        const double jit_stdev = std::sqrt(jit_sq_sum / rxJitters_.size() - jit_mean * jit_mean);
-        RING_DBG("Jitter avg: %fms std dev %fms", jit_mean, jit_stdev);
-        jitterReportInterval_ = 0;
-    }
-#endif
-
-    int seqNumDiff = adu->getSeqNum() - rxLastSeqNum_;
-    if (abs(seqNumDiff) > 512) {
-        // Don't perform PLC if the delay can't be concealed without major distortion.
-        // Also skip PLC in case of timestamp reset.
-        rxLastSeqNum_ += seqNumDiff;
-        seqNumDiff = 1;
-    } else if (seqNumDiff < 0) {
-        RING_DBG("Dropping out-of-order packet %d (last %d)", rxLastSeqNum_ + seqNumDiff, rxLastSeqNum_);
-        return;
-    } else {
-        rxLastSeqNum_ += seqNumDiff;
-    }
-    if (rxLastSeqNum_ && seqNumDiff > 1) {
-        RING_DBG("%d packets lost", seqNumDiff-1);
-        for (unsigned i = 0, n = seqNumDiff - 1; i < n; i++)
-            rtpStream_.processDataDecode(nullptr, 0, adu->getType());
-    }
-
-    uint8_t* spkrDataIn = (uint8_t*) adu->getData(); // data in char
-    size_t size = adu->getSize(); // size in char
-
-    // DTMF over RTP, size must be over 4 in order to process it as voice data
-    if (size > 4)
-        rtpStream_.processDataDecode(spkrDataIn, size, adu->getType());
-
-    delete adu;
-}
-
-
-size_t AudioRtpSession::sendMicData()
-{
-    size_t compSize = rtpStream_.processDataEncode();
-
-    // if no data return
-    if (compSize == 0)
-        return 0;
-
-    // initialize once
-    int ccrtpTimestamp = queue_.getCurrentTimestamp();
-    if (std::abs(timestamp_ - ccrtpTimestamp) > timestampIncrement_) {
-        timestamp_ = ccrtpTimestamp;
-    }
-
-    // Increment timestamp for outgoing packet
-    timestamp_ += timestampIncrement_;
-
-    queue_.putData(timestamp_, rtpStream_.getMicDataEncoded(), compSize);
-    return compSize;
-}
-
-
-void AudioRtpSession::setSessionTimeouts()
-{
-    const unsigned schedulingTimeout = 4000;
-    const unsigned expireTimeout = 1000000;
-    RING_DBG("Set session scheduling timeout (%d) and expireTimeout (%d)",
-          schedulingTimeout, expireTimeout);
-
-    queue_.setSchedulingTimeout(schedulingTimeout);
-    queue_.setExpireTimeout(expireTimeout);
-}
-
-void AudioRtpSession::updateDestinationIpAddress()
-{
-    RING_DBG("Update destination ip address");
-
-    // Destination address are stored in a list in ccrtp
-    // This method remove the current destination entry
-    if (!(remoteIp_.isIpv4()  && queue_.forgetDestination(static_cast<ost::IPV4Host>(remoteIp_), remoteIp_.getPort()))
-#if HAVE_IPV6
-     && !(remoteIp_.isIpv6() == AF_INET6 && queue_.forgetDestination(static_cast<ost::IPV6Host>(remoteIp_), remoteIp_.getPort()))
-#endif
-    ) RING_DBG("Did not remove previous destination");
-
-    IpAddr remote = {call_.getSDP().getRemoteIP()};
-    remote.setPort(call_.getSDP().getRemoteAudioPort());
-    if (!remote) {
-        RING_WARN("Target IP address (%s) is not correct!", call_.getSDP().getRemoteIP().c_str());
-        return;
-    }
-    remoteIp_ = remote;
-    RING_DBG("New remote address for session: %s", remote.toString(true).c_str());
-
-    if (!(remoteIp_.isIpv4()  && queue_.addDestination(static_cast<ost::IPV4Host>(remoteIp_), remoteIp_.getPort()))
-#if HAVE_IPV6
-     && !(remoteIp_.isIpv6() && queue_.addDestination(static_cast<ost::IPV6Host>(remoteIp_), remoteIp_.getPort()))
-#endif
-    ) RING_WARN("Can't add new destination to session!");
-}
-
-
-void AudioRtpSession::prepareRtpReceiveThread(const std::vector<AudioCodec*> &audioCodecs)
-{
-    RING_DBG("Preparing receiving thread");
-    isStarted_ = true;
-#ifdef RTP_DEBUG
-    rxLast_ = std::chrono::high_resolution_clock::now();
-#endif
-    setSessionTimeouts();
-    setSessionMedia(audioCodecs);
-    rtpStream_.initBuffers();
-#if HAVE_SPEEXDSP
-    rtpStream_.resetDSP();
-#endif
-}
-
-
-bool AudioRtpSession::onRTPPacketRecv(ost::IncomingRTPPkt&)
-{
-    receiveSpeakerData();
-    return true;
-}
-
-int AudioRtpSession::getIncrementForDTMF() const
-{
-    return timestampIncrement_;
-}
-
-void AudioRtpSession::startRtpThreads(const std::vector<AudioCodec*> &audioCodecs)
-{
-    if (isStarted_)
-        return;
-
-    prepareRtpReceiveThread(audioCodecs);
-    // implemented in subclasses
-    startRTPLoop();
-    // only in this class
-    loop_.start();
-}
-
-void AudioRtpSession::process()
-{
-    // Send session
-    if (hasDTMFPending())
-        sendDtmfEvent();
-    else
-        sendMicData();
-
-    rtpStream_.waitForDataEncode(std::chrono::milliseconds(transportRate_));
-}
-
-void AudioRtpSession::putDtmfEvent(char digit)
-{
-    DTMFEvent dtmf(digit);
-    dtmfQueue_.push_back(dtmf);
-}
-
-CachedAudioRtpState *
-AudioRtpSession::saveState() const
-{
-    RING_ERR("Not implemented");
-    return nullptr;
-}
-
-void
-AudioRtpSession::restoreState(const CachedAudioRtpState &state UNUSED)
-{
-    RING_ERR("Not implemented");
-}
-}
diff --git a/daemon/src/audio/audiortp/audio_rtp_session.h b/daemon/src/audio/audiortp/audio_rtp_session.h
deleted file mode 100644
index b999e68c4f9c26714d59142346383559bdd87019..0000000000000000000000000000000000000000
--- a/daemon/src/audio/audiortp/audio_rtp_session.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- *  Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
- *  Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com>
- *  Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>
- *  Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
- *  Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
- *  Author: Yan Morin <yan.morin@savoirfairelinux.com>
- *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *  Additional permission under GNU GPL version 3 section 7:
- *
- *  If you modify this program, or any covered work, by linking or
- *  combining it with the OpenSSL project's OpenSSL library (or a
- *  modified version of that library), containing parts covered by the
- *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
- *  grants you additional permission to convey the resulting work.
- *  Corresponding Source for a non-source form of such a combination
- *  shall include the source code for the parts of OpenSSL used as well
- *  as that of the covered work.
- */
-#ifndef AUDIO_RTP_SESSION_H_
-#define AUDIO_RTP_SESSION_H_
-
-#include "audio_rtp_stream.h"
-#include "dtmf_event.h"
-#include "ip_utils.h"
-#include "noncopyable.h"
-#include "logger.h"
-#include "threadloop.h"
-
-#include <ccrtp/rtp.h>
-#include <ccrtp/formats.h>
-
-#include <chrono>
-
-class SIPCall;
-
-namespace ring {
-
-class AudioCodec;
-class AudioRtpSession;
-
-class CachedAudioRtpState;
-
-class AudioRtpSession {
-    public:
-        /**
-        * Constructor
-        * @param sipcall The pointer on the SIP call
-        */
-        AudioRtpSession(SIPCall &sipcall, ost::RTPDataQueue &queue);
-        virtual ~AudioRtpSession();
-
-        void updateSessionMedia(const std::vector<AudioCodec*> &audioCodecs);
-
-        void startRtpThreads(const std::vector<AudioCodec*> &audioCodecs);
-
-        void putDtmfEvent(char digit);
-        bool hasDTMFPending() const {
-            return not dtmfQueue_.empty();
-        }
-
-        int getDtmfPayloadType() const {
-            return dtmfPayloadType_;
-        }
-
-        void setDtmfPayloadType(int pt) {
-            dtmfPayloadType_ = pt;
-        }
-
-        int getTransportRate() const;
-
-        /**
-         * Used mostly when receiving a reinvite
-         */
-        void updateDestinationIpAddress();
-
-        virtual int getIncrementForDTMF() const;
-
-        virtual std::vector<long>
-        getSocketDescriptors() const = 0;
-
-        virtual CachedAudioRtpState * saveState() const;
-        virtual void restoreState(const CachedAudioRtpState &state);
-
-    private:
-        bool isStarted_;
-
-        void prepareRtpReceiveThread(const std::vector<AudioCodec*> &audioCodecs);
-        /**
-         * Set the audio codec for this RTP session
-         */
-        void setSessionMedia(const std::vector<AudioCodec*> &codec);
-
-    protected:
-        bool onRTPPacketRecv(ost::IncomingRTPPkt&);
-
-        ost::RTPDataQueue &queue_;
-        SIPCall &call_;
-
-        /**
-         * Timestamp for this session
-         */
-        int timestamp_;
-
-        /**
-         * Timestamp incrementation value based on codec period length (framesize)
-         * except for G722 which require a 8 kHz incrementation.
-         */
-        int timestampIncrement_;
-
-        AudioRtpStream rtpStream_;
-
-    private:
-
-        /**
-         * Rate at which the transport layer handle packets, should be
-         * synchronized with codec requirements.
-         */
-        unsigned int transportRate_;
-
-        NON_COPYABLE(AudioRtpSession);
-
-         /**
-         * Start ccRTP thread loop
-         * This thread will send AND receive rtp packets
-         */
-        virtual void startRTPLoop() = 0;
-
-        /**
-         * Send DTMF over RTP (RFC2833).
-         * The timestamp and sequence number must be incremented
-         * as if it was microphone audio. This function change the payload type
-         * of the rtp session, send the appropriate DTMF digit using
-         * this payload, discard corresponding data from RingBufferPool and get
-         * back the codec payload for further audio processing.
-         */
-        void sendDtmfEvent();
-
-        /**
-         * Send encoded data to peer
-         */
-        virtual size_t sendMicData();
-
-        /**
-         * Set RTP Sockets send/receive timeouts
-         */
-        void setSessionTimeouts();
-
-        /**
-         * Receive data from peer
-         */
-        void receiveSpeakerData();
-
-        /**
-         * Used by loop_ */
-        void process();
-
-        // Main destination address for this rtp session.
-        // Stored in case of reINVITE, which may require to forget
-        // this destination and update a new one.
-        IpAddr remoteIp_;
-
-        unsigned rxLastSeqNum_;
-#ifdef RTP_DEBUG
-        std::chrono::high_resolution_clock::time_point rxLast_;
-        std::vector<double> rxJitters_;
-        unsigned jitterReportInterval_;
-#endif
-
-        std::list<DTMFEvent> dtmfQueue_;
-        int dtmfPayloadType_;
-
-        // this must be last to ensure that it's destroyed first
-        ThreadLoop loop_;
-};
-}
-#endif // AUDIO_RTP_SESSION_H__
-
diff --git a/daemon/src/audio/audiortp/audio_rtp_stream.cpp b/daemon/src/audio/audiortp/audio_rtp_stream.cpp
deleted file mode 100644
index 15f2f8403a8848aea42c18deb188d88c8ba822db..0000000000000000000000000000000000000000
--- a/daemon/src/audio/audiortp/audio_rtp_stream.cpp
+++ /dev/null
@@ -1,483 +0,0 @@
-/*
- *  Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
- *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
- *  Author: Adrien Beraud <adrien.beraud@wisdomvibes.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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *  Additional permission under GNU GPL version 3 section 7:
- *
- *  If you modify this program, or any covered work, by linking or
- *  combining it with the OpenSSL project's OpenSSL library (or a
- *  modified version of that library), containing parts covered by the
- *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
- *  grants you additional permission to convey the resulting work.
- *  Corresponding Source for a non-source form of such a combination
- *  shall include the source code for the parts of OpenSSL used as well
- *  as that of the covered work.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "audio_rtp_stream.h"
-
-#include "audio/audiolayer.h"
-#include "audio/resampler.h"
-#include "audio/ringbufferpool.h"
-#include "audio/ringbuffer.h"
-
-#if HAVE_SPEEXDSP
-#include "audio/dsp.h"
-#endif
-
-#include "manager.h"
-#include "logger.h"
-
-#include <fstream>
-#include <algorithm>
-#include <cassert>
-
-namespace ring {
-
-AudioRtpStream::AudioRtpStream(const std::string &id) :
-    id_(id)
-    , encoder_(AudioFormat::MONO())
-    , decoder_(AudioFormat::MONO())
-    , audioCodecs_()
-    , codecEncMutex_(), codecDecMutex_()
-    , hasDynamicPayloadType_(false)
-    , rawBuffer_(RAW_BUFFER_SIZE, AudioFormat::MONO())
-    , micData_(RAW_BUFFER_SIZE, AudioFormat::MONO())
-    , encodedData_()
-    , dead_(false)
-    , currentEncoderIndex_(0)
-    , currentDecoderIndex_(0)
-    , warningInterval_(0)
-    , plcCachePool_()
-    , plcPool_(nullptr)
-    , plcDec_()
-{
-    ringbuffer_ = Manager::instance().getRingBufferPool().createRingBuffer(id_);
-    pj_caching_pool_init(&plcCachePool_, &pj_pool_factory_default_policy, 0);
-    plcPool_ = pj_pool_create(&plcCachePool_.factory, "plc", 64, 1024, nullptr);
-}
-
-AudioRtpStream::~AudioRtpStream()
-{
-    dead_ = true;
-    std::lock(codecEncMutex_, codecDecMutex_);
-    deleteCodecs();
-    codecEncMutex_.unlock();
-    codecDecMutex_.unlock();
-    plcDec_.clear();
-    pj_pool_release(plcPool_);
-    pj_caching_pool_destroy(&plcCachePool_);
-}
-
-// Call from processData*
-bool AudioRtpStream::isDead()
-{
-    return dead_;
-}
-
-ring::AudioCodec *
-AudioRtpStream::getCurrentEncoder() const
-{
-    if (audioCodecs_.empty() or currentEncoderIndex_ >= audioCodecs_.size()) {
-        RING_ERR("No codec found");
-        return nullptr;
-    }
-
-    return audioCodecs_[currentEncoderIndex_];
-}
-
-ring::AudioCodec *
-AudioRtpStream::getCurrentDecoder() const
-{
-    if (audioCodecs_.empty() or currentDecoderIndex_ >= audioCodecs_.size()) {
-        RING_ERR("No codec found");
-        return nullptr;
-    }
-
-    return audioCodecs_[currentDecoderIndex_];
-}
-
-void
-AudioRtpStream::deleteCodecs()
-{
-    for (auto &i : audioCodecs_)
-        delete i;
-
-    audioCodecs_.clear();
-}
-
-// Tries to change decoder (only) if we receive an unexpected payload type that we previously said
-// we could decode.
-bool AudioRtpStream::tryToSwitchDecoder(int newPt)
-{
-    std::lock_guard<std::mutex> lock(codecDecMutex_);
-    for (unsigned i=0, n=audioCodecs_.size(); i<n; i++) {
-        auto codec = audioCodecs_[i];
-        if (codec == nullptr || codec->getPayloadType() != newPt) continue;
-        AudioFormat f = Manager::instance().getRingBufferPool().getInternalAudioFormat();
-        codec->setOptimalFormat(f.sample_rate, f.nb_channels);
-        decoder_.payloadType_ = codec->getPayloadType();
-        decoder_.frameSize_ = codec->getFrameSize();
-        decoder_.format_.sample_rate = codec->getCurrentClockRate();
-        decoder_.format_.nb_channels = codec->getCurrentChannels();
-        hasDynamicPayloadType_ = codec->hasDynamicPayload();
-        resetDecoderPLC(codec);
-        currentDecoderIndex_ = i; // FIXME: this is not reliable
-        RING_DBG("Switched payload type to %d", newPt);
-        return true;
-    }
-    RING_ERR("Could not switch payload types");
-    return false;
-}
-
-void AudioRtpStream::resetDecoderPLC(const ring::AudioCodec * codec)
-{
-    if (!plcPool_) return;
-    pj_pool_reset(plcPool_);
-    plcDec_.clear();
-    if (not codec->supportsPacketLossConcealment()) {
-        plcDec_.insert(plcDec_.begin(), decoder_.format_.nb_channels, nullptr);
-        for (unsigned i = 0; i < decoder_.format_.nb_channels; i++)
-            pjmedia_plc_create(plcPool_, decoder_.format_.sample_rate, decoder_.frameSize_, 0, &plcDec_[i]);
-    }
-}
-
-AudioRtpContext::AudioRtpContext(AudioFormat f) :
-    fadeFactor_(0.)
-    , payloadType_(0)
-    , frameSize_(0)
-    , format_(f)
-    , resampledData_(0, AudioFormat::MONO())
-    , resampler_(nullptr)
-#if HAVE_SPEEXDSP
-    , dspMutex_()
-    , dsp_()
-#endif
-{}
-
-AudioRtpContext::~AudioRtpContext()
-{
-#if HAVE_SPEEXDSP
-    std::lock_guard<std::mutex> lock(dspMutex_);
-    dsp_.reset(nullptr);
-#endif
-}
-
-void AudioRtpContext::resetResampler()
-{
-    // initialize resampler using AudioLayer's sampling rate
-    // (internal buffers initialized with maximal sampling rate and frame size)
-    resampler_.reset(new Resampler(format_.sample_rate));
-}
-
-void AudioRtpContext::fadeIn(AudioBuffer& buf)
-{
-    if (fadeFactor_ >= 1.0)
-        return;
-    // http://en.wikipedia.org/wiki/Smoothstep
-    const double gain = fadeFactor_ * fadeFactor_ * (3. - 2. * fadeFactor_);
-    buf.applyGain(gain);
-    fadeFactor_ += buf.size() / (double) format_.sample_rate;
-}
-
-#if HAVE_SPEEXDSP
-void AudioRtpContext::resetDSP()
-{
-    std::lock_guard<std::mutex> lock(dspMutex_);
-    assert(frameSize_);
-    dsp_.reset(new DSP(frameSize_, format_.nb_channels, format_.sample_rate));
-}
-
-void AudioRtpContext::applyDSP(AudioBuffer &buffer)
-{
-    const bool denoise = Manager::instance().audioPreference.getNoiseReduce();
-    const bool agc = Manager::instance().audioPreference.isAGCEnabled();
-
-    if (denoise or agc) {
-        std::lock_guard<std::mutex> lock(dspMutex_);
-        if (!dsp_)
-            return;
-
-        if (denoise)
-            dsp_->enableDenoise();
-        else
-            dsp_->disableDenoise();
-
-        if (agc)
-            dsp_->enableAGC();
-        else
-            dsp_->disableAGC();
-
-        dsp_->process(buffer, frameSize_);
-    }
-}
-#endif
-
-
-void AudioRtpStream::setRtpMedia(const std::vector<AudioCodec*> &audioCodecs)
-{
-    std::lock(codecEncMutex_, codecDecMutex_);
-
-    deleteCodecs();
-    // Set various codec info to reduce indirection
-    audioCodecs_ = audioCodecs;
-
-    if (audioCodecs.empty()) {
-        codecEncMutex_.unlock();
-        codecDecMutex_.unlock();
-        RING_ERR("Audio codecs empty");
-        return;
-    }
-
-    // FIXME: assuming right encoder/decoder are first?
-    currentEncoderIndex_ = currentDecoderIndex_ = 0;
-    AudioCodec& codec = *audioCodecs[currentEncoderIndex_];
-
-    AudioFormat f = Manager::instance().getRingBufferPool().getInternalAudioFormat();
-    codec.setOptimalFormat(f.sample_rate, f.nb_channels);
-
-    const int pt = codec.getPayloadType();
-    encoder_.payloadType_ = decoder_.payloadType_ = pt;
-    encoder_.frameSize_ = decoder_.frameSize_ = codec.getFrameSize();
-
-    AudioFormat codecFormat(codec.getCurrentClockRate(), codec.getCurrentChannels());
-    if (codecFormat != decoder_.format_ or codecFormat != encoder_.format_) {
-        encoder_.format_ = decoder_.format_ = codecFormat;
-#if HAVE_SPEEXDSP
-        resetDSP();
-#endif
-    }
-    Manager::instance().audioFormatUsed(codecFormat);
-    hasDynamicPayloadType_ = codec.hasDynamicPayload();
-    codecEncMutex_.unlock();
-
-    resetDecoderPLC(audioCodecs[currentDecoderIndex_]);
-    codecDecMutex_.unlock();
-}
-
-void AudioRtpStream::initBuffers()
-{
-    encoder_.resetResampler();
-    decoder_.resetResampler();
-}
-
-#if HAVE_SPEEXDSP
-void AudioRtpStream::resetDSP()
-{
-    encoder_.resetDSP();
-    decoder_.resetDSP();
-}
-#endif
-
-bool AudioRtpStream::waitForDataEncode(const std::chrono::milliseconds& max_wait) const
-{
-    const auto &mainBuffer = Manager::instance().getRingBufferPool();
-    const AudioFormat mainBuffFormat = mainBuffer.getInternalAudioFormat();
-    const double resampleFactor = (double) mainBuffFormat.sample_rate / encoder_.format_.sample_rate;
-    const size_t samplesToGet = resampleFactor * encoder_.frameSize_;
-
-    return mainBuffer.waitForDataAvailable(id_, samplesToGet, max_wait);
-}
-
-size_t AudioRtpStream::processDataEncode()
-{
-    if (isDead())
-        return 0;
-
-    AudioFormat mainBuffFormat = Manager::instance().getRingBufferPool().getInternalAudioFormat();
-
-    double resampleFactor = (double) mainBuffFormat.sample_rate / encoder_.format_.sample_rate;
-
-    // compute nb of byte to get corresponding to 1 audio frame
-    const size_t samplesToGet = resampleFactor * encoder_.frameSize_;
-
-    if (Manager::instance().getRingBufferPool().availableForGet(id_) < samplesToGet)
-        return 0;
-
-    micData_.setFormat(mainBuffFormat);
-    micData_.resize(samplesToGet);
-    const size_t samples = Manager::instance().getRingBufferPool().getData(micData_, id_);
-
-    if (samples != samplesToGet) {
-        RING_ERR("Asked for %d samples from bindings on call '%s', got %d",
-              samplesToGet, id_.c_str(), samples);
-        return 0;
-    }
-
-    AudioBuffer *out = &micData_;
-    if (encoder_.format_.sample_rate != mainBuffFormat.sample_rate) {
-        if (!encoder_.resampler_) {
-            RING_ERR("Resampler already destroyed");
-            return 0;
-        }
-        encoder_.resampledData_.setChannelNum(mainBuffFormat.nb_channels);
-        encoder_.resampledData_.setSampleRate(encoder_.format_.sample_rate);
-        encoder_.resampler_->resample(micData_, encoder_.resampledData_);
-        out = &encoder_.resampledData_;
-    }
-    if (encoder_.format_.nb_channels != mainBuffFormat.nb_channels)
-        out->setChannelNum(encoder_.format_.nb_channels, true);
-
-    encoder_.fadeIn(*out);
-#if HAVE_SPEEXDSP
-    encoder_.applyDSP(*out);
-#endif
-    {
-        std::lock_guard<std::mutex> lock(codecEncMutex_);
-        auto codec = getCurrentEncoder();
-        if (!codec) {
-            RING_ERR("Audio codec already destroyed");
-            return 0;
-        }
-
-        const auto codecFrameSize = codec->getFrameSize();
-        if (codecFrameSize > out->frames()) {
-            // PCM too small (underflow), add zero padding to avoid reading past
-            // end of buffer when encoding, for every channel
-            out->resize(codecFrameSize);
-        }
-
-        size_t encoded = codec->encode(out->getData(), encodedData_.data(), encodedData_.size());
-        return encoded;
-    }
-}
-
-
-void AudioRtpStream::processDataDecode(unsigned char *spkrData, size_t size, int payloadType)
-{
-    if (isDead())
-        return;
-
-    const int decPt = decoder_.payloadType_;
-    if (decPt != payloadType) {
-        const bool switched = tryToSwitchDecoder(payloadType);
-
-        if (not switched) {
-            if (!warningInterval_) {
-                warningInterval_ = 250;
-                RING_WARN("Invalid payload type %d, expected %d", payloadType, decPt);
-            }
-
-            warningInterval_--;
-            return;
-        }
-    }
-
-    rawBuffer_.setFormat(decoder_.format_);
-    rawBuffer_.resize(RAW_BUFFER_SIZE);
-    {
-        std::lock_guard<std::mutex> lock(codecDecMutex_);
-        auto codec = getCurrentDecoder();
-        if (!codec) {
-            RING_ERR("Audio codec already destroyed");
-            return;
-        }
-        if (spkrData) { // Packet is available
-            int decoded = codec->decode(rawBuffer_.getData(), spkrData, size);
-            rawBuffer_.resize(decoded);
-            if (not plcDec_.empty()) {
-                for (unsigned i = 0; i < decoder_.format_.nb_channels; ++i) {
-                    pjmedia_plc_save(plcDec_[i], rawBuffer_.getChannel(i)->data());
-                }
-            }
-        } else if (plcDec_.empty()) { // Packet loss concealment using codec
-            int decoded = codec->decode(rawBuffer_.getData());
-            rawBuffer_.resize(decoded);
-        } else { // Generic PJSIP Packet loss concealment using codec
-            rawBuffer_.resize(decoder_.frameSize_);
-            for (unsigned i = 0; i < decoder_.format_.nb_channels; ++i) {
-                pjmedia_plc_generate(plcDec_[i], rawBuffer_.getChannel(i)->data());
-            }
-        }
-    }
-
-#if HAVE_SPEEXDSP
-    decoder_.applyDSP(rawBuffer_);
-#endif
-
-    decoder_.fadeIn(rawBuffer_);
-
-    // test if resampling or up/down-mixing is required
-    AudioBuffer *out = &rawBuffer_;
-    AudioFormat decFormat = out->getFormat();
-    AudioFormat mainBuffFormat = Manager::instance().getRingBufferPool().getInternalAudioFormat();
-    if (decFormat.sample_rate != mainBuffFormat.sample_rate) {
-        if (!decoder_.resampler_) {
-            RING_ERR("Resampler already destroyed");
-            return;
-        }
-        decoder_.resampledData_.setChannelNum(decFormat.nb_channels);
-        decoder_.resampledData_.setSampleRate(mainBuffFormat.sample_rate);
-        decoder_.resampler_->resample(rawBuffer_, decoder_.resampledData_);
-        out = &decoder_.resampledData_;
-    }
-    if (decFormat.nb_channels != mainBuffFormat.nb_channels)
-        out->setChannelNum(mainBuffFormat.nb_channels, true);
-
-    ringbuffer_->put(*out);
-}
-
-bool
-AudioRtpStream::codecsDiffer(const std::vector<AudioCodec*> &codecs) const
-{
-    const std::vector<AudioCodec*> &current = audioCodecs_;
-
-    if (codecs.size() != current.size())
-        return true;
-
-    for (const auto &i : codecs) {
-        if (!i)
-            continue;
-
-        bool matched = false;
-
-        for (const auto &j : current)
-            if ((matched = i->getPayloadType() == j->getPayloadType()))
-                break;
-
-        if (not matched)
-            return true;
-    }
-
-    return false;
-}
-
-int
-AudioRtpStream::getEncoderPayloadType() const
-{
-    return encoder_.payloadType_;
-}
-
-int
-AudioRtpStream::getEncoderFrameSize() const
-{
-    return encoder_.frameSize_;
-}
-
-
-int
-AudioRtpStream::getTransportRate() const
-{
-    const int transportRate = encoder_.frameSize_ / encoder_.format_.sample_rate / 1000;
-    return transportRate > 0 ? transportRate : 20;
-}
-
-}
diff --git a/daemon/src/audio/audiortp/audio_rtp_stream.h b/daemon/src/audio/audiortp/audio_rtp_stream.h
deleted file mode 100644
index 473f61e7251dc64f7c5d51aa7aca67ed611e9fe4..0000000000000000000000000000000000000000
--- a/daemon/src/audio/audiortp/audio_rtp_stream.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- *  Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
- *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
- *  Author: Adrien Beraud <adrien.beraud@wisdomvibes.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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *  Additional permission under GNU GPL version 3 section 7:
- *
- *  If you modify this program, or any covered work, by linking or
- *  combining it with the OpenSSL project's OpenSSL library (or a
- *  modified version of that library), containing parts covered by the
- *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
- *  grants you additional permission to convey the resulting work.
- *  Corresponding Source for a non-source form of such a combination
- *  shall include the source code for the parts of OpenSSL used as well
- *  as that of the covered work.
- */
-
-#ifndef AUDIO_RTP_STREAM_H__
-#define AUDIO_RTP_STREAM_H__
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "audio/codecs/audiocodec.h"
-#include "audio/audiobuffer.h"
-#include "noncopyable.h"
-
-#include <pjmedia/plc.h>
-#include <pj/pool.h>
-
-#include <array>
-#include <mutex>
-#include <memory>
-#include <atomic>
-#include <cstddef>
-
-namespace ring {
-
-class Resampler;
-class DSP;
-class RingBuffer;
-
-class AudioRtpContext {
-    public:
-    AudioRtpContext(AudioFormat f);
-    ~AudioRtpContext();
-
-    /**
-     * Ramp in audio data to avoid audio click from peer
-     */
-    void fadeIn(AudioBuffer& buf);
-
-    private:
-    NON_COPYABLE(AudioRtpContext);
-    static constexpr double FADEIN_STEP_SIZE = 4.0;
-
-    void resetResampler();
-    double fadeFactor_;
-    int payloadType_;
-    int frameSize_;
-    AudioFormat format_;
-    AudioBuffer resampledData_;
-    std::unique_ptr<Resampler> resampler_;
-#if HAVE_SPEEXDSP
-    void resetDSP();
-    void applyDSP(AudioBuffer &rawBuffer);
-    std::mutex dspMutex_;
-    std::unique_ptr<DSP> dsp_;
-#endif
-
-    friend class AudioRtpStream;
-};
-
-/**
- * Class meant to store internal data in order to encode/decode,
- * resample, process, and packetize audio streams.
- */
-class AudioRtpStream {
-    public:
-        AudioRtpStream(const std::string &id);
-        virtual ~AudioRtpStream();
-        void initBuffers();
-
-        /**
-         * Set the list of codecs supported by this stream.
-         * The codec used for encoding must be first.
-         */
-        void setRtpMedia(const std::vector<AudioCodec*> &codecs);
-
-        /**
-         * Decode audio data received from peer
-         */
-        void processDataDecode(uint8_t *spkrData, size_t size, int payloadType);
-
-        /**
-         * Wait for available data to be encoded from RingBufferPool.
-         */
-        bool waitForDataEncode(const std::chrono::milliseconds& max_wait) const;
-
-        /**
-         * Encode audio data from RingBufferPool
-         * @return size of encoded data, in bytes.
-         */
-        size_t processDataEncode();
-
-        bool hasDynamicPayload() const {
-            return hasDynamicPayloadType_;
-        }
-
-        const uint8_t *getMicDataEncoded() const {
-            return encodedData_.data();
-        }
-
-        int getEncoderPayloadType() const;
-        int getEncoderFrameSize() const;
-        AudioFormat getEncoderFormat() const { return encoder_.format_; }
-
-#if HAVE_SPEEXDSP
-        void initDSP();
-        void resetDSP();
-#endif
-        bool codecsDiffer(const std::vector<AudioCodec*> &codecs) const;
-        int getTransportRate() const;
-
-    private:
-        const std::string id_;
-
-        AudioRtpContext encoder_;
-        AudioRtpContext decoder_;
-
-        std::shared_ptr<RingBuffer> ringbuffer_{};
-
-        void deleteCodecs();
-        ring::AudioCodec* getCurrentEncoder() const;
-        ring::AudioCodec* getCurrentDecoder() const;
-
-        // Decoder-specific methods
-        bool tryToSwitchDecoder(int newPt);
-        void resetDecoderPLC(const ring::AudioCodec *);
-
-        std::vector<AudioCodec*> audioCodecs_;
-        std::mutex codecEncMutex_;
-        std::mutex codecDecMutex_;
-        // these will have the same value unless we are sending
-        // a different codec than we are receiving (asymmetric RTP)
-        bool hasDynamicPayloadType_;
-        // FIXME: probably need one for pre-encoder data, one for post-decoder data
-        AudioBuffer rawBuffer_, micData_;
-        std::array<uint8_t, RAW_BUFFER_SIZE> encodedData_;
-
-        bool isDead();
-
-        NON_COPYABLE(AudioRtpStream);
-        std::atomic<bool> dead_;
-        size_t currentEncoderIndex_;
-        size_t currentDecoderIndex_;
-        int warningInterval_;
-
-        pj_caching_pool plcCachePool_;
-        pj_pool_t * plcPool_;
-        // PLC instances, one per channel
-        std::vector<pjmedia_plc*> plcDec_;
-
-};
-}
-
-#endif // AUDIO_RTP_STREAM_H__
diff --git a/daemon/src/audio/audiortp/audio_srtp_session.cpp b/daemon/src/audio/audiortp/audio_srtp_session.cpp
deleted file mode 100644
index 247727ba96cc7ec3e6b9d052860156eca223c59d..0000000000000000000000000000000000000000
--- a/daemon/src/audio/audiortp/audio_srtp_session.cpp
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- *  Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
- *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
- *  Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *  Additional permission under GNU GPL version 3 section 7:
- *
- *  If you modify this program, or any covered work, by linking or
- *  combining it with the OpenSSL project's OpenSSL library (or a
- *  modified version of that library), containing parts covered by the
- *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
- *  grants you additional permission to convey the resulting work.
- *  Corresponding Source for a non-source form of such a combination
- *  shall include the source code for the parts of OpenSSL used as well
- *  as that of the covered work.
- */
-#include "audio_srtp_session.h"
-#include "logger.h"
-#include "array_size.h"
-#include "base64.h"
-
-#include <algorithm>
-#include <random>
-
-#include <cstdio>
-#include <cstring>
-#include <cerrno>
-
-#define STRINGIFY(x) #x
-#define TOSTRING(x) STRINGIFY(x)
-#define THROW_ERROR(EXCEPTION_CLASS, M) throw EXCEPTION_CLASS(__FILE__ ":" TOSTRING(__LINE__) ":" M)
-
-namespace ring {
-
-static std::string
-encodeBase64(unsigned char *input, int length)
-{
-    size_t output_length;
-    uint8_t *encoded_str = sfl_base64_encode(input, length, &output_length);
-    if (!encoded_str)
-        THROW_ERROR(AudioSrtpException, "Out of memory for base64 operation");
-    std::string output((const char *)encoded_str, output_length);
-    free(encoded_str);
-    return output;
-}
-
-static std::string
-decodeBase64(unsigned char *input, int length)
-{
-    size_t output_length;
-    uint8_t *decoded_str = sfl_base64_decode(input, length, &output_length);
-    if (!decoded_str)
-        THROW_ERROR(AudioSrtpException, "Out of memory for base64 operation");
-    std::string output((const char *)decoded_str, output_length);
-    free(decoded_str);
-    return output;
-}
-
-// Fills the array dest with length random bytes
-static void
-bufferFillMasterKey(std::vector<uint8_t>& dest)
-{
-    RING_DBG("Init local master key");
-    std::uniform_int_distribution<uint8_t> rand_byte(0, 255);
-
-    // Fill the key
-    {
-        std::random_device rdev;
-        std::generate(dest.begin(), dest.end(), std::bind(rand_byte, std::ref(rdev)));
-    }
-}
-
-// Fills the array dest with length random bytes
-static void
-bufferFillMasterSalt(std::vector<uint8_t>& dest)
-{
-    RING_DBG("Init local master salt");
-    std::uniform_int_distribution<uint8_t> rand_byte(0, 255);
-
-    // Fill the key
-    {
-        std::random_device rdev;
-        std::generate(dest.begin(), dest.end(), std::bind(rand_byte, std::ref(rdev)));
-    }
-}
-
-static const unsigned MAX_MASTER_KEY_LENGTH = 16;
-static const unsigned MAX_MASTER_SALT_LENGTH = 14;
-
-AudioSrtpSession::AudioSrtpSession(SIPCall &call) :
-    AudioSymmetricRtpSession(call),
-    remoteCryptoCtx_(),
-    localCryptoCtx_(),
-    localCryptoSuite_(0),
-    remoteCryptoSuite_(0),
-    localMasterKey_(MAX_MASTER_KEY_LENGTH),
-    localMasterSalt_(MAX_MASTER_SALT_LENGTH),
-    remoteMasterKey_(MAX_MASTER_KEY_LENGTH),
-    remoteMasterSalt_(MAX_MASTER_SALT_LENGTH),
-    remoteOfferIsSet_(false)
-{}
-
-AudioSrtpSession::~AudioSrtpSession()
-{
-    if (remoteCryptoCtx_)
-        removeInQueueCryptoContext(remoteCryptoCtx_);
-    if (localCryptoCtx_)
-        removeOutQueueCryptoContext(localCryptoCtx_);
-}
-
-void AudioSrtpSession::initLocalCryptoInfo()
-{
-    RING_DBG("AudioSrtpSession: Set cryptographic info for this rtp session");
-
-    // Initialize local Crypto context
-    initializeLocalMasterKey();
-    initializeLocalMasterSalt();
-    initializeLocalCryptoContext();
-
-    // Set local crypto context in ccrtp
-    localCryptoCtx_->deriveSrtpKeys(0);
-
-    setOutQueueCryptoContext(localCryptoCtx_);
-}
-
-void AudioSrtpSession::initLocalCryptoInfoOnOffhold()
-{
-    RING_DBG("AudioSrtpSession: Set cryptographic info for this rtp session");
-
-    // Initialize local Crypto context
-    initializeLocalCryptoContext();
-
-    // Set local crypto context in ccrtp
-    localCryptoCtx_->deriveSrtpKeys(0);
-
-    setOutQueueCryptoContext(localCryptoCtx_);
-}
-
-std::vector<std::string> AudioSrtpSession::getLocalCryptoInfo()
-{
-    RING_DBG("Get Cryptographic info from this rtp session");
-
-    std::vector<std::string> crypto_vector;
-
-    // @TODO we should return a vector containing supported
-    // cryptographic context tagged 1, 2, 3...
-    std::string tag = "1";
-
-    std::string crypto_suite(ring::CryptoSuites[localCryptoSuite_].name);
-
-    // srtp keys formated as the following  as the following
-    // inline:keyParameters|keylifetime|MasterKeyIdentifier
-    // inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj|2^20|1:32
-    std::string srtp_keys = "inline:";
-    srtp_keys += getBase64ConcatenatedKeys();
-    // srtp_keys.append("|2^20|1:32");
-
-    // generate crypto attribute
-    std::string crypto_attr = tag.append(" ");
-    crypto_attr += crypto_suite.append(" ");
-    crypto_attr += srtp_keys;
-
-    RING_DBG("%s", crypto_attr.c_str());
-
-    crypto_vector.push_back(crypto_attr);
-
-    return crypto_vector;
-}
-
-void AudioSrtpSession::setRemoteCryptoInfo(const ring::SdesNegotiator& nego)
-{
-    if (not remoteOfferIsSet_) {
-        // Use second crypto suite if key length is 32 bit, default is 80;
-        if (nego.getAuthTagLength() == "32") {
-            localCryptoSuite_ = 1;
-            remoteCryptoSuite_ = 1;
-        }
-
-        // decode keys
-        unBase64ConcatenatedKeys(nego.getKeyInfo());
-
-        // init crypto content in Srtp session
-        initializeRemoteCryptoContext();
-
-        if (remoteCryptoCtx_) {
-            setInQueueCryptoContext(remoteCryptoCtx_);
-       }
-
-        remoteOfferIsSet_ = true;
-    }
-}
-
-static const size_t BITS_PER_BYTE = 8;
-
-void AudioSrtpSession::initializeLocalMasterKey()
-{
-    localMasterKey_.resize(ring::CryptoSuites[localCryptoSuite_].masterKeyLength / BITS_PER_BYTE);
-    bufferFillMasterKey(localMasterKey_);
-}
-
-void AudioSrtpSession::initializeLocalMasterSalt()
-{
-    localMasterSalt_.resize(ring::CryptoSuites[localCryptoSuite_].masterSaltLength / BITS_PER_BYTE);
-    bufferFillMasterSalt(localMasterSalt_);
-}
-
-std::string AudioSrtpSession::getBase64ConcatenatedKeys()
-{
-    RING_DBG("Get base64 concatenated keys");
-
-    // compute concatenated master and salt length
-    std::vector<uint8> concatKeys;
-    concatKeys.reserve(localMasterKey_.size() + localMasterSalt_.size());
-
-    // concatenate keys
-    concatKeys.insert(concatKeys.end(), localMasterKey_.begin(), localMasterKey_.end());
-    concatKeys.insert(concatKeys.end(), localMasterSalt_.begin(), localMasterSalt_.end());
-
-    // encode concatenated keys in base64
-    return encodeBase64(concatKeys.data(), concatKeys.size());
-}
-
-void AudioSrtpSession::unBase64ConcatenatedKeys(std::string base64keys)
-{
-    remoteMasterKey_.resize(ring::CryptoSuites[remoteCryptoSuite_].masterKeyLength / BITS_PER_BYTE);
-    remoteMasterSalt_.resize(ring::CryptoSuites[remoteCryptoSuite_].masterSaltLength / BITS_PER_BYTE);
-
-    // decode concatenated binary keys
-    std::string output(decodeBase64((uint8_t *)base64keys.data(), base64keys.size()));
-
-    // copy master and slt respectively
-    const std::string::iterator key_end = output.begin() + remoteMasterKey_.size();
-
-    if (key_end > output.end() or
-        (size_t) std::distance(key_end, output.end()) > remoteMasterSalt_.size())
-        THROW_ERROR(AudioSrtpException, "Out of bounds copy");
-
-    std::copy(output.begin(), key_end, remoteMasterKey_.begin());
-    std::copy(key_end, output.end(), remoteMasterSalt_.begin());
-
-}
-
-void AudioSrtpSession::initializeRemoteCryptoContext()
-{
-    RING_DBG("Initialize remote crypto context");
-
-    const CryptoSuiteDefinition &crypto = ring::CryptoSuites[remoteCryptoSuite_];
-
-    if (remoteCryptoCtx_)
-        removeInQueueCryptoContext(remoteCryptoCtx_);
-
-    remoteCryptoCtx_ = new ost::CryptoContext(0x0,
-            0,    // roc,
-            0L,   // keydr,
-            SrtpEncryptionAESCM,
-            SrtpAuthenticationSha1Hmac,
-            remoteMasterKey_.data(),
-            remoteMasterKey_.size(),
-            remoteMasterSalt_.data(),
-            remoteMasterSalt_.size(),
-            crypto.encryptionKeyLength / BITS_PER_BYTE,
-            crypto.srtpAuthKeyLength / BITS_PER_BYTE,
-            crypto.masterSaltLength / BITS_PER_BYTE,
-            crypto.srtpAuthTagLength / BITS_PER_BYTE);
-}
-
-void AudioSrtpSession::initializeLocalCryptoContext()
-{
-    RING_DBG("Initialize local crypto context");
-
-    const CryptoSuiteDefinition &crypto = ring::CryptoSuites[localCryptoSuite_];
-
-    if (localCryptoCtx_)
-        removeOutQueueCryptoContext(localCryptoCtx_);
-
-    localCryptoCtx_ = new ost::CryptoContext(OutgoingDataQueue::getLocalSSRC(),
-            0,     // roc,
-            0L,    // keydr,
-            SrtpEncryptionAESCM,
-            SrtpAuthenticationSha1Hmac,
-            localMasterKey_.data(),
-            localMasterKey_.size(),
-            localMasterSalt_.data(),
-            localMasterSalt_.size(),
-            crypto.encryptionKeyLength / BITS_PER_BYTE,
-            crypto.srtpAuthKeyLength / BITS_PER_BYTE,
-            crypto.masterSaltLength / BITS_PER_BYTE,
-            crypto.srtpAuthTagLength / BITS_PER_BYTE);
-}
-
-CachedAudioRtpState *
-AudioSrtpSession::saveState() const
-{
-    return new CachedAudioRtpState(localMasterKey_, localMasterSalt_);
-}
-
-CachedAudioRtpState::CachedAudioRtpState(const std::vector<uint8> &key, const std::vector<uint8> &salt) : key_(key), salt_(salt)
-{}
-
-void
-AudioSrtpSession::restoreState(const CachedAudioRtpState &state)
-{
-    localMasterKey_ = state.key_;
-    localMasterSalt_ = state.salt_;
-}
-
-}
diff --git a/daemon/src/audio/audiortp/audio_srtp_session.h b/daemon/src/audio/audiortp/audio_srtp_session.h
deleted file mode 100644
index 459b976ce18a63c33326006509aa6167e01763cb..0000000000000000000000000000000000000000
--- a/daemon/src/audio/audiortp/audio_srtp_session.h
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- *  Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
- *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
- *  Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *  Additional permission under GNU GPL version 3 section 7:
- *
- *  If you modify this program, or any covered work, by linking or
- *  combining it with the OpenSSL project's OpenSSL library (or a
- *  modified version of that library), containing parts covered by the
- *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
- *  grants you additional permission to convey the resulting work.
- *  Corresponding Source for a non-source form of such a combination
- *  shall include the source code for the parts of OpenSSL used as well
- *  as that of the covered work.
- */
-#ifndef AUDIO_SRTP_SESSION_H_
-#define AUDIO_SRTP_SESSION_H_
-
-#include "audio_symmetric_rtp_session.h"
-#include "sip/sdes_negotiator.h"
-#include "noncopyable.h"
-
-#include <ccrtp/CryptoContext.h>
-#include <vector>
-
-class SdesNegotiator;
-class SIPCall;
-
-/*
-   Table from RFC 4568 6.2. Crypto-Suites, which define key parameters for supported
-   cipher suite
-
-   +---------------------+-------------+--------------+---------------+
-   |                     |AES_CM_128_  | AES_CM_128_  | F8_128_       |
-   |                     |HMAC_SHA1_80 | HMAC_SHA1_32 |  HMAC_SHA1_80 |
-   +---------------------+-------------+--------------+---------------+
-   | Master key length   |   128 bits  |   128 bits   |   128 bits    |
-   | Master salt length  |   112 bits  |   112 bits   |   112 bits    |
-   | SRTP lifetime       | 2^48 packets| 2^48 packets | 2^48 packets  |
-   | SRTCP lifetime      | 2^31 packets| 2^31 packets | 2^31 packets  |
-   | Cipher              | AES Counter | AES Counter  | AES F8 Mode   |
-   |                     | Mode        | Mode         |               |
-   | Encryption key      |   128 bits  |   128 bits   |   128 bits    |
-   | MAC                 |  HMAC-SHA1  |  HMAC-SHA1   |  HMAC-SHA1    |
-   | SRTP auth. tag      |    80 bits  |    32 bits   |    80 bits    |
-   | SRTCP auth. tag     |    80 bits  |    80 bits   |    80 bits    |
-   | SRTP auth. key len. |   160 bits  |   160 bits   |   160 bits    |
-   | SRTCP auth. key len.|   160 bits  |   160 bits   |   160 bits    |
-   +---------------------+-------------+--------------+---------------+
-*/
-
-namespace ring {
-
-struct AudioSrtpException : public std::runtime_error {
-    AudioSrtpException(const char *msg) : std::runtime_error(msg) {}
-};
-
-class AudioSrtpSession : public AudioSymmetricRtpSession {
-    public:
-
-        /**
-         * Constructor for this rtp session. The local and remote keys must be properly
-         * initialized using initLocalCryptoInfo and setRemoteCryptoInfo respectively.
-         */
-        AudioSrtpSession(SIPCall &call);
-
-        ~AudioSrtpSession();
-
-        /**
-         * Used to get sdp crypto header to be included in sdp session. This
-         * method must be called befor setRemoteCryptoInfo in case of an
-         * outgoing call or after in case of an outgoing call.
-         */
-        std::vector<std::string> getLocalCryptoInfo();
-
-        /**
-         * Set remote crypto header from incoming sdp offer. It is expected that the
-         * local cryptographic context is initialized with mehod
-         */
-        void setRemoteCryptoInfo(const ring::SdesNegotiator &nego);
-
-        /**
-         * Init local crypto context for outgoing data
-         * this method must be called before sending or receiving an SDP offer.
-         * It is required for media negotiation that the local cryptographic
-         * context be properly initialized.
-         *
-         * @return The new local crypto context, to be cached by the caller
-         */
-        void initLocalCryptoInfo();
-
-        /**
-         * Initialize crypto context
-         */
-        void initLocalCryptoInfoOnOffhold();
-
-    private:
-        NON_COPYABLE(AudioSrtpSession);
-
-        CachedAudioRtpState *
-        saveState() const;
-
-        void restoreState(const CachedAudioRtpState &state);
-
-        /**
-         * Remote srtp crypto context to be set into incoming data queue.
-         * XXX: don't use smart pointers, ccrtp deletes this
-         */
-        ost::CryptoContext *remoteCryptoCtx_;
-
-        /**
-         * Local srtp crypto context to be set into outgoing data queue.
-         * XXX: don't use smart pointers, ccrtp deletes this
-         */
-        ost::CryptoContext *localCryptoCtx_;
-
-        /**
-         * Init local master key according to current crypto context
-         * as defined in SdesNegotiator.h
-         */
-        void initializeLocalMasterKey();
-
-        /**
-         * Init local master salt according to current crypto context
-         * as defined in SdesNegotiator.h
-         */
-        void initializeLocalMasterSalt();
-
-        /**
-         * Init remote crypto context in audio srtp session. This method
-         * must be called after unBase64ConcatenatedKeys.
-         */
-        void initializeRemoteCryptoContext();
-
-        /**
-         * Init local crypto context in audio srtp session. Make sure remote
-         * crypto context is set before calling this method for incoming calls.
-         */
-        void initializeLocalCryptoContext();
-
-        /**
-         * Used to generate local keys to be included in SDP offer/answer.
-         */
-        std::string getBase64ConcatenatedKeys();
-
-        /**
-         * Used to retreive keys from base64 serialization
-         */
-        void unBase64ConcatenatedKeys(std::string base64keys);
-
-        /**
-         * Default local crypto suite is AES_CM_128_HMAC_SHA1_80
-         */
-        int localCryptoSuite_;
-
-        /**
-         * Remote crypto suite is initialized at AES_CM_128_HMAC_SHA1_80
-         */
-        int remoteCryptoSuite_;
-
-        /**
-         * Array to store the local master key
-         */
-        std::vector<uint8> localMasterKey_;
-
-        /**
-         * Array to store local master salt
-         */
-        std::vector<uint8> localMasterSalt_;
-
-        std::vector<uint8> remoteMasterKey_;
-
-        /**
-         * Array to store the remote master salt
-         */
-        std::vector<uint8> remoteMasterSalt_;
-
-        /**
-         * Used to make sure remote crypto context not initialized twice.
-         */
-        bool remoteOfferIsSet_;
-};
-
-class CachedAudioRtpState {
-    public:
-        CachedAudioRtpState(const std::vector<uint8> &key, const std::vector<uint8> &salt);
-    private:
-        friend class AudioSrtpSession;
-        std::vector<uint8> key_, salt_;
-};
-
-}
-
-#endif // __AUDIO_SRTP_SESSION_H__
diff --git a/daemon/src/audio/audiortp/audio_symmetric_rtp_session.cpp b/daemon/src/audio/audiortp/audio_symmetric_rtp_session.cpp
deleted file mode 100644
index 222a20d1b3437183ec2755749cc88790539171de..0000000000000000000000000000000000000000
--- a/daemon/src/audio/audiortp/audio_symmetric_rtp_session.cpp
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- *  Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
- *  Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com>
- *  Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>
- *  Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
- *  Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
- *  Author: Yan Morin <yan.morin@savoirfairelinux.com>
- *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *  Additional permission under GNU GPL version 3 section 7:
- *
- *  If you modify this program, or any covered work, by linking or
- *  combining it with the OpenSSL project's OpenSSL library (or a
- *  modified version of that library), containing parts covered by the
- *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
- *  grants you additional permission to convey the resulting work.
- *  Corresponding Source for a non-source form of such a combination
- *  shall include the source code for the parts of OpenSSL used as well
- *  as that of the covered work.
- */
-
-#include "audio_symmetric_rtp_session.h"
-#include "logger.h"
-#include "sip/sipcall.h"
-#include "manager.h"
-#include "client/callmanager.h"
-
-namespace ring {
-
-AudioSymmetricRtpSession::AudioSymmetricRtpSession(SIPCall &call) :
-    ost::SymmetricRTPSession(static_cast<ost::IPV4Host>(call.getLocalIp()), call.getLocalAudioPort())
-    , AudioRtpSession(call, *this)
-{
-    RING_DBG("Setting new RTP session with destination %s:%d",
-          call_.getLocalIp().toString().c_str(), call_.getLocalAudioPort());
-}
-
-AudioSymmetricRtpSession::~AudioSymmetricRtpSession()
-{
-    // This would normally be invoked in ost::~SymmetricRTPSession() BUT
-    // we must stop it here because onRTPPacketRecv() runs in the other thread
-    // and uses member variables that are destroyed here
-    if (ost::Thread::isRunning()) {
-        disableStack();
-        ost::Thread::join();
-    }
-}
-
-std::vector<long>
-AudioSymmetricRtpSession::getSocketDescriptors() const
-{
-    std::vector<long> result;
-    result.push_back(dso->getRecvSocket());
-    result.push_back(cso->getRecvSocket());
-    return result;
-}
-
-void AudioSymmetricRtpSession::startRTPLoop()
-{
-    ost::SymmetricRTPSession::startRunning();
-}
-
-// redefined from QueueRTCPManager
-void AudioSymmetricRtpSession::onGotRR(ost::SyncSource& source, ost::RTCPCompoundHandler::RecvReport& RR, uint8 blocks)
-{
-    ost::SymmetricRTPSession::onGotRR(source, RR, blocks);
-#ifdef RTP_DEBUG
-    RING_DBG("onGotRR");
-    RING_DBG("Unpacking %d blocks",blocks);
-    for (int i = 0; i < blocks; ++i)
-    {
-        RING_DBG("fractionLost : %hhu", RR.blocks[i].rinfo.fractionLost);
-        RING_DBG("lostMSB : %hhu", RR.blocks[i].rinfo.lostMSB);
-        RING_DBG("lostLSW : %hu", RR.blocks[i].rinfo.lostLSW);
-        RING_DBG("highestSeqNum : %u", RR.blocks[i].rinfo.highestSeqNum);
-        RING_DBG("jitter : %u", RR.blocks[i].rinfo.jitter);
-        RING_DBG("lsr : %u", RR.blocks[i].rinfo.lsr);
-        RING_DBG("dlsr : %u", RR.blocks[i].rinfo.dlsr);
-     }
-#endif
-}
-
-// redefined from QueueRTCPManager
-void AudioSymmetricRtpSession::onGotSR(ost::SyncSource& source, ost::RTCPCompoundHandler::SendReport& SR, uint8 blocks)
-{
-#ifdef RTP_DEBUG
-    RING_DBG("onGotSR");
-    std::cout << "I got an SR RTCP report from "
-            << std::hex << (int)source.getID() << "@"
-            << std::dec
-            << source.getNetworkAddress() << ":"
-            << source.getControlTransportPort() << std::endl;
-#endif
-
-    std::map<std::string, int> stats;
-    ost::SymmetricRTPSession::onGotSR(source, SR, blocks);
-    ost::RTCPSenderInfo report(SR.sinfo);
-
-    for (int i = 0; i < blocks; ++i)
-    {
-        // If this is the first report drop it, stats are not complete
-        if(SR.blocks[i].rinfo.lsr == 0 || SR.blocks[i].rinfo.dlsr == 0)
-            continue;
-
-        ost::RTCPReceiverInfo receiver_report(SR.blocks[i].rinfo);
-        /*
-        How to calculate RTT (Round Trip delay)
-        A : NTP timestamp
-        lsr : The middle 32 bits out of 64 in the NTP timestamp (as explained in Section 4) received as part of the most
-        recent RTCP sender report (SR) packet from source SSRC_n. If no SR has been received yet, the field is set to zero.
-        dlsr : The delay, expressed in units of 1/65536 seconds, between receiving the last SR packet from source SSRC_n and
-        sending this reception report block. If no SR packet has been received yet from SSRC_n, the DLSR field is set to zero.
-        RTT = A - lsr - dlsr;
-        */
-
-        // integer portion of timestamp is in least significant 16-bits
-        const uint16 timestamp = (uint16) report.getNTPTimestampInt() & 0x0000FFFF;
-        // fractional portion of timestamp is in most significant 16-bits
-        const uint16 timestampFrac = (uint16) report.getNTPTimestampFrac() >> 16;
-
-
-        const uint16 rttMSW =  timestamp - receiver_report.getLastSRNTPTimestampInt();
-        const uint16 rttLSW = timestampFrac - receiver_report.getLastSRNTPTimestampFrac();
-
-        uint32 rtt = rttMSW;
-        rtt = rtt << 16 | rttLSW;
-        rtt -= receiver_report.getDelayLastSR();
-        stats["PACKET_COUNT"] = report.getPacketCount();
-        stats["PACKET_LOSS"] = receiver_report.getFractionLost();
-        stats["CUMUL_PACKET_LOSS"] = receiver_report.getCumulativePacketLost();
-        stats["RTT"] = rtt;
-        stats["LATENCY"] = 0; //TODO
-        stats["HIGH_SEC_NUM"] = receiver_report.getExtendedSeqNum();
-        stats["JITTER"] = receiver_report.getJitter();
-        stats["DLSR"] = receiver_report.getDelayLastSR();
-
-#ifdef RTP_DEBUG
-        RING_DBG("lastSR NTPTimestamp : %lu", receiver_report.getLastSRNTPTimestampFrac() << 16);
-        RING_DBG("NTPTimestampFrac : %lu", timestampFrac);
-        RING_DBG("rttMSW : %u", rttMSW);
-        RING_DBG("rttLSW : %u", rttLSW);
-        RING_DBG("RTT recomposed: %lu", rtt);
-        RING_DBG("LDSR: %lu", receiver_report.getDelayLastSR());
-        RING_DBG("Packet count : %u", stats["PACKET_COUNT"]);
-        RING_DBG("Fraction packet loss : %.2f", (double) stats["PACKET_LOSS"] * 100 / 256);
-        RING_DBG("Cumulative packet loss : %d", stats["CUMUL_PACKET_LOSS"]);
-        RING_DBG("HighestSeqNum : %u", stats["HIGH_SEC_NUM"]);
-        RING_DBG("Jitter : %u", stats["JITTER"]);
-        RING_DBG("RTT : %.2f", (double) stats["RTT"] / 65536);
-        RING_DBG("Delay since last report %.2f seconds", (double) stats["DLSR"] / 65536.0);
-#endif
-        Manager::instance().getClient()->getCallManager()->onRtcpReportReceived(call_.getCallId(), stats);
-    }
-}
-
-#if HAVE_IPV6
-
-AudioSymmetricRtpSessionIPv6::AudioSymmetricRtpSessionIPv6(SIPCall &call) :
-    ost::SymmetricRTPSessionIPV6(static_cast<ost::IPV6Host>(call.getLocalIp()), call.getLocalAudioPort())
-    , AudioRtpSession(call, *this)
-{
-    RING_DBG("Setting new RTP/IPv6 session with destination %s:%d",
-          call_.getLocalIp().toString().c_str(), call_.getLocalAudioPort());
-}
-
-AudioSymmetricRtpSessionIPv6::~AudioSymmetricRtpSessionIPv6()
-{
-    // see explanation in AudioSymmetricRtpSessionIPv6()
-    if (ost::Thread::isRunning()) {
-        disableStack();
-        ost::Thread::join();
-    }
-}
-
-std::vector<long>
-AudioSymmetricRtpSessionIPv6::getSocketDescriptors() const
-{
-    std::vector<long> result;
-    result.push_back(dso->getRecvSocket());
-    result.push_back(cso->getRecvSocket());
-    return result;
-}
-
-void AudioSymmetricRtpSessionIPv6::startRTPLoop()
-{
-    ost::SymmetricRTPSessionIPV6::startRunning();
-}
-
-// redefined from QueueRTCPManager
-void AudioSymmetricRtpSessionIPv6::onGotRR(ost::SyncSource& source, ost::RTCPCompoundHandler::RecvReport& RR, uint8 blocks)
-{
-    ost::SymmetricRTPSessionIPV6::onGotRR(source, RR, blocks);
-    // TODO: do something with this data
-#if 0
-    std::cout << "I got an RR RTCP report from "
-        << std::hex << (int)source.getID() << "@"
-        << std::dec
-        << source.getNetworkAddress() << ":"
-        << source.getControlTransportPort() << std::endl;
-#endif
-}
-
-// redefined from QueueRTCPManager
-void AudioSymmetricRtpSessionIPv6::onGotSR(ost::SyncSource& source, ost::RTCPCompoundHandler::SendReport& SR, uint8 blocks)
-{
-    ost::SymmetricRTPSessionIPV6::onGotSR(source, SR, blocks);
-    // TODO: do something with this data
-}
-
-size_t
-AudioSymmetricRtpSessionIPv6::recvData(unsigned char* buffer, size_t len, ost::IPV4Host&, ost::tpport_t& port)
-{
-    ost::IPV6Host hostv6 = call_.getLocalIp();
-    RING_ERR("recvData %d ", hostv6.getAddressCount());
-    size_t r = ost::SymmetricRTPSessionIPV6::recvData(buffer, len, hostv6, port);
-    RING_ERR("recvData from %s %d called in ipv6 stack, size %d", IpAddr(hostv6.getAddress()).toString().c_str(), port, len);
-    return r;
-}
-
-size_t
-AudioSymmetricRtpSessionIPv6::recvControl(unsigned char* buffer, size_t len, ost::IPV4Host&, ost::tpport_t& port)
-{
-    ost::IPV6Host hostv6 = call_.getLocalIp();
-    size_t r = ost::SymmetricRTPSessionIPV6::recvControl(buffer, len, hostv6, port);
-    RING_ERR("recvControl from %s %d called in ipv6 stack, size %d", IpAddr(hostv6.getAddress()).toString().c_str(), port, len);
-    return r;
-}
-
-
-#endif // HAVE_IPV6
-
-}
diff --git a/daemon/src/audio/audiortp/audio_symmetric_rtp_session.h b/daemon/src/audio/audiortp/audio_symmetric_rtp_session.h
deleted file mode 100644
index b00ee519fe1229aaebe9fee687d0395d6d90db5b..0000000000000000000000000000000000000000
--- a/daemon/src/audio/audiortp/audio_symmetric_rtp_session.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- *  Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
- *  Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com>
- *  Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>
- *  Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
- *  Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
- *  Author: Yan Morin <yan.morin@savoirfairelinux.com>
- *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *  Additional permission under GNU GPL version 3 section 7:
- *
- *  If you modify this program, or any covered work, by linking or
- *  combining it with the OpenSSL project's OpenSSL library (or a
- *  modified version of that library), containing parts covered by the
- *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
- *  grants you additional permission to convey the resulting work.
- *  Corresponding Source for a non-source form of such a combination
- *  shall include the source code for the parts of OpenSSL used as well
- *  as that of the covered work.
- */
-#ifndef AUDIO_SYMMETRIC_RTP_SESSION_H_
-#define AUDIO_SYMMETRIC_RTP_SESSION_H_
-
-#include "audio_rtp_session.h"
-#include "ip_utils.h"
-#include "noncopyable.h"
-
-#include <ccrtp/rtp.h>
-#include <ccrtp/iqueue.h>
-
-#include <exception>
-#include <cassert>
-#include <cstddef>
-
-class SIPCall;
-
-namespace ring {
-
-class AudioSymmetricRtpSession : public ost::SymmetricRTPSession, public AudioRtpSession {
-    public:
-        /**
-        * Constructor
-        * @param call The SIP call
-        */
-        AudioSymmetricRtpSession(SIPCall &call);
-        ~AudioSymmetricRtpSession();
-
-        std::vector<long>
-        getSocketDescriptors() const;
-
-        virtual bool onRTPPacketRecv(ost::IncomingRTPPkt& pkt) {
-            return AudioRtpSession::onRTPPacketRecv(pkt);
-        }
-
-    private:
-        void onGotRR(ost::SyncSource& source, ost::RTCPCompoundHandler::RecvReport& RR, uint8 blocks);
-        void onGotSR(ost::SyncSource& source, ost::RTCPCompoundHandler::SendReport& SR, uint8 blocks);
-
-        NON_COPYABLE(AudioSymmetricRtpSession);
-
-        void startRTPLoop();
-};
-
-#if HAVE_IPV6
-
-class AudioSymmetricRtpSessionIPv6 : public ost::SymmetricRTPSessionIPV6, public AudioRtpSession {
-    public:
-        /**
-        * Constructor
-        * @param call The SIP call
-        */
-        AudioSymmetricRtpSessionIPv6(SIPCall &call);
-        ~AudioSymmetricRtpSessionIPv6();
-
-        std::vector<long>
-        getSocketDescriptors() const;
-
-        virtual bool onRTPPacketRecv(ost::IncomingRTPPkt& pkt) {
-            return AudioRtpSession::onRTPPacketRecv(pkt);
-        }
-
-    protected:
-        virtual size_t recvData(unsigned char* buffer, size_t len, ost::IPV4Host&, ost::tpport_t& port);
-        virtual size_t recvControl(unsigned char* buffer, size_t len, ost::IPV4Host&, ost::tpport_t& port);
-
-    private:
-        void onGotRR(ost::SyncSource& source, ost::RTCPCompoundHandler::RecvReport& RR, uint8 blocks);
-        void onGotSR(ost::SyncSource& source, ost::RTCPCompoundHandler::SendReport& SR, uint8 blocks);
-
-        NON_COPYABLE(AudioSymmetricRtpSessionIPv6);
-
-        void startRTPLoop();
-};
-
-#endif // HAVE_IPV6
-
-}
-#endif // AUDIO_SYMMETRIC_RTP_SESSION_H__
-
diff --git a/daemon/src/audio/audiortp/audio_zrtp_session.cpp b/daemon/src/audio/audiortp/audio_zrtp_session.cpp
deleted file mode 100644
index 6b36ede425954b21e7785f706c77c44da0332150..0000000000000000000000000000000000000000
--- a/daemon/src/audio/audiortp/audio_zrtp_session.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- *  Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
- *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
- *  Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *  Additional permission under GNU GPL version 3 section 7:
- *
- *  If you modify this program, or any covered work, by linking or
- *  combining it with the OpenSSL project's OpenSSL library (or a
- *  modified version of that library), containing parts covered by the
- *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
- *  grants you additional permission to convey the resulting work.
- *  Corresponding Source for a non-source form of such a combination
- *  shall include the source code for the parts of OpenSSL used as well
- *  as that of the covered work.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "audio_zrtp_session.h"
-#include "zrtp_session_callback.h"
-#include "sip/sipcall.h"
-#include "logger.h"
-#include "manager.h"
-#include "fileutils.h"
-
-namespace ring {
-
-AudioZrtpSession::AudioZrtpSession(SIPCall &call, const std::string &zidFilename,
-                                   const std::string &localIP) :
-    ost::SymmetricZRTPSession(ost::InetHostAddress(localIP.c_str()), call.getLocalAudioPort())
-    , AudioRtpSession(call, *this)
-    , zidFilename_(zidFilename)
-#if HAVE_ZRTP_CONFIGURE
-    , zrtpConfigure_()
-{
-    setEnrollmentMode(false);
-    setSignSas(false);
-#else
-{
-#endif
-    initializeZid();
-    RING_DBG("Setting new RTP session with destination %s:%d",
-          localIP.c_str(), call_.getLocalAudioPort());
-}
-
-std::vector<long>
-AudioZrtpSession::getSocketDescriptors() const
-{
-    std::vector<long> result;
-    result.push_back(dso->getRecvSocket());
-    result.push_back(cso->getRecvSocket());
-    return result;
-}
-
-void AudioZrtpSession::initializeZid()
-{
-    if (zidFilename_.empty())
-        throw ZrtpZidException("zid filename empty");
-
-    const std::string zidDirName(fileutils::get_cache_dir());
-    const std::string zidCompleteFilename(zidDirName + DIR_SEPARATOR_STR + zidFilename_);
-
-    fileutils::check_dir(zidDirName.c_str());
-
-#if HAVE_ZRTP_CONFIGURE
-    // workaround buggy libzrtpcpp that can't parse EC25, see:
-    // https://projects.savoirfairelinux.com/issues/40216
-    zrtpConfigure_.reset(new ZrtpConfigure);
-    // FIXME: perhaps this should be only done for libzrtpcpp < 3?
-    zrtpConfigure_->setMandatoryOnly();
-
-    if (initialize(zidCompleteFilename.c_str(), true, zrtpConfigure_.get()) >= 0) {
-        setEnableZrtp(true);
-        setUserCallback(new ZrtpSessionCallback(call_));
-        return;
-    }
-#else
-    if (initialize(zidCompleteFilename.c_str()) >= 0) {
-        setEnableZrtp(true);
-        setUserCallback(new ZrtpSessionCallback(call_));
-        return;
-    }
-#endif
-
-    RING_DBG("Initialization from ZID file failed. Trying to remove...");
-
-    if (remove(zidCompleteFilename.c_str()) != 0)
-        throw ZrtpZidException("zid file deletion failed");
-
-    if (initialize(zidCompleteFilename.c_str()) < 0)
-        throw ZrtpZidException("zid initialization failed");
-}
-
-int AudioZrtpSession::getIncrementForDTMF() const
-{
-    return 160;
-}
-
-void AudioZrtpSession::startRTPLoop()
-{
-    ost::SymmetricZRTPSession::startRunning();
-}
-
-}
diff --git a/daemon/src/audio/audiortp/audio_zrtp_session.h b/daemon/src/audio/audiortp/audio_zrtp_session.h
deleted file mode 100644
index 1ea8eaa30159f2c48c0b3eeb70240a01964fba65..0000000000000000000000000000000000000000
--- a/daemon/src/audio/audiortp/audio_zrtp_session.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *  Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
- *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
- *  Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *  Additional permission under GNU GPL version 3 section 7:
- *
- *  If you modify this program, or any covered work, by linking or
- *  combining it with the OpenSSL project's OpenSSL library (or a
- *  modified version of that library), containing parts covered by the
- *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
- *  grants you additional permission to convey the resulting work.
- *  Corresponding Source for a non-source form of such a combination
- *  shall include the source code for the parts of OpenSSL used as well
- *  as that of the covered work.
- */
-#ifndef __AUDIO_ZRTP_SESSION_H__
-#define __AUDIO_ZRTP_SESSION_H__
-
-#include <cstddef>
-#include <stdexcept>
-
-using std::ptrdiff_t;
-#include <ccrtp/rtp.h>
-#include <libzrtpcpp/zrtpccrtp.h>
-
-#if HAVE_ZRTP_CONFIGURE
-#include <memory>
-#endif
-
-#include "audio_rtp_session.h"
-
-class SIPCall;
-class AudioCodec;
-
-namespace ring {
-
-class ZrtpZidException : public std::runtime_error {
-    public:
-        ZrtpZidException(const char *str):
-            std::runtime_error(str) {}
-};
-
-class AudioZrtpSession :
-    public ::ost::SymmetricZRTPSession,
-    public AudioRtpSession {
-    public:
-        AudioZrtpSession(SIPCall &call, const std::string& zidFilename, const std::string &localIP);
-
-        std::vector<long>
-        getSocketDescriptors() const;
-
-        virtual bool onRTPPacketRecv(::ost::IncomingRTPPkt &pkt) {
-            return AudioRtpSession::onRTPPacketRecv(pkt);
-        }
-
-    private:
-        NON_COPYABLE(AudioZrtpSession);
-
-        void initializeZid();
-        std::string zidFilename_;
-#if HAVE_ZRTP_CONFIGURE
-        std::unique_ptr<ZrtpConfigure> zrtpConfigure_;
-#endif
-        void startRTPLoop();
-        virtual int getIncrementForDTMF() const;
-};
-
-}
-
-#endif // __AUDIO_ZRTP_SESSION_H__
diff --git a/daemon/src/audio/audiortp/dtmf_event.cpp b/daemon/src/audio/audiortp/dtmf_event.cpp
deleted file mode 100644
index 77635b96b942f9a26f7266369c33dbd79e31e98f..0000000000000000000000000000000000000000
--- a/daemon/src/audio/audiortp/dtmf_event.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- *  Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
- *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *  Additional permission under GNU GPL version 3 section 7:
- *
- *  If you modify this program, or any covered work, by linking or
- *  combining it with the OpenSSL project's OpenSSL library (or a
- *  modified version of that library), containing parts covered by the
- *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
- *  grants you additional permission to convey the resulting work.
- *  Corresponding Source for a non-source form of such a combination
- *  shall include the source code for the parts of OpenSSL used as well
- *  as that of the covered work.
- */
-
-#include "dtmf_event.h"
-#include "logger.h"
-
-namespace ring {
-
-DTMFEvent::DTMFEvent(char digit) : payload(), newevent(true), length(1000)
-{
-    /*
-       From RFC2833:
-
-       Event  encoding (decimal)
-       _________________________
-       0--9                0--9
-       *                     10
-       #                     11
-       A--D              12--15
-       Flash                 16
-    */
-
-    switch (digit) {
-        case '!':
-            digit = 16;
-            break;
-
-        case '*':
-            digit = 10;
-            break;
-
-        case '#':
-            digit = 11;
-            break;
-
-        case 'A' ... 'D':
-            digit = digit - 'A' + 12;
-            break;
-
-        case '0' ... '9':
-            digit = digit - '0';
-            break;
-
-        default:
-            RING_ERR("Unexpected DTMF %c", digit);
-    }
-
-    payload.event = digit;
-    payload.ebit = false; // end of event bit
-    payload.rbit = false; // reserved bit
-    payload.duration = 1; // duration for this event
-    payload.vol = 10;
-}
-
-}
diff --git a/daemon/src/audio/audiortp/dtmf_event.h b/daemon/src/audio/audiortp/dtmf_event.h
deleted file mode 100644
index 560ae6ab7c61c23b19bff62d762d8b04703084a0..0000000000000000000000000000000000000000
--- a/daemon/src/audio/audiortp/dtmf_event.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *  Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
- *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *  Additional permission under GNU GPL version 3 section 7:
- *
- *  If you modify this program, or any covered work, by linking or
- *  combining it with the OpenSSL project's OpenSSL library (or a
- *  modified version of that library), containing parts covered by the
- *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
- *  grants you additional permission to convey the resulting work.
- *  Corresponding Source for a non-source form of such a combination
- *  shall include the source code for the parts of OpenSSL used as well
- *  as that of the covered work.
- */
-
-#ifndef DTMF_EVENT_H_
-#define DTMF_EVENT_H_
-
-#include <ccrtp/rtp.h>
-
-namespace ring {
-
-struct DTMFEvent {
-    DTMFEvent(char digit);
-    ost::RTPPacket::RFC2833Payload payload;
-    bool newevent;
-    int length;
-};
-
-}
-
-#endif // DTMF_EVENT_H_
diff --git a/daemon/src/audio/audiortp/zrtp_session_callback.cpp b/daemon/src/audio/audiortp/zrtp_session_callback.cpp
deleted file mode 100644
index 8e7a22ab37714fe48400500f61d63df1fcdd7560..0000000000000000000000000000000000000000
--- a/daemon/src/audio/audiortp/zrtp_session_callback.cpp
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- *  Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
- *  Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *  Additional permission under GNU GPL version 3 section 7:
- *
- *  If you modify this program, or any covered work, by linking or
- *  combining it with the OpenSSL project's OpenSSL library (or a
- *  modified version of that library), containing parts covered by the
- *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
- *  grants you additional permission to convey the resulting work.
- *  Corresponding Source for a non-source form of such a combination
- *  shall include the source code for the parts of OpenSSL used as well
- *  as that of the covered work.
- */
-#include "zrtp_session_callback.h"
-#include "logger.h"
-#include "sip/sipcall.h"
-#include "client/client.h"
-#include "client/callmanager.h"
-#include "manager.h"
-
-#include <cstdlib>
-#include <map>
-
-using namespace GnuZrtpCodes;
-
-using namespace ost;
-
-namespace ring {
-
-ZrtpSessionCallback::ZrtpSessionCallback(SIPCall &call) : call_(call)
-{
-    // we've already initialized the maps, we only need to check one
-    if (not infoMap_.empty())
-        return;
-
-    // Information Map
-    infoMap_[InfoHelloReceived] = "Hello received, preparing a Commit";
-    infoMap_[InfoCommitDHGenerated] =  "Commit: Generated a public DH key";
-    infoMap_[InfoRespCommitReceived] = "Responder: Commit received, preparing DHPart1";
-    infoMap_[InfoDH1DHGenerated] = "DH1Part: Generated a public DH key";
-    infoMap_[InfoInitDH1Received] = "Initiator: DHPart1 received, preparing DHPart2";
-    infoMap_[InfoRespDH2Received] = "Responder: DHPart2 received, preparing Confirm1";
-    infoMap_[InfoInitConf1Received] = "Initiator: Confirm1 received, preparing Confirm2";
-    infoMap_[InfoRespConf2Received] = "Responder: Confirm2 received, preparing Conf2Ack";
-    infoMap_[InfoRSMatchFound] = "At least one retained secrets matches - security OK";
-    infoMap_[InfoSecureStateOn] = "Entered secure state";
-    infoMap_[InfoSecureStateOff] = "No more security for this session";
-
-    // Warning Map
-    warningMap_[WarningDHAESmismatch] = "Commit contains an AES256 cipher but does not offer a Diffie-Helman 4096";
-    warningMap_[WarningGoClearReceived] = "Received a GoClear message";
-    warningMap_[WarningDHShort] = "Hello offers an AES256 cipher but does not offer a Diffie-Helman 4096";
-    warningMap_[WarningNoRSMatch] = "No retained secret matches - verify SAS";
-    warningMap_[WarningCRCmismatch] = "Internal ZRTP packet checksum mismatch - packet dropped";
-    warningMap_[WarningSRTPauthError] = "Dropping packet because SRTP authentication failed!";
-    warningMap_[WarningSRTPreplayError] = "Dropping packet because SRTP replay check failed!";
-
-    severeMap_[SevereHelloHMACFailed] = "Hash HMAC check of Hello failed!";
-    severeMap_[SevereCommitHMACFailed] = "Hash HMAC check of Commit failed!";
-    severeMap_[SevereDH1HMACFailed] = "Hash HMAC check of DHPart1 failed!";
-    severeMap_[SevereDH2HMACFailed] = "Hash HMAC check of DHPart2 failed!";
-    severeMap_[SevereCannotSend] = "Cannot send data - connection or peer down?";
-    severeMap_[SevereProtocolError] = "Internal protocol error occured!";
-    severeMap_[SevereNoTimer] = "Cannot start a timer - internal resources exhausted?";
-    severeMap_[SevereTooMuchRetries] = "Too much retries during ZRTP negotiation - connection or peer down?";
-
-    // Zrtp protocol related messages map
-    zrtpMap_[MalformedPacket] = "Malformed packet (CRC OK, but wrong structure)";
-    zrtpMap_[CriticalSWError] = "Critical software error";
-    zrtpMap_[UnsuppZRTPVersion] = "Unsupported ZRTP version";
-    zrtpMap_[HelloCompMismatch] = "Hello components mismatch";
-    zrtpMap_[UnsuppHashType] = "Hash type not supported";
-    zrtpMap_[UnsuppCiphertype] = "Cipher type not supported";
-    zrtpMap_[UnsuppPKExchange] = "Public key exchange not supported";
-    zrtpMap_[UnsuppSRTPAuthTag] = "SRTP auth. tag not supported";
-    zrtpMap_[UnsuppSASScheme] = "SAS scheme not supported";
-    zrtpMap_[NoSharedSecret] = "No shared secret available, DH mode required";
-    zrtpMap_[DHErrorWrongPV] = "DH Error: bad pvi or pvr ( == 1, 0, or p-1)";
-    zrtpMap_[DHErrorWrongHVI] = "DH Error: hvi != hashed data";
-    zrtpMap_[SASuntrustedMiTM] = "Received relayed SAS from untrusted MiTM";
-    zrtpMap_[ConfirmHMACWrong] = "Auth. Error: Bad Confirm pkt HMAC";
-    zrtpMap_[NonceReused] = "Nonce reuse";
-    zrtpMap_[EqualZIDHello] = "Equal ZIDs in Hello";
-    zrtpMap_[GoCleatNotAllowed] = "GoClear packet received, but not allowed";
-}
-
-void
-ZrtpSessionCallback::secureOn(std::string cipher)
-{
-    RING_DBG("Secure mode is on with cipher %s", cipher.c_str());
-    Manager::instance().getClient()->getCallManager()->secureZrtpOn(call_.getCallId(), cipher);
-}
-
-void
-ZrtpSessionCallback::secureOff()
-{
-    RING_DBG("Secure mode is off");
-    Manager::instance().getClient()->getCallManager()->secureZrtpOff(call_.getCallId());
-}
-
-void
-ZrtpSessionCallback::showSAS(std::string sas, bool verified)
-{
-    RING_DBG("SAS is: %s", sas.c_str());
-    Manager::instance().getClient()->getCallManager()->showSAS(call_.getCallId(), sas, verified);
-}
-
-void
-ZrtpSessionCallback::zrtpNotSuppOther()
-{
-    RING_DBG("Callee does not support ZRTP");
-    Manager::instance().getClient()->getCallManager()->zrtpNotSuppOther(call_.getCallId());
-}
-
-void
-ZrtpSessionCallback::showMessage(GnuZrtpCodes::MessageSeverity sev, int32_t subCode)
-{
-    if (sev == ZrtpError) {
-        if (subCode < 0) {  // received an error packet from peer
-            RING_DBG("Received an error packet from peer:");
-        } else
-            RING_DBG("Sent error packet to peer:");
-    }
-}
-
-void
-ZrtpSessionCallback::zrtpNegotiationFailed(MessageSeverity severity, int subCode)
-{
-    if (severity == ZrtpError) {
-        if (subCode < 0) {  // received an error packet from peer
-            subCode *= -1;
-            RING_DBG("Received error packet: ");
-        } else
-            RING_DBG("Sent error packet: ");
-
-        std::map<int32, std::string>::const_iterator iter = zrtpMap_.find(subCode);
-
-        if (iter != zrtpMap_.end()) {
-            RING_DBG("%s", iter->second.c_str());
-            Manager::instance().getClient()->getCallManager()->zrtpNegotiationFailed(call_.getCallId(), iter->second, "ZRTP");
-        }
-    } else {
-        std::map<int32, std::string>::const_iterator iter = severeMap_.find(subCode);
-
-        if (iter != severeMap_.end()) {
-            RING_DBG("%s", iter->second.c_str());
-            Manager::instance().getClient()->getCallManager()->zrtpNegotiationFailed(call_.getCallId(), iter->second, "severe");
-        }
-    }
-}
-
-void
-ZrtpSessionCallback::confirmGoClear()
-{
-    RING_DBG("Received go clear message. Until confirmation, ZRTP won't send any data");
-    Manager::instance().getClient()->getCallManager()->zrtpNotSuppOther(call_.getCallId());
-}
-
-std::map<int32, std::string> ZrtpSessionCallback::infoMap_;
-std::map<int32, std::string> ZrtpSessionCallback::warningMap_;
-std::map<int32, std::string> ZrtpSessionCallback::severeMap_;
-std::map<int32, std::string> ZrtpSessionCallback::zrtpMap_;
-}
-
diff --git a/daemon/src/audio/audiortp/zrtp_session_callback.h b/daemon/src/audio/audiortp/zrtp_session_callback.h
deleted file mode 100644
index d0fcedfb697916c84880ff7a4949ef6fa932e790..0000000000000000000000000000000000000000
--- a/daemon/src/audio/audiortp/zrtp_session_callback.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *  Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
- *  Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *  Additional permission under GNU GPL version 3 section 7:
- *
- *  If you modify this program, or any covered work, by linking or
- *  combining it with the OpenSSL project's OpenSSL library (or a
- *  modified version of that library), containing parts covered by the
- *  terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
- *  grants you additional permission to convey the resulting work.
- *  Corresponding Source for a non-source form of such a combination
- *  shall include the source code for the parts of OpenSSL used as well
- *  as that of the covered work.
- */
-
-#ifndef ZRTP_SESSION_CALLBACK_H_
-#define ZRTP_SESSION_CALLBACK_H_
-#include <cstddef>
-
-using std::ptrdiff_t;
-
-#include <libzrtpcpp/zrtpccrtp.h>
-#include <libzrtpcpp/ZrtpQueue.h>
-#include <libzrtpcpp/ZrtpUserCallback.h>
-#include <string>
-#include <map>
-
-class SIPCall;
-
-namespace ring {
-
-class ZrtpSessionCallback: public ZrtpUserCallback {
-    public:
-        ZrtpSessionCallback(SIPCall &call);
-
-        void secureOn(std::string cipher);
-        void secureOff();
-        void showSAS(std::string sas, bool verified);
-        void zrtpNotSuppOther();
-        void showMessage(GnuZrtpCodes::MessageSeverity sev, int32_t subCode);
-        void zrtpNegotiationFailed(GnuZrtpCodes::MessageSeverity severity, int subCode);
-        void confirmGoClear();
-
-    private:
-        SIPCall &call_;
-        static std::map<int32, std::string> infoMap_;
-        static std::map<int32, std::string> warningMap_;
-        static std::map<int32, std::string> severeMap_;
-        static std::map<int32, std::string> zrtpMap_;
-};
-}
-#endif // ZRTP_SESSION_CALLBACK_H_
diff --git a/daemon/src/client/callmanager.cpp b/daemon/src/client/callmanager.cpp
index cf8329991e652e242e7868c6c482e5a5bb69103e..718415398af3995b57aed723f635dbc23a3a303c 100644
--- a/daemon/src/client/callmanager.cpp
+++ b/daemon/src/client/callmanager.cpp
@@ -37,10 +37,6 @@
 #include "sip/sipcall.h"
 #include "sip/sipvoiplink.h"
 #include "audio/audiolayer.h"
-#include "audio/audiortp/audio_rtp_factory.h"
-#if HAVE_ZRTP
-#include "audio/audiortp/audio_zrtp_session.h"
-#endif
 
 #include "logger.h"
 #include "manager.h"
@@ -303,76 +299,31 @@ CallManager::getAudioZrtpSession(const std::string& callID)
 void
 CallManager::setSASVerified(const std::string& callID)
 {
-#if USE_CCRTP && HAVE_ZRTP
-    try {
-        ring::AudioZrtpSession * zSession;
-        zSession = getAudioZrtpSession(callID);
-        zSession->SASVerified();
-    } catch (...) {
-    }
-#else
-    RING_ERR("No zrtp support for %s, please recompile SFLphone with zrtp", callID.c_str());
-#endif
+    RING_ERR("ZRTP not supported");
 }
 
 void
 CallManager::resetSASVerified(const std::string& callID)
 {
-#if USE_CCRTP && HAVE_ZRTP
-    try {
-        ring::AudioZrtpSession * zSession;
-        zSession = getAudioZrtpSession(callID);
-        zSession->resetSASVerified();
-    } catch (...) {
-    }
-#else
-    RING_ERR("No zrtp support for %s, please recompile SFLphone with zrtp", callID.c_str());
-#endif
+    RING_ERR("ZRTP not supported");
 }
 
 void
 CallManager::setConfirmGoClear(const std::string& callID)
 {
-#if USE_CCRTP && HAVE_ZRTP
-    try {
-        ring::AudioZrtpSession * zSession;
-        zSession = getAudioZrtpSession(callID);
-        zSession->goClearOk();
-    } catch (...) {
-    }
-#else
-    RING_ERR("No zrtp support for %s, please recompile SFLphone with zrtp", callID.c_str());
-#endif
+    RING_ERR("ZRTP not supported");
 }
 
 void
 CallManager::requestGoClear(const std::string& callID)
 {
-#if USE_CCRTP && HAVE_ZRTP
-    try {
-        ring::AudioZrtpSession * zSession;
-        zSession = getAudioZrtpSession(callID);
-        zSession->requestGoClear();
-    } catch (...) {
-    }
-#else
-    RING_ERR("No zrtp support for %s, please recompile SFLphone with zrtp", callID.c_str());
-#endif
+    RING_ERR("ZRTP not supported");
 }
 
 void
 CallManager::acceptEnrollment(const std::string& callID, bool accepted)
 {
-#if USE_CCRTP && HAVE_ZRTP
-    try {
-        ring::AudioZrtpSession * zSession;
-        zSession = getAudioZrtpSession(callID);
-        zSession->acceptEnrollment(accepted);
-    } catch (...) {
-    }
-#else
-    RING_ERR("No zrtp support for %s, please recompile SFLphone with zrtp", callID.c_str());
-#endif
+    RING_ERR("ZRTP not supported");
 }
 
 void CallManager::sendTextMessage(const std::string& callID, const std::string& message, const std::string& from)
diff --git a/daemon/src/client/videomanager.cpp b/daemon/src/client/videomanager.cpp
index 4922473a0d29b8e91415fdf2eacd650dd3427079..7b9827103cdb5a1e6975e1933dac988784eb7660 100644
--- a/daemon/src/client/videomanager.cpp
+++ b/daemon/src/client/videomanager.cpp
@@ -31,7 +31,7 @@
  */
 
 #include "videomanager.h"
-#include "video/libav_utils.h"
+#include "libav_utils.h"
 #include "video/video_input.h"
 #include "video/video_device_monitor.h"
 #include "account.h"
diff --git a/daemon/src/media/Makefile.am b/daemon/src/media/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..3cdc6f3b690f49c8712ee871833465bee4d200b1
--- /dev/null
+++ b/daemon/src/media/Makefile.am
@@ -0,0 +1,34 @@
+include $(top_srcdir)/globals.mak
+
+noinst_LTLIBRARIES = libmedia.la
+
+SUBDIRS = audio
+
+if RING_VIDEO
+SUBDIRS += video
+endif
+
+libmedia_la_SOURCES = \
+	libav_utils.cpp
+
+noinst_HEADERS = \
+	libav_utils.h \
+	libav_deps.h
+
+libmedia_la_LIBADD = \
+	./audio/libaudio.la
+
+if RING_VIDEO
+libmedia_la_libADD = \
+	./video/libvideo.la
+endif
+
+libmedia_la_LDFLAGS = @LIBAVCODEC_LIBS@ @LIBAVFORMAT_LIBS@ @LIBAVDEVICE_LIBS@ @LIBSWSCALE_LIBS@ @LIBAVUTIL_LIBS@
+
+AM_CFLAGS=@LIBAVCODEC_CFLAGS@ @LIBAVFORMAT_CFLAGS@ @LIBAVDEVICE_CFLAGS@ @LIBSWSCALE_CFLAGS@
+
+AM_CXXFLAGS=@LIBAVCODEC_CFLAGS@ @LIBAVFORMAT_CFLAGS@ @LIBAVDEVICE_CFLAGS@ @LIBSWSCALE_CFLAGS@
+
+if RING_VIDEO
+AM_CXXFLAGS += @UDEV_CFLAGS@
+endif
diff --git a/daemon/src/audio/Makefile.am b/daemon/src/media/audio/Makefile.am
similarity index 98%
rename from daemon/src/audio/Makefile.am
rename to daemon/src/media/audio/Makefile.am
index 363a4c9b012d2a5322c8124aca79787e8685aee1..929b912c572b2778792788be91c65dd02c8b007b 100644
--- a/daemon/src/audio/Makefile.am
+++ b/daemon/src/media/audio/Makefile.am
@@ -56,7 +56,7 @@ noinst_HEADERS = \
 		audiorecord.h \
 		audiorecorder.h \
 		audiolayer.h \
-	 	recordable.h \
+		recordable.h \
 		$(RING_SPEEXDSP_HEAD) \
 		dcblocker.h \
 		resampler.h
diff --git a/daemon/src/audio/alsa/Makefile.am b/daemon/src/media/audio/alsa/Makefile.am
similarity index 100%
rename from daemon/src/audio/alsa/Makefile.am
rename to daemon/src/media/audio/alsa/Makefile.am
diff --git a/daemon/src/audio/alsa/alsalayer.cpp b/daemon/src/media/audio/alsa/alsalayer.cpp
similarity index 100%
rename from daemon/src/audio/alsa/alsalayer.cpp
rename to daemon/src/media/audio/alsa/alsalayer.cpp
diff --git a/daemon/src/audio/alsa/alsalayer.h b/daemon/src/media/audio/alsa/alsalayer.h
similarity index 100%
rename from daemon/src/audio/alsa/alsalayer.h
rename to daemon/src/media/audio/alsa/alsalayer.h
diff --git a/daemon/src/audio/audiobuffer.cpp b/daemon/src/media/audio/audiobuffer.cpp
similarity index 100%
rename from daemon/src/audio/audiobuffer.cpp
rename to daemon/src/media/audio/audiobuffer.cpp
diff --git a/daemon/src/audio/audiobuffer.h b/daemon/src/media/audio/audiobuffer.h
similarity index 100%
rename from daemon/src/audio/audiobuffer.h
rename to daemon/src/media/audio/audiobuffer.h
diff --git a/daemon/src/audio/audiolayer.cpp b/daemon/src/media/audio/audiolayer.cpp
similarity index 100%
rename from daemon/src/audio/audiolayer.cpp
rename to daemon/src/media/audio/audiolayer.cpp
diff --git a/daemon/src/audio/audiolayer.h b/daemon/src/media/audio/audiolayer.h
similarity index 100%
rename from daemon/src/audio/audiolayer.h
rename to daemon/src/media/audio/audiolayer.h
diff --git a/daemon/src/audio/audioloop.cpp b/daemon/src/media/audio/audioloop.cpp
similarity index 100%
rename from daemon/src/audio/audioloop.cpp
rename to daemon/src/media/audio/audioloop.cpp
diff --git a/daemon/src/audio/audioloop.h b/daemon/src/media/audio/audioloop.h
similarity index 99%
rename from daemon/src/audio/audioloop.h
rename to daemon/src/media/audio/audioloop.h
index a6a4f6d6a04784ab22f3c06c902d82ab6cbace74..e257a86658a6df6080a9bfb813d2a8ebcd61fa26 100644
--- a/daemon/src/audio/audioloop.h
+++ b/daemon/src/media/audio/audioloop.h
@@ -92,4 +92,3 @@ class AudioLoop {
 }
 
 #endif // __AUDIOLOOP_H__
-
diff --git a/daemon/src/audio/audiorecord.cpp b/daemon/src/media/audio/audiorecord.cpp
similarity index 100%
rename from daemon/src/audio/audiorecord.cpp
rename to daemon/src/media/audio/audiorecord.cpp
diff --git a/daemon/src/audio/audiorecord.h b/daemon/src/media/audio/audiorecord.h
similarity index 98%
rename from daemon/src/audio/audiorecord.h
rename to daemon/src/media/audio/audiorecord.h
index 41f0019c79636f8ed45976a541832b1e8c400f84..b357313a736e74001018b15442fee9ba59bfd7fd 100644
--- a/daemon/src/audio/audiorecord.h
+++ b/daemon/src/media/audio/audiorecord.h
@@ -58,8 +58,8 @@ class AudioRecord {
         void initFilename(const std::string &peerNumber);
 
         /**
-        	 * Return the filepath of the recording
-        	 */
+         * Return the filepath of the recording
+         */
         std::string getFilename() const;
 
         /**
diff --git a/daemon/src/audio/audiorecorder.cpp b/daemon/src/media/audio/audiorecorder.cpp
similarity index 100%
rename from daemon/src/audio/audiorecorder.cpp
rename to daemon/src/media/audio/audiorecorder.cpp
diff --git a/daemon/src/audio/audiorecorder.h b/daemon/src/media/audio/audiorecorder.h
similarity index 100%
rename from daemon/src/audio/audiorecorder.h
rename to daemon/src/media/audio/audiorecorder.h
diff --git a/daemon/src/media/audio/audiortp/Makefile.am b/daemon/src/media/audio/audiortp/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..e047ab1d89c4b5c80e5645d471d47fadb66f9d0d
--- /dev/null
+++ b/daemon/src/media/audio/audiortp/Makefile.am
@@ -0,0 +1,15 @@
+include $(top_srcdir)/globals.mak
+
+noinst_LTLIBRARIES = libaudiortp.la
+
+libaudiortp_la_SOURCES = \
+		base64.c base64.h
+
+libaudiortp_la_SOURCES += \
+		avformat_rtp_session.cpp \
+		avformat_rtp_session.h
+
+AM_CXXFLAGS = @LIBAVFORMAT_CFLAGS@
+
+# FIXME
+AM_CPPFLAGS += -I$(top_srcdir)/src
diff --git a/daemon/src/audio/audiortp/TODO b/daemon/src/media/audio/audiortp/TODO
similarity index 92%
rename from daemon/src/audio/audiortp/TODO
rename to daemon/src/media/audio/audiortp/TODO
index 06bf60ae98d7519436f509de8c85c2292fe632da..246c72bb6715e494b65a23fad9221afcde801e31 100644
--- a/daemon/src/audio/audiortp/TODO
+++ b/daemon/src/media/audio/audiortp/TODO
@@ -13,7 +13,6 @@ Needs to be implemented
 * DTMF over RTP
 * RTP + STUN
 * Rename Video{Encoder,Decoder} to AV{Encoder,Decoder}
-* Drop CCRTP and its dependencies and its dependents for real
 
 Needs to be fixed:
 ------------------
diff --git a/daemon/src/audio/audiortp/avformat_rtp_session.cpp b/daemon/src/media/audio/audiortp/avformat_rtp_session.cpp
similarity index 99%
rename from daemon/src/audio/audiortp/avformat_rtp_session.cpp
rename to daemon/src/media/audio/audiortp/avformat_rtp_session.cpp
index 412eae00d8d92553f89e4b9a60270f05f20277cd..09b30db2c0cc3f0e04225def00bd41e1d7f3835d 100644
--- a/daemon/src/audio/audiortp/avformat_rtp_session.cpp
+++ b/daemon/src/media/audio/audiortp/avformat_rtp_session.cpp
@@ -36,7 +36,7 @@
 #include "video/video_base.h"
 #include "video/video_encoder.h"
 #include "video/video_decoder.h"
-#include "video/libav_deps.h"
+#include "libav_deps.h"
 #include "audio/audiobuffer.h"
 #include "audio/ringbufferpool.h"
 #include "audio/resampler.h"
diff --git a/daemon/src/audio/audiortp/avformat_rtp_session.h b/daemon/src/media/audio/audiortp/avformat_rtp_session.h
similarity index 100%
rename from daemon/src/audio/audiortp/avformat_rtp_session.h
rename to daemon/src/media/audio/audiortp/avformat_rtp_session.h
diff --git a/daemon/src/audio/audiortp/base64.c b/daemon/src/media/audio/audiortp/base64.c
similarity index 100%
rename from daemon/src/audio/audiortp/base64.c
rename to daemon/src/media/audio/audiortp/base64.c
diff --git a/daemon/src/audio/audiortp/base64.h b/daemon/src/media/audio/audiortp/base64.h
similarity index 100%
rename from daemon/src/audio/audiortp/base64.h
rename to daemon/src/media/audio/audiortp/base64.h
diff --git a/daemon/src/audio/codecs/Makefile.am b/daemon/src/media/audio/codecs/Makefile.am
similarity index 99%
rename from daemon/src/audio/codecs/Makefile.am
rename to daemon/src/media/audio/codecs/Makefile.am
index 540a07866ef5014a2885da5390198ff225630d58..275a2d523a3f36a84a84c0ec3c8412280e6e4302 100644
--- a/daemon/src/audio/codecs/Makefile.am
+++ b/daemon/src/media/audio/codecs/Makefile.am
@@ -4,7 +4,6 @@ noinst_LTLIBRARIES = libcodecdescriptor.la
 
 libcodecdescriptor_la_SOURCES = audiocodecfactory.cpp audiocodec.cpp audiocodec.h audiocodecfactory.h
 libcodecdescriptor_la_CXXFLAGS = -fPIC
-libcodecdescriptor_la_LIBADD = $(CCRTP_LIBS)
 
 if BUILD_GSM
 GSM_LIB = libcodec_gsm.so
@@ -119,4 +118,3 @@ uninstall-libcodec_speex_ub_so:
 	rm -f $(sflcodecdir)/libcodec_speex_ub.so
 uninstall-libcodec_ilbc_so:
 	rm -f $(sflcodecdir)/libcodec_ilbc.so
-
diff --git a/daemon/src/audio/codecs/README b/daemon/src/media/audio/codecs/README
similarity index 100%
rename from daemon/src/audio/codecs/README
rename to daemon/src/media/audio/codecs/README
diff --git a/daemon/src/audio/codecs/alaw.cpp b/daemon/src/media/audio/codecs/alaw.cpp
similarity index 100%
rename from daemon/src/audio/codecs/alaw.cpp
rename to daemon/src/media/audio/codecs/alaw.cpp
diff --git a/daemon/src/audio/codecs/audiocodec.cpp b/daemon/src/media/audio/codecs/audiocodec.cpp
similarity index 100%
rename from daemon/src/audio/codecs/audiocodec.cpp
rename to daemon/src/media/audio/codecs/audiocodec.cpp
diff --git a/daemon/src/audio/codecs/audiocodec.h b/daemon/src/media/audio/codecs/audiocodec.h
similarity index 100%
rename from daemon/src/audio/codecs/audiocodec.h
rename to daemon/src/media/audio/codecs/audiocodec.h
diff --git a/daemon/src/audio/codecs/audiocodecfactory.cpp b/daemon/src/media/audio/codecs/audiocodecfactory.cpp
similarity index 100%
rename from daemon/src/audio/codecs/audiocodecfactory.cpp
rename to daemon/src/media/audio/codecs/audiocodecfactory.cpp
diff --git a/daemon/src/audio/codecs/audiocodecfactory.h b/daemon/src/media/audio/codecs/audiocodecfactory.h
similarity index 100%
rename from daemon/src/audio/codecs/audiocodecfactory.h
rename to daemon/src/media/audio/codecs/audiocodecfactory.h
diff --git a/daemon/src/audio/codecs/g711.h b/daemon/src/media/audio/codecs/g711.h
similarity index 100%
rename from daemon/src/audio/codecs/g711.h
rename to daemon/src/media/audio/codecs/g711.h
diff --git a/daemon/src/audio/codecs/g722.cpp b/daemon/src/media/audio/codecs/g722.cpp
similarity index 100%
rename from daemon/src/audio/codecs/g722.cpp
rename to daemon/src/media/audio/codecs/g722.cpp
diff --git a/daemon/src/audio/codecs/g722.h b/daemon/src/media/audio/codecs/g722.h
similarity index 100%
rename from daemon/src/audio/codecs/g722.h
rename to daemon/src/media/audio/codecs/g722.h
diff --git a/daemon/src/audio/codecs/g729.cpp b/daemon/src/media/audio/codecs/g729.cpp
similarity index 100%
rename from daemon/src/audio/codecs/g729.cpp
rename to daemon/src/media/audio/codecs/g729.cpp
diff --git a/daemon/src/audio/codecs/g729.h b/daemon/src/media/audio/codecs/g729.h
similarity index 100%
rename from daemon/src/audio/codecs/g729.h
rename to daemon/src/media/audio/codecs/g729.h
diff --git a/daemon/src/audio/codecs/gsmcodec.cpp b/daemon/src/media/audio/codecs/gsmcodec.cpp
similarity index 100%
rename from daemon/src/audio/codecs/gsmcodec.cpp
rename to daemon/src/media/audio/codecs/gsmcodec.cpp
diff --git a/daemon/src/audio/codecs/ilbc.cpp b/daemon/src/media/audio/codecs/ilbc.cpp
similarity index 100%
rename from daemon/src/audio/codecs/ilbc.cpp
rename to daemon/src/media/audio/codecs/ilbc.cpp
diff --git a/daemon/src/audio/codecs/opuscodec.cpp b/daemon/src/media/audio/codecs/opuscodec.cpp
similarity index 100%
rename from daemon/src/audio/codecs/opuscodec.cpp
rename to daemon/src/media/audio/codecs/opuscodec.cpp
diff --git a/daemon/src/audio/codecs/opuscodec.h b/daemon/src/media/audio/codecs/opuscodec.h
similarity index 100%
rename from daemon/src/audio/codecs/opuscodec.h
rename to daemon/src/media/audio/codecs/opuscodec.h
diff --git a/daemon/src/audio/codecs/speexcodec.cpp b/daemon/src/media/audio/codecs/speexcodec.cpp
similarity index 100%
rename from daemon/src/audio/codecs/speexcodec.cpp
rename to daemon/src/media/audio/codecs/speexcodec.cpp
diff --git a/daemon/src/audio/codecs/speexcodec.h b/daemon/src/media/audio/codecs/speexcodec.h
similarity index 100%
rename from daemon/src/audio/codecs/speexcodec.h
rename to daemon/src/media/audio/codecs/speexcodec.h
diff --git a/daemon/src/audio/codecs/ulaw.cpp b/daemon/src/media/audio/codecs/ulaw.cpp
similarity index 100%
rename from daemon/src/audio/codecs/ulaw.cpp
rename to daemon/src/media/audio/codecs/ulaw.cpp
diff --git a/daemon/src/audio/coreaudio/Makefile.am b/daemon/src/media/audio/coreaudio/Makefile.am
similarity index 85%
rename from daemon/src/audio/coreaudio/Makefile.am
rename to daemon/src/media/audio/coreaudio/Makefile.am
index b600cadcc6071bf5b0f2e9345d51ad362740eeed..1969b70316e52011e4950a219db9ccb840aa921b 100644
--- a/daemon/src/audio/coreaudio/Makefile.am
+++ b/daemon/src/media/audio/coreaudio/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/globals.mak
+
 if HAVE_OSX
 noinst_LTLIBRARIES = libcoreaudiolayer.la
 endif
diff --git a/daemon/src/audio/coreaudio/audiodevice.cpp b/daemon/src/media/audio/coreaudio/audiodevice.cpp
similarity index 100%
rename from daemon/src/audio/coreaudio/audiodevice.cpp
rename to daemon/src/media/audio/coreaudio/audiodevice.cpp
diff --git a/daemon/src/audio/coreaudio/audiodevice.h b/daemon/src/media/audio/coreaudio/audiodevice.h
similarity index 100%
rename from daemon/src/audio/coreaudio/audiodevice.h
rename to daemon/src/media/audio/coreaudio/audiodevice.h
diff --git a/daemon/src/audio/coreaudio/corelayer.cpp b/daemon/src/media/audio/coreaudio/corelayer.cpp
similarity index 100%
rename from daemon/src/audio/coreaudio/corelayer.cpp
rename to daemon/src/media/audio/coreaudio/corelayer.cpp
diff --git a/daemon/src/audio/coreaudio/corelayer.h b/daemon/src/media/audio/coreaudio/corelayer.h
similarity index 100%
rename from daemon/src/audio/coreaudio/corelayer.h
rename to daemon/src/media/audio/coreaudio/corelayer.h
diff --git a/daemon/src/audio/dcblocker.cpp b/daemon/src/media/audio/dcblocker.cpp
similarity index 100%
rename from daemon/src/audio/dcblocker.cpp
rename to daemon/src/media/audio/dcblocker.cpp
diff --git a/daemon/src/audio/dcblocker.h b/daemon/src/media/audio/dcblocker.h
similarity index 100%
rename from daemon/src/audio/dcblocker.h
rename to daemon/src/media/audio/dcblocker.h
diff --git a/daemon/src/audio/dsp.cpp b/daemon/src/media/audio/dsp.cpp
similarity index 100%
rename from daemon/src/audio/dsp.cpp
rename to daemon/src/media/audio/dsp.cpp
diff --git a/daemon/src/audio/dsp.h b/daemon/src/media/audio/dsp.h
similarity index 100%
rename from daemon/src/audio/dsp.h
rename to daemon/src/media/audio/dsp.h
diff --git a/daemon/src/audio/jack/Makefile.am b/daemon/src/media/audio/jack/Makefile.am
similarity index 100%
rename from daemon/src/audio/jack/Makefile.am
rename to daemon/src/media/audio/jack/Makefile.am
diff --git a/daemon/src/audio/jack/jacklayer.cpp b/daemon/src/media/audio/jack/jacklayer.cpp
similarity index 100%
rename from daemon/src/audio/jack/jacklayer.cpp
rename to daemon/src/media/audio/jack/jacklayer.cpp
diff --git a/daemon/src/audio/jack/jacklayer.h b/daemon/src/media/audio/jack/jacklayer.h
similarity index 100%
rename from daemon/src/audio/jack/jacklayer.h
rename to daemon/src/media/audio/jack/jacklayer.h
diff --git a/daemon/src/audio/opensl/Makefile.am b/daemon/src/media/audio/opensl/Makefile.am
similarity index 100%
rename from daemon/src/audio/opensl/Makefile.am
rename to daemon/src/media/audio/opensl/Makefile.am
diff --git a/daemon/src/audio/opensl/opensllayer.cpp b/daemon/src/media/audio/opensl/opensllayer.cpp
similarity index 100%
rename from daemon/src/audio/opensl/opensllayer.cpp
rename to daemon/src/media/audio/opensl/opensllayer.cpp
diff --git a/daemon/src/audio/opensl/opensllayer.h b/daemon/src/media/audio/opensl/opensllayer.h
similarity index 100%
rename from daemon/src/audio/opensl/opensllayer.h
rename to daemon/src/media/audio/opensl/opensllayer.h
diff --git a/daemon/src/audio/pulseaudio/Makefile.am b/daemon/src/media/audio/pulseaudio/Makefile.am
similarity index 100%
rename from daemon/src/audio/pulseaudio/Makefile.am
rename to daemon/src/media/audio/pulseaudio/Makefile.am
diff --git a/daemon/src/audio/pulseaudio/audiostream.cpp b/daemon/src/media/audio/pulseaudio/audiostream.cpp
similarity index 100%
rename from daemon/src/audio/pulseaudio/audiostream.cpp
rename to daemon/src/media/audio/pulseaudio/audiostream.cpp
diff --git a/daemon/src/audio/pulseaudio/audiostream.h b/daemon/src/media/audio/pulseaudio/audiostream.h
similarity index 100%
rename from daemon/src/audio/pulseaudio/audiostream.h
rename to daemon/src/media/audio/pulseaudio/audiostream.h
diff --git a/daemon/src/audio/pulseaudio/pulselayer.cpp b/daemon/src/media/audio/pulseaudio/pulselayer.cpp
similarity index 100%
rename from daemon/src/audio/pulseaudio/pulselayer.cpp
rename to daemon/src/media/audio/pulseaudio/pulselayer.cpp
diff --git a/daemon/src/audio/pulseaudio/pulselayer.h b/daemon/src/media/audio/pulseaudio/pulselayer.h
similarity index 99%
rename from daemon/src/audio/pulseaudio/pulselayer.h
rename to daemon/src/media/audio/pulseaudio/pulselayer.h
index 735f0d2bb37d56b0aee15dd27552606ab93b2fda..812577d07e047b67e7f1fb462ccc2e312f43a326 100644
--- a/daemon/src/audio/pulseaudio/pulselayer.h
+++ b/daemon/src/media/audio/pulseaudio/pulselayer.h
@@ -233,4 +233,3 @@ class PulseLayer : public AudioLayer {
 }
 
 #endif // PULSE_LAYER_H_
-
diff --git a/daemon/src/audio/recordable.cpp b/daemon/src/media/audio/recordable.cpp
similarity index 100%
rename from daemon/src/audio/recordable.cpp
rename to daemon/src/media/audio/recordable.cpp
diff --git a/daemon/src/audio/recordable.h b/daemon/src/media/audio/recordable.h
similarity index 100%
rename from daemon/src/audio/recordable.h
rename to daemon/src/media/audio/recordable.h
diff --git a/daemon/src/audio/resampler.cpp b/daemon/src/media/audio/resampler.cpp
similarity index 100%
rename from daemon/src/audio/resampler.cpp
rename to daemon/src/media/audio/resampler.cpp
diff --git a/daemon/src/audio/resampler.h b/daemon/src/media/audio/resampler.h
similarity index 100%
rename from daemon/src/audio/resampler.h
rename to daemon/src/media/audio/resampler.h
diff --git a/daemon/src/audio/ringbuffer.cpp b/daemon/src/media/audio/ringbuffer.cpp
similarity index 100%
rename from daemon/src/audio/ringbuffer.cpp
rename to daemon/src/media/audio/ringbuffer.cpp
diff --git a/daemon/src/audio/ringbuffer.h b/daemon/src/media/audio/ringbuffer.h
similarity index 100%
rename from daemon/src/audio/ringbuffer.h
rename to daemon/src/media/audio/ringbuffer.h
diff --git a/daemon/src/audio/ringbufferpool.cpp b/daemon/src/media/audio/ringbufferpool.cpp
similarity index 100%
rename from daemon/src/audio/ringbufferpool.cpp
rename to daemon/src/media/audio/ringbufferpool.cpp
diff --git a/daemon/src/audio/ringbufferpool.h b/daemon/src/media/audio/ringbufferpool.h
similarity index 100%
rename from daemon/src/audio/ringbufferpool.h
rename to daemon/src/media/audio/ringbufferpool.h
diff --git a/daemon/src/audio/sound/Makefile.am b/daemon/src/media/audio/sound/Makefile.am
similarity index 99%
rename from daemon/src/audio/sound/Makefile.am
rename to daemon/src/media/audio/sound/Makefile.am
index 0680471c72962021e672a1fc78dd13ab0d7765c3..f2ba42881f9dbdd0486d1665e87a603e152a4d9e 100644
--- a/daemon/src/audio/sound/Makefile.am
+++ b/daemon/src/media/audio/sound/Makefile.am
@@ -15,4 +15,3 @@ noinst_HEADERS = \
 	tonelist.h \
 	dtmfgenerator.h \
 	dtmf.h
-
diff --git a/daemon/src/audio/sound/audiofile.cpp b/daemon/src/media/audio/sound/audiofile.cpp
similarity index 100%
rename from daemon/src/audio/sound/audiofile.cpp
rename to daemon/src/media/audio/sound/audiofile.cpp
diff --git a/daemon/src/audio/sound/audiofile.h b/daemon/src/media/audio/sound/audiofile.h
similarity index 100%
rename from daemon/src/audio/sound/audiofile.h
rename to daemon/src/media/audio/sound/audiofile.h
diff --git a/daemon/src/audio/sound/dtmf.cpp b/daemon/src/media/audio/sound/dtmf.cpp
similarity index 100%
rename from daemon/src/audio/sound/dtmf.cpp
rename to daemon/src/media/audio/sound/dtmf.cpp
diff --git a/daemon/src/audio/sound/dtmf.h b/daemon/src/media/audio/sound/dtmf.h
similarity index 100%
rename from daemon/src/audio/sound/dtmf.h
rename to daemon/src/media/audio/sound/dtmf.h
diff --git a/daemon/src/audio/sound/dtmfgenerator.cpp b/daemon/src/media/audio/sound/dtmfgenerator.cpp
similarity index 100%
rename from daemon/src/audio/sound/dtmfgenerator.cpp
rename to daemon/src/media/audio/sound/dtmfgenerator.cpp
diff --git a/daemon/src/audio/sound/dtmfgenerator.h b/daemon/src/media/audio/sound/dtmfgenerator.h
similarity index 100%
rename from daemon/src/audio/sound/dtmfgenerator.h
rename to daemon/src/media/audio/sound/dtmfgenerator.h
diff --git a/daemon/src/audio/sound/tone.cpp b/daemon/src/media/audio/sound/tone.cpp
similarity index 100%
rename from daemon/src/audio/sound/tone.cpp
rename to daemon/src/media/audio/sound/tone.cpp
diff --git a/daemon/src/audio/sound/tone.h b/daemon/src/media/audio/sound/tone.h
similarity index 99%
rename from daemon/src/audio/sound/tone.h
rename to daemon/src/media/audio/sound/tone.h
index d70b64114eb52369d490b92030e815c038d0f0ad..cc75cdb4ebec47f3ded94aee780b8adf14990375 100644
--- a/daemon/src/audio/sound/tone.h
+++ b/daemon/src/media/audio/sound/tone.h
@@ -96,4 +96,3 @@ class Tone : public AudioLoop {
 }
 
 #endif // __TONE_H__
-
diff --git a/daemon/src/audio/sound/tonelist.cpp b/daemon/src/media/audio/sound/tonelist.cpp
similarity index 100%
rename from daemon/src/audio/sound/tonelist.cpp
rename to daemon/src/media/audio/sound/tonelist.cpp
diff --git a/daemon/src/audio/sound/tonelist.h b/daemon/src/media/audio/sound/tonelist.h
similarity index 100%
rename from daemon/src/audio/sound/tonelist.h
rename to daemon/src/media/audio/sound/tonelist.h
diff --git a/daemon/src/video/libav_deps.h b/daemon/src/media/libav_deps.h
similarity index 100%
rename from daemon/src/video/libav_deps.h
rename to daemon/src/media/libav_deps.h
diff --git a/daemon/src/video/libav_utils.cpp b/daemon/src/media/libav_utils.cpp
similarity index 99%
rename from daemon/src/video/libav_utils.cpp
rename to daemon/src/media/libav_utils.cpp
index 261fe46d800229190f39358ab9300aba3aad2fbf..261e58c4bdb9d87ef5b9ae72b5e42e2f90de72a3 100644
--- a/daemon/src/video/libav_utils.cpp
+++ b/daemon/src/media/libav_utils.cpp
@@ -31,7 +31,7 @@
  */
 
 #include "libav_deps.h"
-#include "video_base.h"
+#include "video/video_base.h"
 #include "logger.h"
 
 #include <vector>
diff --git a/daemon/src/video/libav_utils.h b/daemon/src/media/libav_utils.h
similarity index 100%
rename from daemon/src/video/libav_utils.h
rename to daemon/src/media/libav_utils.h
diff --git a/daemon/src/video/.gitignore b/daemon/src/media/video/.gitignore
similarity index 100%
rename from daemon/src/video/.gitignore
rename to daemon/src/media/video/.gitignore
diff --git a/daemon/src/video/Makefile.am b/daemon/src/media/video/Makefile.am
similarity index 92%
rename from daemon/src/video/Makefile.am
rename to daemon/src/media/video/Makefile.am
index 2487ab35fc430c3b5c657f6862b1be36546db38b..ab5d484149f8b8cf94958a9b7dc4ceb336687079 100644
--- a/daemon/src/video/Makefile.am
+++ b/daemon/src/media/video/Makefile.am
@@ -17,8 +17,7 @@ libvideo_la_SOURCES = \
 	video_receive_thread.cpp video_receive_thread.h \
 	video_sender.cpp video_sender.h \
 	video_rtp_session.cpp video_rtp_session.h \
-	shm_header.h video_provider.h \
-	libav_utils.cpp libav_utils.h libav_deps.h
+	shm_header.h video_provider.h
 
 libvideo_la_LIBADD = @LIBAVCODEC_LIBS@ @LIBAVFORMAT_LIBS@ @LIBAVDEVICE_LIBS@ @LIBSWSCALE_LIBS@ @LIBAVUTIL_LIBS@
 
diff --git a/daemon/src/video/TODO b/daemon/src/media/video/TODO
similarity index 100%
rename from daemon/src/video/TODO
rename to daemon/src/media/video/TODO
diff --git a/daemon/src/video/shm_header.h b/daemon/src/media/video/shm_header.h
similarity index 100%
rename from daemon/src/video/shm_header.h
rename to daemon/src/media/video/shm_header.h
diff --git a/daemon/src/video/shm_sink.cpp b/daemon/src/media/video/shm_sink.cpp
similarity index 100%
rename from daemon/src/video/shm_sink.cpp
rename to daemon/src/media/video/shm_sink.cpp
diff --git a/daemon/src/video/shm_sink.h b/daemon/src/media/video/shm_sink.h
similarity index 100%
rename from daemon/src/video/shm_sink.h
rename to daemon/src/media/video/shm_sink.h
diff --git a/daemon/src/video/socket_pair.cpp b/daemon/src/media/video/socket_pair.cpp
similarity index 100%
rename from daemon/src/video/socket_pair.cpp
rename to daemon/src/media/video/socket_pair.cpp
diff --git a/daemon/src/video/socket_pair.h b/daemon/src/media/video/socket_pair.h
similarity index 100%
rename from daemon/src/video/socket_pair.h
rename to daemon/src/media/video/socket_pair.h
diff --git a/daemon/src/video/test/.gitignore b/daemon/src/media/video/test/.gitignore
similarity index 100%
rename from daemon/src/video/test/.gitignore
rename to daemon/src/media/video/test/.gitignore
diff --git a/daemon/src/video/test/Makefile.am b/daemon/src/media/video/test/Makefile.am
similarity index 70%
rename from daemon/src/video/test/Makefile.am
rename to daemon/src/media/video/test/Makefile.am
index 89f73dd88c769b70060f4429f7ca5f3d787f318a..9f454aaf688177a204d25b582de2767fb1d4d300 100644
--- a/daemon/src/video/test/Makefile.am
+++ b/daemon/src/media/video/test/Makefile.am
@@ -1,19 +1,19 @@
-include ../../../globals.mak
+include $(top_srcdir)/globals.mak
 
 TESTS=test_video_endpoint test_shm test_video_input test_video_rtp
 check_PROGRAMS=test_video_endpoint test_video_rtp test_video_input test_shm
 
 test_video_endpoint_SOURCES=test_video_endpoint.cpp test_video_endpoint.h
-test_video_endpoint_LDADD=$(top_builddir)/src/libring.la $(top_builddir)/src/video/libvideo.la $(YAML_LIBS)
+test_video_endpoint_LDADD=$(top_builddir)/src/libring.la $(top_builddir)/src/media/video/libvideo.la $(YAML_LIBS)
 
 test_video_rtp_SOURCES=test_video_rtp.cpp
-test_video_rtp_LDADD=$(top_builddir)/src/libring.la $(top_builddir)/src/video/libvideo.la $(YAML_LIBS)
+test_video_rtp_LDADD=$(top_builddir)/src/libring.la $(top_builddir)/src/media/video/libvideo.la $(YAML_LIBS)
 
 test_video_input_SOURCES=test_video_input.cpp test_video_input.h
-test_video_input_LDADD=$(top_builddir)/src/libring.la $(top_builddir)/src/video/libvideo.la $(YAML_LIBS)
+test_video_input_LDADD=$(top_builddir)/src/libring.la $(top_builddir)/src/media/video/libvideo.la $(YAML_LIBS)
 
 test_shm_SOURCES=test_shm.cpp shm_src.cpp shm_src.h
-test_shm_LDADD=$(top_builddir)/src/libring.la $(top_builddir)/src/video/libvideo.la $(YAML_LIBS) -lrt
+test_shm_LDADD=$(top_builddir)/src/libring.la $(top_builddir)/src/media/video/libvideo.la $(YAML_LIBS) -lrt
 test_shm_CXXFLAGS=$(AM_CXXFLAGS)
 
-AM_CXXFLAGS=-I$(top_srcdir)/src/video -I$(top_srcdir)/src
+AM_CXXFLAGS=-I$(top_srcdir)/src/media/video -I$(top_srcdir)/src
diff --git a/daemon/src/video/test/README b/daemon/src/media/video/test/README
similarity index 100%
rename from daemon/src/video/test/README
rename to daemon/src/media/video/test/README
diff --git a/daemon/src/video/test/make_rtp_stream.sh b/daemon/src/media/video/test/make_rtp_stream.sh
similarity index 100%
rename from daemon/src/video/test/make_rtp_stream.sh
rename to daemon/src/media/video/test/make_rtp_stream.sh
diff --git a/daemon/src/video/test/shm_src.cpp b/daemon/src/media/video/test/shm_src.cpp
similarity index 100%
rename from daemon/src/video/test/shm_src.cpp
rename to daemon/src/media/video/test/shm_src.cpp
diff --git a/daemon/src/video/test/shm_src.h b/daemon/src/media/video/test/shm_src.h
similarity index 100%
rename from daemon/src/video/test/shm_src.h
rename to daemon/src/media/video/test/shm_src.h
diff --git a/daemon/src/video/test/shmclient.cpp b/daemon/src/media/video/test/shmclient.cpp
similarity index 100%
rename from daemon/src/video/test/shmclient.cpp
rename to daemon/src/media/video/test/shmclient.cpp
diff --git a/daemon/src/video/test/test_shm.cpp b/daemon/src/media/video/test/test_shm.cpp
similarity index 100%
rename from daemon/src/video/test/test_shm.cpp
rename to daemon/src/media/video/test/test_shm.cpp
diff --git a/daemon/src/video/test/test_video_endpoint.cpp b/daemon/src/media/video/test/test_video_endpoint.cpp
similarity index 100%
rename from daemon/src/video/test/test_video_endpoint.cpp
rename to daemon/src/media/video/test/test_video_endpoint.cpp
diff --git a/daemon/src/video/test/test_video_endpoint.h b/daemon/src/media/video/test/test_video_endpoint.h
similarity index 100%
rename from daemon/src/video/test/test_video_endpoint.h
rename to daemon/src/media/video/test/test_video_endpoint.h
diff --git a/daemon/src/video/test/test_video_input.cpp b/daemon/src/media/video/test/test_video_input.cpp
similarity index 100%
rename from daemon/src/video/test/test_video_input.cpp
rename to daemon/src/media/video/test/test_video_input.cpp
diff --git a/daemon/src/video/test/test_video_input.h b/daemon/src/media/video/test/test_video_input.h
similarity index 100%
rename from daemon/src/video/test/test_video_input.h
rename to daemon/src/media/video/test/test_video_input.h
diff --git a/daemon/src/video/test/test_video_rtp.cpp b/daemon/src/media/video/test/test_video_rtp.cpp
similarity index 100%
rename from daemon/src/video/test/test_video_rtp.cpp
rename to daemon/src/media/video/test/test_video_rtp.cpp
diff --git a/daemon/src/video/v4l2/Makefile.am b/daemon/src/media/video/v4l2/Makefile.am
similarity index 100%
rename from daemon/src/video/v4l2/Makefile.am
rename to daemon/src/media/video/v4l2/Makefile.am
diff --git a/daemon/src/video/v4l2/video_device_impl.cpp b/daemon/src/media/video/v4l2/video_device_impl.cpp
similarity index 100%
rename from daemon/src/video/v4l2/video_device_impl.cpp
rename to daemon/src/media/video/v4l2/video_device_impl.cpp
diff --git a/daemon/src/video/v4l2/video_device_monitor_impl.cpp b/daemon/src/media/video/v4l2/video_device_monitor_impl.cpp
similarity index 100%
rename from daemon/src/video/v4l2/video_device_monitor_impl.cpp
rename to daemon/src/media/video/v4l2/video_device_monitor_impl.cpp
diff --git a/daemon/src/video/video_base.cpp b/daemon/src/media/video/video_base.cpp
similarity index 100%
rename from daemon/src/video/video_base.cpp
rename to daemon/src/media/video/video_base.cpp
diff --git a/daemon/src/video/video_base.h b/daemon/src/media/video/video_base.h
similarity index 100%
rename from daemon/src/video/video_base.h
rename to daemon/src/media/video/video_base.h
diff --git a/daemon/src/video/video_decoder.cpp b/daemon/src/media/video/video_decoder.cpp
similarity index 100%
rename from daemon/src/video/video_decoder.cpp
rename to daemon/src/media/video/video_decoder.cpp
diff --git a/daemon/src/video/video_decoder.h b/daemon/src/media/video/video_decoder.h
similarity index 100%
rename from daemon/src/video/video_decoder.h
rename to daemon/src/media/video/video_decoder.h
diff --git a/daemon/src/video/video_device.h b/daemon/src/media/video/video_device.h
similarity index 100%
rename from daemon/src/video/video_device.h
rename to daemon/src/media/video/video_device.h
diff --git a/daemon/src/video/video_device_monitor.cpp b/daemon/src/media/video/video_device_monitor.cpp
similarity index 100%
rename from daemon/src/video/video_device_monitor.cpp
rename to daemon/src/media/video/video_device_monitor.cpp
diff --git a/daemon/src/video/video_device_monitor.h b/daemon/src/media/video/video_device_monitor.h
similarity index 100%
rename from daemon/src/video/video_device_monitor.h
rename to daemon/src/media/video/video_device_monitor.h
diff --git a/daemon/src/video/video_encoder.cpp b/daemon/src/media/video/video_encoder.cpp
similarity index 100%
rename from daemon/src/video/video_encoder.cpp
rename to daemon/src/media/video/video_encoder.cpp
diff --git a/daemon/src/video/video_encoder.h b/daemon/src/media/video/video_encoder.h
similarity index 100%
rename from daemon/src/video/video_encoder.h
rename to daemon/src/media/video/video_encoder.h
diff --git a/daemon/src/video/video_input.cpp b/daemon/src/media/video/video_input.cpp
similarity index 100%
rename from daemon/src/video/video_input.cpp
rename to daemon/src/media/video/video_input.cpp
diff --git a/daemon/src/video/video_input.h b/daemon/src/media/video/video_input.h
similarity index 100%
rename from daemon/src/video/video_input.h
rename to daemon/src/media/video/video_input.h
diff --git a/daemon/src/video/video_mixer.cpp b/daemon/src/media/video/video_mixer.cpp
similarity index 100%
rename from daemon/src/video/video_mixer.cpp
rename to daemon/src/media/video/video_mixer.cpp
diff --git a/daemon/src/video/video_mixer.h b/daemon/src/media/video/video_mixer.h
similarity index 100%
rename from daemon/src/video/video_mixer.h
rename to daemon/src/media/video/video_mixer.h
diff --git a/daemon/src/video/video_provider.h b/daemon/src/media/video/video_provider.h
similarity index 100%
rename from daemon/src/video/video_provider.h
rename to daemon/src/media/video/video_provider.h
diff --git a/daemon/src/video/video_receive_thread.cpp b/daemon/src/media/video/video_receive_thread.cpp
similarity index 100%
rename from daemon/src/video/video_receive_thread.cpp
rename to daemon/src/media/video/video_receive_thread.cpp
diff --git a/daemon/src/video/video_receive_thread.h b/daemon/src/media/video/video_receive_thread.h
similarity index 100%
rename from daemon/src/video/video_receive_thread.h
rename to daemon/src/media/video/video_receive_thread.h
diff --git a/daemon/src/video/video_rtp_session.cpp b/daemon/src/media/video/video_rtp_session.cpp
similarity index 100%
rename from daemon/src/video/video_rtp_session.cpp
rename to daemon/src/media/video/video_rtp_session.cpp
diff --git a/daemon/src/video/video_rtp_session.h b/daemon/src/media/video/video_rtp_session.h
similarity index 100%
rename from daemon/src/video/video_rtp_session.h
rename to daemon/src/media/video/video_rtp_session.h
diff --git a/daemon/src/video/video_scaler.cpp b/daemon/src/media/video/video_scaler.cpp
similarity index 100%
rename from daemon/src/video/video_scaler.cpp
rename to daemon/src/media/video/video_scaler.cpp
diff --git a/daemon/src/video/video_scaler.h b/daemon/src/media/video/video_scaler.h
similarity index 100%
rename from daemon/src/video/video_scaler.h
rename to daemon/src/media/video/video_scaler.h
diff --git a/daemon/src/video/video_sender.cpp b/daemon/src/media/video/video_sender.cpp
similarity index 100%
rename from daemon/src/video/video_sender.cpp
rename to daemon/src/media/video/video_sender.cpp
diff --git a/daemon/src/video/video_sender.h b/daemon/src/media/video/video_sender.h
similarity index 100%
rename from daemon/src/video/video_sender.h
rename to daemon/src/media/video/video_sender.h
diff --git a/daemon/src/ringdht/ringaccount.cpp b/daemon/src/ringdht/ringaccount.cpp
index 61eecb259ed501d056911e38aac7148088ee47b2..c7c884110801285c84e719dedfbe5ef3112b0cb3 100644
--- a/daemon/src/ringdht/ringaccount.cpp
+++ b/daemon/src/ringdht/ringaccount.cpp
@@ -54,7 +54,7 @@
 #include "manager.h"
 
 #ifdef RING_VIDEO
-#include "video/libav_utils.h"
+#include "libav_utils.h"
 #endif
 #include "fileutils.h"
 
@@ -589,7 +589,7 @@ void RingAccount::doRegister()
 
         username_ = dht_.getId().toString();
 
-        Manager::instance().registerEventHandler((uintptr_t)this, std::bind(&dht::DhtRunner::loop, &dht_));
+        Manager::instance().registerEventHandler((uintptr_t)this, [this](){ dht_.loop(); });
         setRegistrationState(RegistrationState::TRYING);
 
         dht_.bootstrap(loadNodes());
diff --git a/daemon/src/ringdht/sip_transport_ice.h b/daemon/src/ringdht/sip_transport_ice.h
index 07ff5d3f7828161636995d4763e7e63445e7fd0d..3665b15f4b77e96344284e1b53762344a6807c0a 100644
--- a/daemon/src/ringdht/sip_transport_ice.h
+++ b/daemon/src/ringdht/sip_transport_ice.h
@@ -35,6 +35,8 @@
 
 #include <pjsip.h>
 #include <pj/pool.h>
+
+#include <functional>
 #include <memory>
 
 namespace ring {
diff --git a/daemon/src/sip/sdp.cpp b/daemon/src/sip/sdp.cpp
index 4bdaffe53c58b1c1b1581c6ae21e30455817b5e3..1dbd30537b89c3ef6f141d2a53721095335fb5a4 100644
--- a/daemon/src/sip/sdp.cpp
+++ b/daemon/src/sip/sdp.cpp
@@ -40,10 +40,7 @@
 #include "sipvoiplink.h"
 #include "manager.h"
 #include "logger.h"
-
-#ifdef RING_VIDEO
-#include "video/libav_utils.h"
-#endif
+#include "libav_utils.h"
 
 #include <algorithm>
 #include <cassert>
@@ -1138,7 +1135,6 @@ bool Sdp::getOutgoingVideoSettings(map<string, string> &args) const
     return false;
 }
 
-#ifndef USE_CCRTP
 bool Sdp::getOutgoingAudioSettings(map<string, string> &args) const
 {
     string codec(getOutgoingAudioCodec());
@@ -1180,4 +1176,3 @@ bool Sdp::getOutgoingAudioSettings(map<string, string> &args) const
     }
     return false;
 }
-#endif
diff --git a/daemon/src/sip/sipaccount.cpp b/daemon/src/sip/sipaccount.cpp
index 72f55af2a9d01e1a97b99cd574eb4d40a1f9edb1..b1b8ff4c092a6ce23b133d0d19bdb68de44d86f1 100644
--- a/daemon/src/sip/sipaccount.cpp
+++ b/daemon/src/sip/sipaccount.cpp
@@ -58,7 +58,7 @@
 #include "manager.h"
 
 #ifdef RING_VIDEO
-#include "video/libav_utils.h"
+#include "libav_utils.h"
 #endif
 
 #include <unistd.h>
diff --git a/daemon/src/sip/sipaccountbase.cpp b/daemon/src/sip/sipaccountbase.cpp
index 042926fc18e12a5bb003c89bc594424b996610a0..91a991c4de7ee551d5a3de05d14e3810c4693479 100644
--- a/daemon/src/sip/sipaccountbase.cpp
+++ b/daemon/src/sip/sipaccountbase.cpp
@@ -33,7 +33,7 @@
 #include "sipvoiplink.h"
 
 #ifdef RING_VIDEO
-#include "video/libav_utils.h"
+#include "libav_utils.h"
 #endif
 
 #include "account_schema.h"
diff --git a/daemon/src/sip/sipcall.cpp b/daemon/src/sip/sipcall.cpp
index 21c31bbf3a98bc6c03b94eebdf1e5151fb807940..33dc2c3ab78570f9778928f0f601ec0e68bcc37e 100644
--- a/daemon/src/sip/sipcall.cpp
+++ b/daemon/src/sip/sipcall.cpp
@@ -45,12 +45,8 @@
 
 using namespace ring;
 
-#if USE_CCRTP
-#include "audio/audiortp/audio_rtp_factory.h" // for AudioRtpFactoryException
-#else
 
 #include "audio/audiortp/avformat_rtp_session.h"
-#endif
 #include "client/callmanager.h"
 
 #if HAVE_INSTANT_MESSAGING
@@ -124,11 +120,8 @@ dtmfSend(SIPCall &call, char code, const std::string &dtmf)
 
 SIPCall::SIPCall(SIPAccountBase& account, const std::string& id, Call::CallType type)
     : Call(account, id, type)
-#if USE_CCRTP
-    , audiortp_(this)
-#else
-    , avformatrtp_(new ring::AVFormatRtpSession(id, /* FIXME: These are video! */ getSettings()))
-#endif
+    //, avformatrtp_(new ring::AVFormatRtpSession(id, /* FIXME: These are video! */ getSettings()))
+    , avformatrtp_(new ring::AVFormatRtpSession(id, *new std::map<std::string, std::string>))
 #ifdef RING_VIDEO
     // The ID is used to associate video streams to calls
     , videortp_(id, getSettings())
@@ -377,11 +370,7 @@ SIPCall::refuse()
     if (!isIncoming() or getConnectionState() == Call::CONNECTED or !inv)
         return;
 
-#if USE_CCRTP
-    getAudioRtp().stop();
-#else
     avformatrtp_->stop();
-#endif
 
     pjsip_tx_data *tdata;
 
@@ -575,12 +564,7 @@ SIPCall::onhold()
     if (not setState(Call::HOLD))
         return;
 
-#if USE_CCRTP
-    audiortp_.saveLocalContext();
-    audiortp_.stop();
-#else
     avformatrtp_->stop();
-#endif
 #ifdef RING_VIDEO
     videortp_.stop();
 #endif
@@ -821,15 +805,6 @@ void
 SIPCall::startAllMedia()
 {
     auto& remoteIP = sdp_->getRemoteIP();
-#if USE_CCRTP
-    try {
-        audiortp_.updateDestinationIpAddress();
-    } catch (const AudioRtpFactoryException &e) {
-        RING_ERR("%s", e.what());
-    }
-
-    audiortp_.setDtmfPayloadType(sdp_->getTelephoneEventType());
-#else
     avformatrtp_->updateSDP(*sdp_);
     avformatrtp_->updateDestination(remoteIP, sdp_->getRemoteAudioPort());
     if (isIceRunning()) {
@@ -840,7 +815,6 @@ SIPCall::startAllMedia()
         const auto localAudioPort = sdp_->getLocalAudioPort();
         avformatrtp_->start(localAudioPort ? localAudioPort : sdp_->getRemoteAudioPort());
     }
-#endif
 
 #ifdef RING_VIDEO
     auto remoteVideoPort = sdp_->getRemoteVideoPort();
@@ -956,11 +930,7 @@ void
 SIPCall::stopAllMedias()
 {
     RING_DBG("SIPCall %s: stopping all medias", getCallId().c_str());
-#if USE_CCRTP
-    audiortp_.stop();
-#else
     avformatrtp_->stop();
-#endif
 #ifdef RING_VIDEO
     videortp_.stop();
 #endif
diff --git a/daemon/src/sip/sipvoiplink.cpp b/daemon/src/sip/sipvoiplink.cpp
index c901ddd0ceae9b34061443deacfa75e24ff4562f..349b49145b9cb689fc06127d08d19d3eead5fe67 100644
--- a/daemon/src/sip/sipvoiplink.cpp
+++ b/daemon/src/sip/sipvoiplink.cpp
@@ -55,9 +55,7 @@
 #include "im/instant_messaging.h"
 #endif
 
-#ifndef USE_CCRTP
 #include "audio/audiortp/avformat_rtp_session.h"
-#endif
 
 #ifdef RING_VIDEO
 #include "video/video_rtp_session.h"