]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Backport rev 69010 from the 1.4 branch ...
authorRussell Bryant <russell@russellbryant.com>
Thu, 14 Jun 2007 20:56:19 +0000 (20:56 +0000)
committerRussell Bryant <russell@russellbryant.com>
Thu, 14 Jun 2007 20:56:19 +0000 (20:56 +0000)
In ast_channel_make_compatible(), just return if the channels' read and write
formats already match up.  There are code paths that call this function on a
pair of channels multiple times.  This made calls fail that were using g729
in some cases.  The reason is that codec_g729a will unregister itself from the
list of available translators will all licenses are in use.  So, the first
time the function got called, the right translation path was allocated.
However, the second time it got called, the code would not find a translation
path to/from g729 and make the call fail, even if the channel actually already
had a g729 translation path allocated.

(SPD-32)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@69347 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channel.c

index c76c9b7e7cc53eb56bfe27df421050b1b6c169d1..628e0614fa7593d661d8c3f1a36559c42568c826 100644 (file)
--- a/channel.c
+++ b/channel.c
@@ -2766,6 +2766,11 @@ int ast_channel_make_compatible(struct ast_channel *chan, struct ast_channel *pe
        int src;
        int dst;
 
+       if (chan->readformat == peer->writeformat && chan->writeformat == peer->readformat) {
+               /* Already compatible!  Moving on ... */
+               return 0;
+       }
+
        /* Set up translation from the chan to the peer */
        src = chan->nativeformats;
        dst = peer->nativeformats;