Hello,

I patched manually the version 1.4.25.1 recently, and it's working great.
Older version of Asterisk 1.4 are not always well supported by last versions of asterisk-video. For exemple, I had 1.4.15.1 patched all right but some news functions needed by app_h324m were missing causing some compilation warnings. app_h324m compiled ok and loaded fine too but h324m_gw() didn't worked at all and made asterisk crash.. while h324m_loopback worked fine...

So I upgraded asterisk to the last version (1.4.25.1) and patched it manually.

Look at my attached patch for this version.

Regards

Piotr Stankiewicz a écrit :

W dniu 10 lipca 2009 10:23 użytkownik Konrad Różycki <[email protected]> napisał:

    Hello,

       Is there any AMR codec for Asterisk 1.4.24.1. I trying to use AMR
    from SVN (http://sip.fontventa.com/svn/asterisk/amr) but without
    sucess:

    patching file build_tools/embed_modules.xml
    patching file include/asterisk/frame.h
    Hunk #1 FAILED at 242.
    1 out of 1 hunk FAILED -- saving rejects to file
    include/asterisk/frame.h.rej
    patching file main/channel.c
    Hunk #1 succeeded at 677 (offset -18 lines).
    patching file main/translate.c
    Hunk #1 succeeded at 523 (offset 31 lines).
    patching file main/rtp.c
    Hunk #1 succeeded at 1362 (offset 21 lines).
    patching file main/frame.c
    Hunk #1 succeeded at 119 (offset 2 lines).
    Hunk #2 succeeded at 663 (offset 32 lines).
    Hunk #3 succeeded at 677 (offset 2 lines).
    Hunk #4 succeeded at 1513 (offset 51 lines).
    Hunk #5 succeeded at 1531 (offset 2 lines).
    patching file codecs/Makefile
    Hunk #1 succeeded at 31 (offset 6 lines).
    Hunk #3 succeeded at 61 with fuzz 1 (offset 6 lines).

    I looking also for proper user information layer 1 handling patch for
    Asterisk 1.4.24.1, maybe someone prepared it for that version of * ?
    (need to pass throgh video call from 3G network to video platform).


Hi Konrad,
Try earlier version of asterisk. Mine is 1.4.19.2 and everything works perfectly.
Regards,
Void.

    Best Rgerards
    --
    Konrad Rozycki

    _______________________________________________
    --Bandwidth and Colocation Provided by http://www.api-digital.com--

    asterisk-video mailing list
    To UNSUBSCRIBE or update options visit:
      http://lists.digium.com/mailman/listinfo/asterisk-video


------------------------------------------------------------------------

_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--

asterisk-video mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-video


--

Julien LEBOEUF
Technicien Réseau





NEOCOM Multimedia
70, Boulevard Louis Blanc
85000 La Roche sur Yon
Tél. + 33 (0)2 53 59 30 00 extension 50
Fax. + 33 (0)2 51 62 00 51
Skype : julien.leboeuf
[email protected]
www.neocom.fr

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 ****
                <member name="channels" displayname="Channels" 
remove_on_change="channels/*.o channels/misdn/*.o">
                        <depend>gnu_ld</depend>
                </member>
!               <member name="codecs" displayname="Coders/Decoders" 
remove_on_change="codecs/*.o codecs/gsm/src/*.o codecs/ilbc/*.o 
codecs/lpc10/*.o codecs/gsm/lib/libgsm.a codecs/lpc10/liblpc10.a 
codecs/ilbc/libilbc.a">
                        <depend>gnu_ld</depend>
                </member>
                <member name="formats" displayname="File Formats" 
remove_on_change="formats/*.o">
--- 8,14 ----
                <member name="channels" displayname="Channels" 
remove_on_change="channels/*.o channels/misdn/*.o">
                        <depend>gnu_ld</depend>
                </member>
!               <member name="codecs" displayname="Coders/Decoders" 
remove_on_change="codecs/*.o codecs/gsm/src/*.o codecs/ilbc/*.o 
codecs/lpc10/*.o codecs/gsm/lib/libgsm.a codecs/lpc10/liblpc10.a 
codecs/ilbc/libilbc.a codecs/amr/libamr.a">
                        <depend>gnu_ld</depend>
                </member>
                <member name="formats" displayname="File Formats" 
remove_on_change="formats/*.o">
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<<i);
                        ast_cli(fd, "%11u (1 << %2d) %10s  audio   %8s   
(%s)\n",1 << i,i,hex,ast_getformatname(1<<i),ast_codec2str(1<<i));
                }
--- 665,671 ----
        ast_cli(fd, 
"--------------------------------------------------------------------------------\n");
        if ((argc == 2) || (!strcasecmp(argv[1],"audio"))) {
                found = 1;
!               for (i=0;i<14;i++) {
                        snprintf(hex,25,"(0x%x)",1<<i);
                        ast_cli(fd, "%11u (1 << %2d) %10s  audio   %8s   
(%s)\n",1 << i,i,hex,ast_getformatname(1<<i),ast_codec2str(1<<i));
                }
***************
*** 709,715 ****
        ast_cli(fd, 
"--------------------------------------------------------------------------------\n");
        if ((argc == 3) || (!strcasecmp(argv[3],"audio"))) {
                found = 1;
!               for (i=0;i<13;i++) {
                        snprintf(hex,25,"(0x%x)",1<<i);
                        ast_cli(fd, "%11u (1 << %2d) %10s  audio   %8s   
(%s)\n",1 << i,i,hex,ast_getformatname(1<<i),ast_codec2str(1<<i));
                }
--- 709,715 ----
        ast_cli(fd, 
"--------------------------------------------------------------------------------\n");
        if ((argc == 3) || (!strcasecmp(argv[3],"audio"))) {
                found = 1;
!               for (i=0;i<14;i++) {
                        snprintf(hex,25,"(0x%x)",1<<i);
                        ast_cli(fd, "%11u (1 << %2d) %10s  audio   %8s   
(%s)\n",1 << i,i,hex,ast_getformatname(1<<i),ast_codec2str(1<<i));
                }
***************
*** 1515,1520 ****
--- 1515,1550 ----
        return cnt;
  }
  
+ static int amr_samples(unsigned char *data, int datalen)
+ {
+       short block_size[16]={ 12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 
0, 0, 0 };
+       int samples = 0;
+ 
+       /* we asume RTP octed aligned format (RFC 4867 section 4.4)
+          skip first octed (CMR) */
+       datalen--;
+       data++;
+ 
+       while (datalen > 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 ****
                <member name="channels" displayname="Channels" 
remove_on_change="channels/*.o channels/misdn/*.o">
                        <depend>gnu_ld</depend>
                </member>
!               <member name="codecs" displayname="Coders/Decoders" 
remove_on_change="codecs/*.o codecs/gsm/src/*.o codecs/ilbc/*.o 
codecs/lpc10/*.o codecs/gsm/lib/libgsm.a codecs/lpc10/liblpc10.a 
codecs/ilbc/libilbc.a">
                        <depend>gnu_ld</depend>
                </member>
                <member name="formats" displayname="File Formats" 
remove_on_change="formats/*.o">
--- 492,498 ----
                <member name="channels" displayname="Channels" 
remove_on_change="channels/*.o channels/misdn/*.o">
                        <depend>gnu_ld</depend>
                </member>
!               <member name="codecs" displayname="Coders/Decoders" 
remove_on_change="codecs/*.o codecs/gsm/src/*.o codecs/ilbc/*.o 
codecs/lpc10/*.o codecs/gsm/lib/libgsm.a codecs/lpc10/liblpc10.a 
codecs/ilbc/libilbc.a codecs/amr/libamr.a">
                        <depend>gnu_ld</depend>
                </member>
_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--

asterisk-video mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-video

Reply via email to