[Asterisk-Dev] Oddities in asterisk/say.c

Gil Kloepfer astr-dev at kloepfer.org
Wed Sep 15 20:29:08 MST 2004


Hi Everyone...

First time contributor, long time listener... :-)

When hunting down a strange problem with the voicemail application
mysteriously hanging-up on me, I discovered something weird in
asterisk/say.c:  In many places, the following code snippet is
there:

        if (audiofd && ctrlfd)
                res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
        else
                res = ast_waitstream(chan, ints);


In trying to figure out what ast_waitstream_full did, I discovered
that having the file descriptors -1 actually produces an error
in ast_waitstream_full if the timeout happens...upon closer examination,
it looks like what this code should really be is:

        if (audiofd > -1 && ctrlfd > -1)
                res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
        else
                res = ast_waitstream(chan, ints);


It looks like what was intended was to test for the case of using
waitstream with or without provided file descriptors ... and
unfortunately for the original code (-1 == true).

So, did I understand correctly and should these tests be like I am
suggesting, or did I misunderstand what the original code did.

---
Gil Kloepfer
astr-dev at kloepfer.org



More information about the asterisk-dev mailing list