Skip to contentSkip to conversation

Asterisk and ALSA/Jack

DISCUSSION Pavel Hofman 1 participant 1 message Oct 5, 2009 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 000101ca442b$20b13f90$6213beb0$@[email protected]

#1 lore raw
Quoted 114 lines · Fabien COMTE

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

Quoted 4 lines

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.