Sound output to sound card

Hello all.
I’m not sure if I formulated the question well enough. I hope you will understand.
What is the best way to ‘redirect’ the sound of a phone call to the sound card?

The situation is as follows - I need to set up a server which will notify loudly some group of people in the room, where it will be located.

So, after some extension is dialed, this Asterisk/softphone answers automatically, and everything that is said to the dialed extension, will be heard by the audience.

I’m not sure if Asterisk is the right solution, maybe some softphone will be OK (we have the ‘main’ Asterisk server where extensions are stored in the config file).

Maybe all I need - is to know how to forward all output sound to the sound card. If I’m not mistaken , chan_oss is able to do something like this. Is there any easier and more simple way to achieve the result ?

Say, that extension is [1111]. When somebody dials [1111], that PC with Asterisk/softphone answers automatically and everybody hear what is said to that channel.

Share your ideas please. Any of them will be useful!

I think I should start from here:
voip-info.org/wiki/view/Aste … +alsa.conf
or
voip-info.org/wiki/view/Aste … g+oss.conf

This works :smile:

; 1002
exten => 1002,1,Dial(CONSOLE/ALSA)
exten => 1002,n,Hangup()

After dialing [1002] from an IP-phone, I can hear/talk to the dialer from the microphone and speakers, connected to the Asterisk box directly.
It’s interesting that I haven’t edited alsa.conf at all.

While everything worked well one one machine, I’ve faced the problem on the other one.

WARNING[3422]: channel.c:5627 ast_request: No channel type registered for 'CONSOLE'
WARNING[3422]: app_dial.c:2274 dial_exec_full: Unable to create channel of type 'CONSOLE' (cause 66 - Channel not implemented)

The sound card works, because this machine ‘sings songs’ in the WC :smile:
Config files are similar. Modules loaded are similar.
This is a RaspberryPi. Maybe that is why it doesn’t work ?

You need to compile asterisk with that channel driver. You need to perform the make menuselect and then enable the chan_console.

Thank you for the reply.
Yes, I’ve found that * is compiled without this channel.
The problem now is that I can not compile Asterisk from source - the system says that I haven’t got ‘ncurses-dev’ package. But there’s not such a package in the repository of Debian Wheezy for RaspberryPi : ) This message appeares after running ./configure .

I have an idea to try raspberry-asterisk.org . Maybe this solution have support of channel driver.

If it doesn’t have , I’ll try to run some [console] softphone which will be able to auto answer the incoming call.

=====================

Found forums.debian.net/viewtopic.php? … 63#p450838
chan_alsa is now available. chan_console is not, I’ll try the link above.

After installing Asterisk from source I still have some problems .
It seems that I have everything what I need:

raspberrypi*CLI> core show channeltypes 
Type        Description                              Devicestate  Indications  Transfer    
----------  -----------                              -----------  -----------  --------    
SIP         Session Initiation Protocol (SIP)        yes          yes          yes         
Console     Console Channel Driver                   no           yes          no          
----------
2 channel drivers registered.

But still :
[Apr 1 10:01:05] WARNING[4304]: channel.c:5679 ast_request: No translator path exists for channel type CONSOLE (native 0x8000 (slin16)) to 0x8 (alaw)
[Apr 1 10:01:05] WARNING[4304]: app_dial.c:2345 dial_exec_full: Unable to create channel of type ‘CONSOLE’ (cause 58 - Bearer capability not available)

  == Using SIP RTP CoS mark 5
    -- Executing [112@myphones:1] Dial("SIP/1111-00000015", "CONSOLE/ALSA") in new stack
[Apr  1 10:01:05] WARNING[4304]: channel.c:5679 ast_request: No translator path exists for channel type CONSOLE (native 0x8000 (slin16)) to 0x8 (alaw)
[Apr  1 10:01:05] WARNING[4304]: app_dial.c:2345 dial_exec_full: Unable to create channel of type 'CONSOLE' (cause 58 - Bearer capability not available)
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing [112@myphones:2] Hangup("SIP/1111-00000015", "") in new stack
  == Spawn extension (myphones, 112, 2) exited non-zero on 'SIP/1111-00000015'

This happens on RaspberryPi.

The same configuration, but on Pentium-III with Debian stable and Asterisk from repository, works well:

debianvoip*CLI> core show channeltypes 
Type        Description                              Devicestate  Indications  Transfer    
----------  -----------                              -----------  -----------  --------    
Console     ALSA Console Channel Driver              no           yes          no          
SIP         Session Initiation Protocol (SIP)        yes          yes          yes         
----------
2 channel drivers registered.

But I can use ip-phones with RaspberryPi. Everything works. But when I try to dial an extension which will be outputed to the sound card, it fails. Where is the problem?! The sound card works well, it outputs the music (with mpg123), nothing is muted, the sound is heard well.

The issue is about codec translation seems like your asterisk doesn’t have slin support. Check your codec’s again when perform the make menuselect.

Yes, it is so:

