diff --git a/build_tools/menuselect-deps.in b/build_tools/menuselect-deps.in
index af980e2d014489e739c439a576a8aea6b0aa4e78..a77530b783d6f8b5be870149fe4dbca29d096a20 100644
--- a/build_tools/menuselect-deps.in
+++ b/build_tools/menuselect-deps.in
@@ -41,6 +41,7 @@ NEON=@PBX_NEON@
 NEON29=@PBX_NEON29@
 OGG=@PBX_OGG@
 OPENH323=@PBX_OPENH323@
+OPUS=@PBX_OPUS@
 OSPTK=@PBX_OSPTK@
 OSS=@PBX_OSS@
 PGSQL=@PBX_PGSQL@
diff --git a/configure b/configure
index 7bb76251259b5b3482ee9cd7fe5aa466cbb671d3..eb407444201846d6d164cda49f2202cd748b8ca6 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 421230 .
+# From configure.ac Revision: 425966 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.69 for asterisk trunk.
 #
@@ -930,6 +930,10 @@ PBX_OSPTK
 OSPTK_DIR
 OSPTK_INCLUDE
 OSPTK_LIB
+PBX_OPUS
+OPUS_DIR
+OPUS_INCLUDE
+OPUS_LIB
 PBX_OPENR2
 OPENR2_DIR
 OPENR2_INCLUDE
@@ -1315,6 +1319,7 @@ with_netsnmp
 with_newt
 with_ogg
 with_openr2
+with_opus
 with_osptk
 with_oss
 with_postgres
@@ -2052,6 +2057,7 @@ Optional Packages:
   --with-newt=PATH        use newt files in PATH
   --with-ogg=PATH         use OGG files in PATH
   --with-openr2=PATH      use MFR2 files in PATH
+  --with-opus=PATH        use Opus files in PATH
   --with-osptk=PATH       use OSP Toolkit files in PATH
   --with-oss=PATH         use Open Sound System files in PATH
   --with-postgres=PATH    use PostgreSQL files in PATH
@@ -10048,6 +10054,38 @@ fi
 
 
 
+    OPUS_DESCRIP="Opus"
+    OPUS_OPTION="opus"
+    PBX_OPUS=0
+
+# Check whether --with-opus was given.
+if test "${with_opus+set}" = set; then :
+  withval=$with_opus;
+	case ${withval} in
+	n|no)
+	USE_OPUS=no
+	# -1 is a magic value used by menuselect to know that the package
+	# was disabled, other than 'not found'
+	PBX_OPUS=-1
+	;;
+	y|ye|yes)
+	ac_mandatory_list="${ac_mandatory_list} OPUS"
+	;;
+	*)
+	OPUS_DIR="${withval}"
+	ac_mandatory_list="${ac_mandatory_list} OPUS"
+	;;
+	esac
+
+fi
+
+
+
+
+
+
+
+
     OSPTK_DESCRIP="OSP Toolkit"
     OSPTK_OPTION="osptk"
     PBX_OSPTK=0
@@ -13248,7 +13286,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -13294,7 +13332,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -13318,7 +13356,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -13363,7 +13401,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -13387,7 +13425,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -26939,6 +26977,111 @@ fi
 
 
 
