Sound output to sound card

Get help with installing, upgrading and running Asterisk.

Moderators: muppetmaster, Moderator, Support

Sound output to sound card

Postby Lexus45 » Mon Mar 25, 2013 5:41 am

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!
Lexus45
Oldsterisk
 
Posts: 138
Joined: Tue Jul 10, 2012 11:22 pm

Re: Sound output to sound card

Postby Lexus45 » Mon Mar 25, 2013 10:03 am

Lexus45
Oldsterisk
 
Posts: 138
Joined: Tue Jul 10, 2012 11:22 pm

Re: Sound output to sound card

Postby Lexus45 » Tue Mar 26, 2013 2:27 am

This works :)

; 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.
Lexus45
Oldsterisk
 
Posts: 138
Joined: Tue Jul 10, 2012 11:22 pm

Re: Sound output to sound card

Postby Lexus45 » Thu Mar 28, 2013 6:10 am

While everything worked well one one machine, I've faced the problem on the other one.
Code: Select all
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 :-)
Config files are similar. Modules loaded are similar.
This is a RaspberryPi. Maybe that is why it doesn't work ?
Lexus45
Oldsterisk
 
Posts: 138
Joined: Tue Jul 10, 2012 11:22 pm

Re: Sound output to sound card

Postby navaismo » Thu Mar 28, 2013 11:19 am

You need to compile asterisk with that channel driver. You need to perform the make menuselect and then enable the chan_console.
navaismo
Salt of the Asterisk
 
Posts: 1610
Joined: Mon Dec 07, 2009 1:30 pm
Location: Mexico City, Mexico

Re: Sound output to sound card

Postby Lexus45 » Thu Mar 28, 2013 10:57 pm

navaismo wrote: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
Code: Select all
./configure
.

I have an idea to try http://www.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 http://forums.debian.net/viewtopic.php? ... 63#p450838
chan_alsa is now available. chan_console is not, I'll try the link above.
Lexus45
Oldsterisk
 
Posts: 138
Joined: Tue Jul 10, 2012 11:22 pm

Re: Sound output to sound card

Postby Lexus45 » Sun Mar 31, 2013 10:03 pm

After installing Asterisk from source I still have some problems .
It seems that I have everything what I need:
Code: Select all
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)
Code: Select all
  == 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:
Code: Select all
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.
Lexus45
Oldsterisk
 
Posts: 138
Joined: Tue Jul 10, 2012 11:22 pm

Re: Sound output to sound card

Postby navaismo » Sun Mar 31, 2013 11:07 pm

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.
navaismo
Salt of the Asterisk
 
Posts: 1610
Joined: Mon Dec 07, 2009 1:30 pm
Location: Mexico City, Mexico

Re: Sound output to sound card

Postby Lexus45 » Mon Apr 01, 2013 1:42 am

navaismo wrote: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:
Code: Select all
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.
Lexus45
Oldsterisk
 
Posts: 138
Joined: Tue Jul 10, 2012 11:22 pm

Re: Sound output to sound card

Postby david55 » Mon Apr 01, 2013 4:00 am

Asterisk always has slin support, as all the internal tone generation uses slin.
david55
Moves Like Spencer
 
Posts: 12570
Joined: Fri Sep 26, 2008 5:03 am

Re: Sound output to sound card

Postby Lexus45 » Mon Apr 01, 2013 4:07 am

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

and I need slin16
Lexus45
Oldsterisk
 
Posts: 138
Joined: Tue Jul 10, 2012 11:22 pm

Re: Sound output to sound card

Postby david55 » Mon Apr 01, 2013 4:18 am

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.
david55
Moves Like Spencer
 
Posts: 12570
Joined: Fri Sep 26, 2008 5:03 am

Re: Sound output to sound card

Postby Lexus45 » Mon Apr 01, 2013 5:21 am

david55 wrote:You may need to add it, with menuselect. Have you checked to see whether the format is configurable for the specific driver?

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.
Lexus45
Oldsterisk
 
Posts: 138
Joined: Tue Jul 10, 2012 11:22 pm

Re: Sound output to sound card

Postby Lexus45 » Tue Apr 02, 2013 1:15 am

Compiling , the third time.
http://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'.
Lexus45
Oldsterisk
 
Posts: 138
Joined: Tue Jul 10, 2012 11:22 pm

Re: Sound output to sound card

Postby david55 » Tue Apr 02, 2013 4:05 am

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.
david55
Moves Like Spencer
 
Posts: 12570
Joined: Fri Sep 26, 2008 5:03 am

Re: Sound output to sound card

Postby Lexus45 » Tue Apr 02, 2013 5:05 am

