Direct channel configuration with ALSA sound device

Hello everyone, I hope you are well.

I’m configuring an ALSA channel to send audio directly to a sound card.

When trying to load the module I get the following error:
module load
[Feb 15 17:12:05] WARNING[1525]: chan_alsa.c:215 alsa_card_init: Rate not correct, requested 8000, got 44100
[Feb 15 17:12:05] ERROR[1525]: chan_alsa.c:210 alsa_card_init: set_channels failed: Invalid argument
[Feb 15 17:12:05] WARNING[1525]: chan_alsa.c:215 alsa_card_init: Rate not correct, requested 8000, got 44100
[Feb 15 17:12:05] WARNING[1525]: channel.c:547 ast_channel_register: Already have a handler for type ‘Console’
[Feb 15 17:12:05] ERROR[1525]: chan_alsa.c:1029 load_module: Unable to register channel class ‘Console’
Unable to load module

However, after searching a lot on Google, I made a configuration forcing the rate to 8000hz, in the file ~/.asoundrc

pcm.rate_convert {
type rate
slave {
pcm “hw:0.0”
rate 8000

pcm.!default {
type plug
slave.pcm “rate_convert”

But I still have the same error.

When trying to make calls with the console channel I get the following result:
channel originate Local/70@local application MusicOnHold
*CLI> – Called 70@local
– Executing [70@local:1] NoOp(“Local/70@local-00000000;2”, “Init Test ALSA SOUND”) in new stack
– Executing [70@local:2] Answer(“Local/70@local-00000000;2”, “”) in new stack
– Local/70@local-00000000;1 answered
> Launching MusicOnHold() on Local/70@local-00000000;1
– Started music on hold, class ‘default’, on channel ‘Local/70@local-00000000;1’
– Executing [70@local:3] Dial(“Local/70@local-00000000;2”, “Console/ALSA”) in new stack
[Feb 15 17:16:44] WARNING[1852][C-00000001]: chan_oss.c:388 find_desc: could not find
[Feb 15 17:16:44] WARNING[1852][C-00000001]: chan_oss.c:864 oss_request: oss_request ty data 0x0x7f8930017fe8
[Feb 15 17:16:44] NOTICE[1852][C-00000001]: chan_oss.c:866 oss_request: Device ALSA not found
[Feb 15 17:16:44] NOTICE[1852][C-00000001]: app_dial.c:2750 dial_exec_full: Unable to create channel of type ‘Console’ (cause 0 - Unknown) == Everyone is busy/congested at this time (1:0/0/1)
– Executing [70@local:4] Hangup(“Local/70@local-00000000;2”, “”) in new stack
== Spawn extension (local, 70, 4) exited non-zero on ‘Local/70@local-00000000;2’
– Stopped music on hold on Local/70@local-00000000;1

My extensions.conf looks like this:
exten => 70.1,Noop(Init Test ALSA SOUND)
same => n,Answer()
same => n,Dial(Console/ALSA)
same => n,Hangup()

I tested my sound card using an mp3 file
play file.mp3 and the audio works normally.

Could someone please help me with this problem?

chan_alsa was deprecated in Asterisk version 21, which does seem like a bit of a shame, but you might be able to migrate to chan_console instead.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.