raspberrypi*CLI> core show translation
         Translation times between formats (in microseconds) for one second of data
          Source Format (Rows) Destination Format (Columns)

           g723   gsm  ulaw  alaw g726aal2 adpcm  slin lpc10  g729 speex  ilbc  g726  g722 siren7 siren14 slin16  g719 speex16 testlaw
     g723     -     -     -     -        -     -     -     -     -     -     -     -     -      -       -      -     -       -       -
      gsm     -     -     - 10001        -     - 10000     -     -     -     -     -     -      -       -      -     -       -       -
     ulaw     -     -     -     -        -     -     -     -     -     -     -     -     -      -       -      -     -       -       -
     alaw     - 10001     -     -        -     -     1     -     -     -     -     -     -      -       -      -     -       -       -
 g726aal2     -     -     -     -        -     -     -     -     -     -     -     -     -      -       -      -     -       -       -
    adpcm     -     -     -     -        -     -     -     -     -     -     -     -     -      -       -      -     -       -       -
     slin     - 10000     -     1        -     -     -     -     -     -     -     -     -      -       -      -     -       -       -
    lpc10     -     -     -     -        -     -     -     -     -     -     -     -     -      -       -      -     -       -       -
     g729     -     -     -     -        -     -     -     -     -     -     -     -     -      -       -      -     -       -       -
    speex     -     -     -     -        -     -     -     -     -     -     -     -     -      -       -      -     -       -       -
     ilbc     -     -     -     -        -     -     -     -     -     -     -     -     -      -       -      -     -       -       -
     g726     -     -     -     -        -     -     -     -     -     -     -     -     -      -       -      -     -       -       -
     g722     -     -     -     -        -     -     -     -     -     -     -     -     -      -       -      -     -       -       -
   siren7     -     -     -     -        -     -     -     -     -     -     -     -     -      -       -      -     -       -       -
  siren14     -     -     -     -        -     -     -     -     -     -     -     -     -      -       -      -     -       -       -
   slin16     -     -     -     -        -     -     -     -     -     -     -     -     -      -       -      -     -       -       -
     g719     -     -     -     -        -     -     -     -     -     -     -     -     -      -       -      -     -       -       -
  speex16     -     -     -     -        -     -     -     -     -     -     -     -     -      -       -      -     -       -       -
  testlaw     -     -     -     -        -     -     -     -     -     -     -     -     -      -       -      -     -       -       -

When I compiled Asterisk, I checked these options. Now I recompiled it again and checked them again. But the result is the same. Should I do something else before compiling Asterisk, to make it support slin16 codec?

On the other hand, my test server shows the same output of ‘core show translation’, but everything works fine on it. On the RaspberryPi it doesn’t.

Asterisk always has slin support, as all the internal tone generation uses slin.

and I need slin16

I’m surprised the console driver expects 16kHz sampling. You may need to add it, with menuselect. Have you checked to see whether the format is configurable for the specific driver?

You should remember that the console channel driver is more a proof of concept driver than something that would normally be used in production.

[quote=“david55”]You may need to add it, with menuselect. Have you checked to see whether the format is configurable for the specific driver?
[/quote]
Yes, I checked everything I could find in menuselect. I even compiled Asterisk twice, to be sure that I checked those options. But the result is the same.

Compiling , the third time.
rghost.ru/44981461/image.png

Maybe this is the problem? No codec tranlator for sln16 ? It is in ‘Format Interpreters’ only (the next option in the list). But not in ‘Codec Translators’.

Looks like it is handled by the resample codec, so you will need to try to select that and find out which dependency is missing.

Compiled Asterisk-11.3.0.
This is the result:

WARNING WARNING WARNING

 Your Asterisk modules directory, located at
 /usr/lib/asterisk/modules
 contains modules that were not installed by this 
 version of Asterisk. Please ensure that these
 modules are compatible with this version before
 attempting to run Asterisk.

    app_readfile.so
    app_setcallerid.so
    chan_gtalk.so
    chan_h323.so
    chan_jingle.so
    chan_mobile.so
    chan_vpb.so
    format_sln16.so
    res_ais.so
    res_jabber.so
    res_pktccops.so

 WARNING WARNING WARNING

When doing ‘make menuselect’ we’ve checked the ‘Format Interpreters’ option ‘format_sln’, but there was not ‘format_sln16’ option. Where could it be fined?
rghost.ru/44987413/image.png

Remove those modules, and for safety, do make install, again.

Removed, typed ‘make install’ again.

in 11.3.0 in modules.conf it’s written that we may load only one of:

  • chan_alsa
  • chan_oss
  • chan_console

In dialplan I have … DIal(CONSOLE/ALSA) - to make the sound go out of my sound card. So, I must have both chan_alsa and chan_local, but using both of them is prohibited.

Now we’ve installed ARCH Linux for ARM :smile: installed Atserisk there.
I hope that the only thing we have to do is to define correctly the sound card in alsa.conf.
Now the question: how to define it right?
In the sample we can see ‘hw:0,0’ . What does it mean? voip-info tell us that we may use ‘default’ there. And in most cases it will be OK. We were not successful…
‘aplay -l’ shows ‘bcm2835’ device name. So I tried ‘bcm2835:0,0’ but also all in vain.

aplay -l should show you a card number and a device number, un the case of the bcm controller using the pi must be card:0 device:0.