Asterisk monopolizing /dev/dsp

I’ve recently installed Asterisk 1.4.14 from source under centos 5, and all is going well. I’ve set up an overhead paging system using Page(Console/dsp). This works great, however, I also want to play some sound files over the paging system on occasion from the same sound card, for example, to let everyone know it’s lunchtime. I’m using mpg123 v0.68 compiled from source. It works fine until I use asterisk to page over the system. From then on, unless I restart asterisk, running mpg123 yields:

[code][audio_oss.c:182] error: Can’t open default sound device!
audio: No such file or directory

Directory: /usr/bin/
Playing MPEG stream 1 of 1: ring.mp3 …
MPEG 1.0 layer III, 128 kbits/s, 44100 Hz stereo
[audio.c:267] error: Unable to set up output device! Constraints: 44100, 22050 or 11025Hz.

Audio device:
[/code]

Is there any way around this? Thanks for any help!

After messing around with this on and off for about a week, I still have not found a solution to this. I’ve stumbled across a couple of other strange things though. In ‘dmesg’, I find:

Also, using ‘play’, which is a simple interface to sox, I get:

ALSA lib pcm_dmix.c:864:(snd_pcm_dmix_open) unable to open slave sox: Failed writing default: cannot open audio device

I’ve contemplated adding another sound card to this machine in hopes of fixing this, but I’m not sure I want to go through the hassle. Does anyone know if this is normal behavior? I’m also considering trying to switch asterisk over to using ALSA to see if that changes anything, but I’m not sure how that will go. Thanks for any help!

The answer is you need to have a full duplex sound server running. Basically software which will capture all sounds and send them to the sound card in turn instead of sending the sounds direct to the card as you do now.

I have never found a solution to doing this. It just seems to complicated and overblown to me. I just dont need it that much.

the obsolete oss error is nothing to worry about. Years ago we used oss in the kernel for sound. It was replaced by Alsa instead

Although I do believe that duplexing has to do with input/output than playing more than one sound at once (I think the best word for that is ‘mixing’), your reply did give me an idea.

I found this snippet at https://bugs.launchpad.net/ubuntu/+bug/76876:

That pretty much answers my question. It leads me to either change over to ALSA (which supports software mixing, so I’ve read), use alsa-oss, or get a hardware mixing capable soundcard.

Thank you :smile:

Ah. I bet you’re right. I was trying to get my microphone working with Teamspeak + X-Plane a few weeks back and am confusing your issue with mine.
However all my computers here are fairly new and i’m sure they would do sound mixing, but it never works. I can play only one sound at once.

I have a shared Asterisk/MythTV box but had to disable sound in Asterisk to get sound in MythTV.

I’ve used aoss successfully in the past - iirc it wasn’t very difficult at all to get to work.