diff -dur asterisk-13.7.2.orig/main/codec_builtin.c asterisk-13.7.2/main/codec_builtin.c --- asterisk-13.7.2.orig/main/codec_builtin.c 2016-02-05 21:32:40.000000000 +0100 +++ asterisk-13.7.2/main/codec_builtin.c 2016-03-09 11:55:44.000000000 +0100 @@ -38,6 +38,8 @@ #include "asterisk/format_cache.h" #include "asterisk/frame.h" +#include + enum frame_type { TYPE_HIGH, /* 0x0 */ TYPE_LOW, /* 0x1 */ @@ -698,6 +700,11 @@ .get_length = g719_length, }; +static int opus_samples(struct ast_frame *frame) +{ + return opus_packet_get_nb_samples(frame->data.ptr, frame->datalen, 48000); +} + static struct ast_codec opus = { .name = "opus", .description = "Opus Codec", @@ -707,6 +714,7 @@ .maximum_ms = 60, .default_ms = 20, .minimum_bytes = 10, + .samples_count = opus_samples, }; static struct ast_codec jpeg = { diff -dur asterisk-13.7.2.orig/main/Makefile asterisk-13.7.2/main/Makefile --- asterisk-13.7.2.orig/main/Makefile 2016-03-09 11:53:45.000000000 +0100 +++ asterisk-13.7.2/main/Makefile 2016-03-09 11:55:44.000000000 +0100 @@ -40,6 +40,7 @@ AST_LIBS+=$(URIPARSER_LIB) AST_LIBS+=$(UUID_LIB) AST_LIBS+=$(CRYPT_LIB) +AST_LIBS+=$(OPUS_LIB) AST_LIBS+=$(AST_CLANG_BLOCKS_LIBS) ifneq ($(findstring $(OSARCH), linux-gnu linux-gnux32 uclinux linux-uclibc kfreebsd-gnu),) @@ -160,6 +161,7 @@ bucket.o: _ASTCFLAGS+=$(URIPARSER_INCLUDE) crypt.o: _ASTCFLAGS+=$(CRYPT_INCLUDE) uuid.o: _ASTCFLAGS+=$(UUID_INCLUDE) +codec_builtin.o: _ASTCFLAGS+=$(OPUS_INCLUDE) ifneq ($(findstring ENABLE_UPLOADS,$(MENUSELECT_CFLAGS)),) http.o: _ASTCFLAGS+=$(GMIME_INCLUDE)