Asterisk on Freerunner was: voip on Debian

Nicola Mfb nicola.mfb at gmail.com
Sun Apr 19 23:55:54 CEST 2009


2009/4/19 Nicola Mfb <nicola.mfb at gmail.com>:
[...]
> Some alsa guru may take a look at the chan_alsa.c file of asterisk 1.4.17?

Here a little c snippet to show you easily the problem (that I have on
the desktop too). So it seems an alsa-lib bug/feature ?

#include <alsa/asoundlib.h>
int main(int argc, char **argv) {
        int err;
        snd_pcm_t *handle;
        struct pollfd pfd;
        fd_set fds;

        err = snd_pcm_open(&handle, "default" ,
SND_PCM_STREAM_PLAYBACK, O_NONBLOCK);
        if (err < 0) {
                puts("snd_pcm_open error");
                exit(1);
        }

        err = snd_pcm_poll_descriptors_count(handle);
        if (err != 1) {
                puts("snd_pcm_poll_descriptors_count problem");
                exit(1);
        }

        snd_pcm_poll_descriptors(handle, &pfd, err);

        FD_ZERO(&fds);
        FD_SET(pfd.fd,&fds);

        err=select(pfd.fd+1,NULL,&fds,NULL,NULL);
        if (err<1) puts("select failed");
        puts("Ok");
}

Save the above line in alsatest.c and compile with cc -o alsatest
alsatest.c -lasound,
launch it and if "default" is dmixed you well not see "Ok".
Changing default in plughw:0,0 or hw:0,0 in alsatest.c recompile and
you'll see the "Ok" immediately e.g. the behaviour that asterisk would
like!

Regards

       Nicola




More information about the community mailing list