Details

    • Type: New Feature New Feature
    • Status: Closed
    • Severity: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Target Release Version/s: None
    • Component/s: Core/General
    • Labels:
      None
    • Mantis ID:
      2971
    • Regression:
      No

      Description

      This is a 1st draft at making IAX2 support codec
      prefs using the new codec API recently added to CVS

      Basicaly it uses the data structure AST_FORMAT_LIST
      now found in frame.c

      static struct ast_format_list AST_FORMAT_LIST[] = {

      { 1, AST_FORMAT_G723_1 , "g723" , "G.723.1"}

      ,

      { 1, AST_FORMAT_GSM, "gsm" , "GSM"}

      ,

      { 1, AST_FORMAT_ULAW, "ulaw", "G.711 u-law" }

      ,

      { 1, AST_FORMAT_ALAW, "alaw", "G.711 A-law" }

      ,

      { 1, AST_FORMAT_G726, "g726", "G.726" }

      ,

      { 1, AST_FORMAT_ADPCM, "adpcm" , "ADPCM"}

      ,

      { 1, AST_FORMAT_SLINEAR, "slin", "16 bit Signed Linear PCM"}

      ,

      { 1, AST_FORMAT_LPC10, "lpc10", "LPC10" }

      ,

      { 1, AST_FORMAT_G729A, "g729", "G.729A" }

      ,

      { 1, AST_FORMAT_SPEEX, "speex", "SpeeX" }

      ,

      { 1, AST_FORMAT_ILBC, "ilbc", "iLBC"}

      ,

      { 0, 0, "nothing", "undefined" },
      { 0, 0, "nothing", "undefined" }

      ,

      { 0, 0, "nothing", "undefined" },
      { 0, 0, "nothing", "undefined" }

      ,

      { 0, AST_FORMAT_MAX_AUDIO, "maxaudio", "Maximum audio format" }

      ,

      { 1, AST_FORMAT_JPEG, "jpeg", "JPEG image"}

      ,

      { 1, AST_FORMAT_PNG, "png", "PNG image"}

      ,

      { 1, AST_FORMAT_H261, "h261", "H.261 Video" }

      ,

      { 1, AST_FORMAT_H263, "h263", "H.263 Video" }

      ,

      { 0, 0, "nothing", "undefined" },
      { 0, 0, "nothing", "undefined" }

      ,

      { 0, 0, "nothing", "undefined" },
      { 0, 0, "nothing", "undefined" }

      ,

      { 0, AST_FORMAT_MAX_VIDEO, "maxvideo", "Maximum video format" }

      ,
      };

      The users/peers store a ast_codecs_pref object
      which hold an array of 32 bytes each index in the array
      is an order of preference from left to right and the
      value of each index is 1 index value from AST_FORMAT_LIST[]
      offset by 1 to allow 0 to mean undefined

      for instance g726 is at the 5th index in AST_FORMAT_LIST
      if you start counting at 1 so to store g726 as your first preference you store a 5 in your prefs obj
      if you want alaw to come second you append a 4 this is mostly irrelivant to the programmer because there is an api to handle the adding and removing of codecs The important part is this patch which uses a technique where 56 is added to all the index of your prefs which cause a printable string using letters of the alpahbet to transmit your pref order.

      so without understanding it fully one can solicit an specific codec order by sending the information element
      CODEC_PREFS with an alpha string of capital letters
      corresponding to the above AST_FORMAT_LIST

      A = g723
      B = gsm
      C = ulaw
      D = alaw
      E = g726
      F = adpcm
      G = slin
      H = lpc10
      I = g729
      J = speex
      K = ilbc

      so CODEC_ORDER=JEC will set the callers desired codec order
      to speex,g726,ulaw making a very compact way to transmit
      a desired codec prefrence and possibly obseleting some
      other elements.

      Since this is a protocol change it is important that the
      community have some feedback in the process so please
      post your opinions here.

                • ADDITIONAL INFORMATION ******

      Disclaimer on file
      anthmct@yahoo.com

        Activity

        Hide
        Anthony Minessale added a comment -

        DoH! rev8 adds frame.? to the patch

        LoL that was the most sarcastic non-sarcastic reply I have seen in quite a while I like it.

        Show
        Anthony Minessale added a comment - DoH! rev8 adds frame.? to the patch LoL that was the most sarcastic non-sarcastic reply I have seen in quite a while I like it.
        Hide
        stevekstevek added a comment -

        OK, one more (maybe this is the last).

        You added my instrumentation, which probably shouldn't be there – (it was just for me to make sure I knew which way the code actually was going, when figuring out why prefs weren't working..):

        + ast_log(LOG_WARNING, "XXX: using global codec prefs\n");

        I don't think any message needs to be there at all.

        I guess I'll wait 'till kram gives his thumbs up on this (and perhaps, until someone gives me the go-ahead to use this code in LGPL libiax2), before I port it over there.. iaxclient people probably might get pissed if I change the API again, though, so I guess I'll also have to try to figure out how to add this to the API without breaking the old one..

        Show
        stevekstevek added a comment - OK, one more (maybe this is the last). You added my instrumentation, which probably shouldn't be there – (it was just for me to make sure I knew which way the code actually was going, when figuring out why prefs weren't working..): + ast_log(LOG_WARNING, "XXX: using global codec prefs\n"); I don't think any message needs to be there at all. I guess I'll wait 'till kram gives his thumbs up on this (and perhaps, until someone gives me the go-ahead to use this code in LGPL libiax2), before I port it over there.. iaxclient people probably might get pissed if I change the API again, though, so I guess I'll also have to try to figure out how to add this to the API without breaking the old one..
        Hide
        Anthony Minessale added a comment -

        ok rev9 removes the debug line and the // comments i was using a reference for the old behaviour

        Show
        Anthony Minessale added a comment - ok rev9 removes the debug line and the // comments i was using a reference for the old behaviour
        Hide
        Mark Spencer added a comment -

        Merged in CVS head, thanks!

        Show
        Mark Spencer added a comment - Merged in CVS head, thanks!
        Hide
        Digium Subversion added a comment -

        Repository: asterisk
        Revision: 4727

        U trunk/channels/chan_iax2.c
        U trunk/channels/iax2-parser.c
        U trunk/channels/iax2-parser.h
        U trunk/channels/iax2.h
        U trunk/frame.c
        U trunk/include/asterisk/frame.h

        ------------------------------------------------------------------------
        r4727 | markster | 2008-01-15 15:20:44 -0600 (Tue, 15 Jan 2008) | 2 lines

        Merge experimental codec preferences for IAX2 (bug ASTERISK-2918)

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

        http://svn.digium.com/view/asterisk?view=rev&revision=4727

        Show
        Digium Subversion added a comment - Repository: asterisk Revision: 4727 U trunk/channels/chan_iax2.c U trunk/channels/iax2-parser.c U trunk/channels/iax2-parser.h U trunk/channels/iax2.h U trunk/frame.c U trunk/include/asterisk/frame.h ------------------------------------------------------------------------ r4727 | markster | 2008-01-15 15:20:44 -0600 (Tue, 15 Jan 2008) | 2 lines Merge experimental codec preferences for IAX2 (bug ASTERISK-2918 ) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=4727

          People

          • Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development