diff -cr asterisk-1.4.25.1-orig/build_tools/embed_modules.xml asterisk-1.4.25.1/build_tools/embed_modules.xml *** asterisk-1.4.25.1-orig/build_tools/embed_modules.xml 2009-07-08 16:04:51.000000000 +0200 --- asterisk-1.4.25.1/build_tools/embed_modules.xml 2009-07-08 16:12:49.000000000 +0200 *************** *** 8,14 **** gnu_ld ! gnu_ld --- 8,14 ---- gnu_ld ! gnu_ld diff -cr asterisk-1.4.25.1-orig/codecs/Makefile asterisk-1.4.25.1/codecs/Makefile *** asterisk-1.4.25.1-orig/codecs/Makefile 2009-07-08 16:04:51.000000000 +0200 --- asterisk-1.4.25.1/codecs/Makefile 2009-07-08 17:11:57.000000000 +0200 *************** *** 31,36 **** --- 31,37 ---- LIBILBC:=ilbc/libilbc.a LIBLPC10:=lpc10/liblpc10.a + LIBAMR:=amr/libamr.a all: _all *************** *** 45,50 **** --- 46,52 ---- $(MAKE) -C gsm clean $(MAKE) -C lpc10 clean $(MAKE) -C ilbc clean + $(MAKE) -C amr clean gsm/lib/libgsm.a: @mkdir -p gsm/lib *************** *** 59,61 **** --- 61,69 ---- @$(MAKE) -C ilbc all ASTCFLAGS="$(filter-out -Wmissing-prototypes -Wmissing-declarations,$(ASTCFLAGS)) $(AST_NO_STRICT_OVERFLOW)" $(if $(filter codec_ilbc,$(EMBEDDED_MODS)),modules.link,codec_ilbc.so): $(LIBILBC) + + $(LIBAMR): + @$(MAKE) -C amr all + + $(if $(filter codec_amr,$(EMBEDDED_MODS)),modules.link,codec_amr.so): $(LIBAMR) + diff -cr asterisk-1.4.25.1-orig/include/asterisk/frame.h asterisk-1.4.25.1/include/asterisk/frame.h *** asterisk-1.4.25.1-orig/include/asterisk/frame.h 2009-07-08 16:04:51.000000000 +0200 --- asterisk-1.4.25.1/include/asterisk/frame.h 2009-07-08 16:14:42.000000000 +0200 *************** *** 260,267 **** #define AST_FORMAT_G726 (1 << 11) /*! G.722 */ #define AST_FORMAT_G722 (1 << 12) /*! Unsupported audio bits */ ! #define AST_FORMAT_AUDIO_UNDEFINED ((1 << 13) | (1 << 14) | (1 << 15)) /*! Maximum audio format */ #define AST_FORMAT_MAX_AUDIO (1 << 15) /*! Maximum audio mask */ --- 260,269 ---- #define AST_FORMAT_G726 (1 << 11) /*! G.722 */ #define AST_FORMAT_G722 (1 << 12) + /*! AMR-NB */ + #define AST_FORMAT_AMRNB (1 << 13) /*! Unsupported audio bits */ ! #define AST_FORMAT_AUDIO_UNDEFINED ((1 << 14) | (1 << 15)) /*! Maximum audio format */ #define AST_FORMAT_MAX_AUDIO (1 << 15) /*! Maximum audio mask */ diff -cr asterisk-1.4.25.1-orig/main/channel.c asterisk-1.4.25.1/main/channel.c *** asterisk-1.4.25.1-orig/main/channel.c 2009-07-08 16:04:51.000000000 +0200 --- asterisk-1.4.25.1/main/channel.c 2009-07-08 16:24:24.000000000 +0200 *************** *** 677,682 **** --- 677,684 ---- /*! Okay, we're down to vocoders now, so pick GSM because it's small and easier to translate and sounds pretty good */ AST_FORMAT_GSM, + /*! Try AMR */ + AST_FORMAT_AMRNB, /*! iLBC is not too bad */ AST_FORMAT_ILBC, /*! Speex is free, but computationally more expensive than GSM */ diff -cr asterisk-1.4.25.1-orig/main/frame.c asterisk-1.4.25.1/main/frame.c *** asterisk-1.4.25.1-orig/main/frame.c 2009-07-08 16:04:51.000000000 +0200 --- asterisk-1.4.25.1/main/frame.c 2009-07-08 16:59:18.000000000 +0200 *************** *** 119,125 **** { 1, AST_FORMAT_ILBC, "ilbc", "iLBC", 50, 30, 30, 30, 30 }, /*!< 11: codec_ilbc.c */ /* inc=30ms - workaround */ { 1, AST_FORMAT_G726_AAL2, "g726aal2", "G.726 AAL2", 40, 10, 300, 10, 20 }, /*!< 12: codec_g726.c */ { 1, AST_FORMAT_G722, "g722", "G722"}, /*!< 13 */ ! { 0, 0, "nothing", "undefined" }, { 0, 0, "nothing", "undefined" }, { 0, 0, "nothing", "undefined" }, { 0, 0, "nothing", "undefined" }, --- 119,125 ---- { 1, AST_FORMAT_ILBC, "ilbc", "iLBC", 50, 30, 30, 30, 30 }, /*!< 11: codec_ilbc.c */ /* inc=30ms - workaround */ { 1, AST_FORMAT_G726_AAL2, "g726aal2", "G.726 AAL2", 40, 10, 300, 10, 20 }, /*!< 12: codec_g726.c */ { 1, AST_FORMAT_G722, "g722", "G722"}, /*!< 13 */ ! { 1, AST_FORMAT_AMRNB, "amr", "AMR NB", 32, 20, 300, 0, 20}, /*!< codec_amr.c */ { 0, 0, "nothing", "undefined" }, { 0, 0, "nothing", "undefined" }, { 0, 0, "nothing", "undefined" }, *************** *** 665,671 **** ast_cli(fd, "--------------------------------------------------------------------------------\n"); if ((argc == 2) || (!strcasecmp(argv[1],"audio"))) { found = 1; ! for (i=0;i<13;i++) { snprintf(hex,25,"(0x%x)",1< 0) { + unsigned dec_mode = (data[0]>>3) & 0x000f; + unsigned psize = block_size[dec_mode]; + + if (psize) + samples += 160; + + if ( !(data[0]>>7) ) { + /* this was the last ToC entry */ + break; + } + + data++; /* Skip over the block. */ + datalen --; + /* ast_verbose("Got AMR frame size %d inside ast_frame\n", psize); */ + } + /* todo: how can we signal an error while decoding the frame structure? */ + return samples; + } + int ast_codec_get_samples(struct ast_frame *f) { int samples=0; *************** *** 1552,1557 **** --- 1582,1590 ---- case AST_FORMAT_G726_AAL2: samples = f->datalen * 2; break; + case AST_FORMAT_AMRNB: + samples = amr_samples(f->data, f->datalen); + break; default: ast_log(LOG_WARNING, "Unable to calculate samples for format %s\n", ast_getformatname(f->subclass)); } diff -cr asterisk-1.4.25.1-orig/main/rtp.c asterisk-1.4.25.1/main/rtp.c *** asterisk-1.4.25.1-orig/main/rtp.c 2009-07-08 16:04:51.000000000 +0200 --- asterisk-1.4.25.1/main/rtp.c 2009-07-08 16:53:53.000000000 +0200 *************** *** 1397,1402 **** --- 1397,1403 ---- {{1, AST_FORMAT_ILBC}, "audio", "iLBC"}, {{1, AST_FORMAT_G722}, "audio", "G722"}, {{1, AST_FORMAT_G726_AAL2}, "audio", "AAL2-G726-32"}, + {{1, AST_FORMAT_AMRNB}, "audio", "AMR"}, {{0, AST_RTP_DTMF}, "audio", "telephone-event"}, {{0, AST_RTP_CISCO_DTMF}, "audio", "cisco-telephone-event"}, {{0, AST_RTP_CN}, "audio", "CN"}, *************** *** 1434,1439 **** --- 1435,1441 ---- [31] = {1, AST_FORMAT_H261}, [34] = {1, AST_FORMAT_H263}, [103] = {1, AST_FORMAT_H263_PLUS}, + [96] = {1, AST_FORMAT_AMRNB}, [97] = {1, AST_FORMAT_ILBC}, [99] = {1, AST_FORMAT_H264}, [101] = {0, AST_RTP_DTMF}, diff -cr asterisk-1.4.25.1-orig/main/translate.c asterisk-1.4.25.1/main/translate.c *** asterisk-1.4.25.1-orig/main/translate.c 2009-07-08 16:04:51.000000000 +0200 --- asterisk-1.4.25.1/main/translate.c 2009-07-08 16:52:32.000000000 +0200 *************** *** 523,529 **** /*! \brief CLI "show translation" command handler */ static int show_translation_deprecated(int fd, int argc, char *argv[]) { ! #define SHOW_TRANS 13 int x, y, z; int curlen = 0, longest = 0; --- 523,529 ---- /*! \brief CLI "show translation" command handler */ static int show_translation_deprecated(int fd, int argc, char *argv[]) { ! #define SHOW_TRANS 14 int x, y, z; int curlen = 0, longest = 0; diff -cr asterisk-1.4.25.1-orig/menuselect-tree asterisk-1.4.25.1/menuselect-tree *** asterisk-1.4.25.1-orig/menuselect-tree 2009-07-08 16:04:51.000000000 +0200 --- asterisk-1.4.25.1/menuselect-tree 2009-07-08 17:09:32.000000000 +0200 *************** *** 492,498 **** gnu_ld ! gnu_ld --- 492,498 ---- gnu_ld ! gnu_ld