[alsa-devel] Asterisk and ALSA/Jack

Pavel Hofman pavel.hofman at ivitera.com
Mon Oct 5 10:02:33 CEST 2009


Fabien COMTE wrote:
> Hi,
> 
> I want to use Asterisk with ALSA / Jack audio.
> 
> I tried the next configurations :
> 
> 1 ) app_jack.so -> does not work.
> 
> 2 ) chan_alsa.so without jackd started
> my .asoundrc :
> pcm.!default 
> {
>     type hw
>     card 1
> }
> pcm.jack1 {
>     type jack
>     playback_ports {
>         0 alsa_pcm:playback_1
>         1 alsa_pcm:playback_2
>     }
>     capture_ports {
>         0 alsa_pcm:capture_1
>         1 alsa_pcm:capture_2
>     }
> }
> 
> pcm.jack1b {
>     type plug
>     device jack1b
>     server linux
> 
> 	
>     slave {
>     	 pcm "jack1"
>         rate 8000
>         format FLOAT
> 	 channels 2
>     }
> }
> 
> ctl.mixer0 {
>     type hw
>     card 1
> }
> 
> in alsa.conf :
> input_device=default
> output_device=default
> 
> That works fine.
> 
> 3 ) chan_alsa.so with jackd started
> Jackd launch command :
> jackd --port-max 16 --realtime --no-mlock -d alsa --playback hw:1,0
> --capture hw:1,0 --rate 8000 --period 1024 --shorts --inchannels 2
> --outchannels 2 --dither triangular &
> 
> my .asoundrc :
> 
> pcm.!default 
> {
>     type plug
>     slave {
>     	 pcm "jack1"
>         rate 8000
>         format FLOAT
> 	 channels 2
>     }
> }
> pcm.jack1 {
>     type jack
>     playback_ports {
>         0 alsa_pcm:playback_1
>         1 alsa_pcm:playback_2
>     }
>     capture_ports {
>         0 alsa_pcm:capture_1
>         1 alsa_pcm:capture_2
>     }
> }
> 
> pcm.jack1b {
>     type plug
>     device jack1b
>     server linux
> 
> 	
>     slave {
>     	 pcm "jack1"
>         rate 8000
>         format FLOAT
> 	 channels 2
>     }
> }
> 
> 
> ctl.mixer0 {
>     type hw
>     card 1
> }
> 
> in alsa.conf :
> input_device=default
> output_device=default
> 
> It doesn't work. Asterisk outputs are :
> [Oct  3 10:34:50] ERROR[1364]: chan_alsa.c:175 alsa_card_init: snd_pcm_open
> failed: No such file or directory
> [Oct  3 10:34:50] ERROR[1364]: chan_alsa.c:175 alsa_card_init: snd_pcm_open
> failed: No such file or directory
> [Oct  3 10:34:50] ERROR[1364]: chan_alsa.c:272 soundcard_init: Problem
> opening ALSA I/O devices
> 
> But aplay my_test_file.wav works fine and arecord too...
> 
> Does anyone have an idea ?
> 
Does asterisk run under the same user as the .asoundrc is defined for?

Since your card is nb. 1, perhaps asterisk uses a default configuration
for card0 which may not be present on your system.


Pavel.


More information about the Alsa-devel mailing list