Play Webradio with good audio quality and performance

Hi all,
I’m trying to play multiple webradio stations for a lot of callers with good audio quality and need some help.

Backgroud: I have to provide an alternative access method to live-streamed events for people without internet access. A substantial amount of them come in with g722

What I have tried so far:

  • Playing the radio streams with Music on Hold and mpg123
    + performance (only one instance of mpg123 for all users of the same moh class) :smiley:
    - sound quality: to work with moh the stream has to be downsampled to 8kHz :frowning_face:

  • Playing the streams with MP3Player
    + the sound quality is audibly better (on g722 calls) :smiley:
    - high performance impact because an instance of mpg123 is started for every caller :frowning_face:
    - doesn’t work with ARI :frowning_face:

  • Using an External Media Channel
    - I was not able to make it work. All examples I found are about exporting the audio and my attempts to stream into the channel failed. :frowning_face:

Any help would be greatly appreciated!

Welcome!

That doesn’t sound right. There are G722 MOH files available with Asterisk:

http://downloads.asterisk.org/pub/telephony/sounds/

Maybe start getting that to work, then add the streaming part back in ?

You need to specify the format in musiconhold.conf. I believe it by default wants whatever the default PBX format is. Asterisk provides a few samplerate conversion “codecs” for this purpose. Like I currently have some 16khz & 8khz OGG streams being played by ogg123. All I had to do was add format=slin16 to my 16khz streams and format=slin to my 8khz streams. The list of supported codecs is in the documentation

I have also used mplayer to achieve this by calling a shell script as an application

#!/bin/bash
PIPE="/tmp/asterisk-cmoh-pipe.$"
mknod $PIPE p


mplayer http://server:port/stream -softvol -really-quiet -quiet -ao pcm:file=$PIPE -af resample=8000,channels=1,format=mulaw,volume=-6:0 2>/dev/null | cat $PIPE 2>/dev/null

With this mplayer was providing mulaw directly and I did not need a format= line in my configuration.

2 Likes

Thank you so much, dewdude. This works!

1 Like

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