+
+if test "x${PBX_OPUS}" != "x1" -a "${USE_OPUS}" != "no"; then
+   pbxlibdir=""
+   # if --with-OPUS=DIR has been specified, use it.
+   if test "x${OPUS_DIR}" != "x"; then
+      if test -d ${OPUS_DIR}/lib; then
+         pbxlibdir="-L${OPUS_DIR}/lib"
+      else
+         pbxlibdir="-L${OPUS_DIR}"
+      fi
+   fi
+   pbxfuncname="opus_encoder_create"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_OPUS_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_opus_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lopus" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lopus... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lopus ${pbxlibdir}  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char ${pbxfuncname} ();
+int
+main ()
+{
+return ${pbxfuncname} ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  AST_OPUS_FOUND=yes
+else
+  AST_OPUS_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_OPUS_FOUND}" = "yes"; then
+      OPUS_LIB="${pbxlibdir} -lopus "
+      # if --with-OPUS=DIR has been specified, use it.
+      if test "x${OPUS_DIR}" != "x"; then
+         OPUS_INCLUDE="-I${OPUS_DIR}/include"
+      fi
+      OPUS_INCLUDE="${OPUS_INCLUDE} "
+      if test "xopus/opus.h" = "x" ; then	# no header, assume found
+         OPUS_HEADER_FOUND="1"
+      else				# check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${OPUS_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "opus/opus.h" "ac_cv_header_opus_opus_h" "$ac_includes_default"
+if test "x$ac_cv_header_opus_opus_h" = xyes; then :
+  OPUS_HEADER_FOUND=1
+else
+  OPUS_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${OPUS_HEADER_FOUND}" = "x0" ; then
+         OPUS_LIB=""
+         OPUS_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library
+            OPUS_LIB=""
+         fi
+         PBX_OPUS=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_OPUS 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+
 if test "${USE_PWLIB}" != "no"; then
 	if test -n "${PWLIB_DIR}"; then
 		PWLIBDIR="${PWLIB_DIR}"
diff --git a/configure.ac b/configure.ac
index 8b18790fc0bfaebb5803e2bb3b1c845da75b0a14..0b45e454bd09de050627682f4ab1ff70f78af4b6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -448,6 +448,7 @@ AST_EXT_LIB_SETUP([NETSNMP], [Net-SNMP], [netsnmp])
 AST_EXT_LIB_SETUP([NEWT], [newt], [newt])
 AST_EXT_LIB_SETUP([OGG], [OGG], [ogg])
 AST_EXT_LIB_SETUP([OPENR2], [MFR2], [openr2])
+AST_EXT_LIB_SETUP([OPUS], [Opus], [opus])
 AST_EXT_LIB_SETUP([OSPTK], [OSP Toolkit], [osptk])
 AST_EXT_LIB_SETUP([OSS], [Open Sound System], [oss])
 AST_EXT_LIB_SETUP([PGSQL], [PostgreSQL], [postgres])
@@ -2127,6 +2128,8 @@ AST_EXT_LIB_CHECK([SS7], [ss7], [ss7_set_isup_timer], [libss7.h])
 
 AST_EXT_LIB_CHECK([OPENR2], [openr2], [openr2_chan_new], [openr2.h])
 
+AST_EXT_LIB_CHECK([OPUS], [opus], [opus_encoder_create], [opus/opus.h])
+
 if test "${USE_PWLIB}" != "no"; then
 	if test -n "${PWLIB_DIR}"; then
 		PWLIBDIR="${PWLIB_DIR}"
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index 181f3eb15828e95fcd15871033ea57eeec6e04b8..275261371607e4637a3fefdf3ff120ee070e640e 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -551,6 +551,9 @@
 /* Define to 1 if CRYPTO has the OpenSSL SRTP Extension Support feature. */
 #undef HAVE_OPENSSL_SRTP
 
+/* Define to 1 if you have the Opus library. */
+#undef HAVE_OPUS
+
 /* Define this to indicate the ${OSPTK_DESCRIP} library */
 #undef HAVE_OSPTK
 
diff --git a/makeopts.in b/makeopts.in
index 39e105d6daf8ac61dc4886e4dfa706ad8a92e4e9..a0faaee463777721dcb19c84ef0bd42a13d3b395 100644
--- a/makeopts.in
+++ b/makeopts.in
@@ -211,6 +211,9 @@ NEWT_LIB=@NEWT_LIB@
 OGG_INCLUDE=@OGG_INCLUDE@
 OGG_LIB=@OGG_LIB@
 
+OPUS_INCLUDE=@OPUS_INCLUDE@
+OPUS_LIB=@OPUS_LIB@
+
 OSPTK_INCLUDE=@OSPTK_INCLUDE@
 OSPTK_LIB=@OSPTK_LIB@