Compiled Asterisk-11.3.0.
This is the result:
Code: Select all
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?
http://rghost.ru/44987413/image.png
Last edited by Lexus45 on Tue Apr 02, 2013 5:08 am, edited 1 time in total.
Lexus45
Oldsterisk
 
Posts: 138
Joined: Tue Jul 10, 2012 11:22 pm

Re: Sound output to sound card

Postby david55 » Tue Apr 02, 2013 5:07 am

Remove those modules, and for safety, do make install, again.
david55
Moves Like Spencer
 
Posts: 12570
Joined: Fri Sep 26, 2008 5:03 am

Re: Sound output to sound card

Postby Lexus45 » Tue Apr 02, 2013 5:41 am

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.
Lexus45
Oldsterisk
 
Posts: 138
Joined: Tue Jul 10, 2012 11:22 pm

Re: Sound output to sound card

Postby Lexus45 » Wed Apr 03, 2013 1:42 am

Now we've installed ARCH Linux for ARM :) 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.
Lexus45
Oldsterisk
 
Posts: 138
Joined: Tue Jul 10, 2012 11:22 pm

Re: Sound output to sound card

Postby navaismo » Wed Apr 03, 2013 10:29 am

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.
navaismo
Salt of the Asterisk
 
Posts: 1610
Joined: Mon Dec 07, 2009 1:30 pm
Location: Mexico City, Mexico

Re: Sound output to sound card

Postby Lexus45 » Wed Apr 03, 2013 10:45 pm

navaismo wrote: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.

Yes, you're right, I've already tried 'default', 'hw:0,0', 'bcm2835:0,0' in /etc/asteris/alsa.conf. I don't know what else could be written to that file .
Lexus45
Oldsterisk
 
Posts: 138
Joined: Tue Jul 10, 2012 11:22 pm

Re: Sound output to sound card

Postby navaismo » Wed Apr 03, 2013 11:49 pm

The asterisk user can use the hardware? check the permission and owner also check if the card is not in use for other app.
navaismo
Salt of the Asterisk
 
Posts: 1610
Joined: Mon Dec 07, 2009 1:30 pm
Location: Mexico City, Mexico

Re: Sound output to sound card

Postby david55 » Thu Apr 04, 2013 1:04 am

This now feels more like a Raspbian or Alsa issue.
david55
Moves Like Spencer
 
Posts: 12570
Joined: Fri Sep 26, 2008 5:03 am

Re: Sound output to sound card

Postby Lexus45 » Wed May 15, 2013 3:26 am

It's a long story how everything started working (my collegue finished this deal) :)
So, we go on.

Now the system "IP-phone - RPi" can be used as a loudspeaker.

But our scheme will look as on the picture:
http://s2.postimg.org/lspjmee3t/alarm.jpg

- there is a main office PBX (also running Asterisk)
- all IP-phones are connected (registered) to it
- several RPis with Asterisks on board are connected to main PBX by SIP trunks. Each of them has the same extensions (p.e. 111), after dialing which the sound is outputed from the speaker, connected to RPi's sound card.

Now the problem.
I understand how to dial to a single RPi, through main PBX (... Dial(SIP/rpi1_trunk/111) or Dial(SIP/rpi2_trunk/111) and so on) and it's OK.
But we need an ability to dial to all RPis simultaniously (for example to speak the same words to all zones, where RPis are located in the building, like "Fire! Leave the office" :) ).

What's the best tool to do this?
If I will use the construction 'Dial(SIP/rpi1_trunk/111)&Dial(SIP/rpi2_trunk/111)&Dial(SIP/rpi3_trunk/111)&Dial(SIP/rpi4_trunk/111)' , I'm sure that only one RPi will speak. The same is about queues. The first answered RPi will output the voice (am I right?), others will not.
I know that the phone queue with the strategy 'ringall' behaves in t his way - all phones are ringing, but when any of them is picked up, others stop ringing and of course they do not output the caller's sound, only the picked phone is used in the conversation.

In fact, all our RPis answer automatically, but still... I'm not sure that &-construction or Queues can be the best solution here.

Should I use Conference ?
If it's so, each RPi must automatically enter the conference, created on the main office PBX, am I right ?
Lexus45
Oldsterisk
 
Posts: 138
Joined: Tue Jul 10, 2012 11:22 pm

Re: Sound output to sound card

Postby david55 » Wed May 15, 2013 4:02 am

See the page application.

Also, the application name should only appear once.
david55
Moves Like Spencer
 
Posts: 12570
Joined: Fri Sep 26, 2008 5:03 am


Return to Asterisk Support

Who is online

Users browsing this forum: No registered users and 23 guests