skip to Main Content

Is there a way (Tool or any idea) to play radio station (Streamed via IceCast) as a Music On Hold in Asterisk?, I Have a streaming server and Asterisk Server running and working independently very well, only I want to integrate both of two.

Your Help Please, THANKS IN ADVANCE

My OS: Linux – Centos

My Music On Hold Class:

mode=custom

application=/usr/bin/sox mystreamingurl -b 64000 -r 44100 -t ogg –

This script produces upnormal and noisy sound which is totally different from the sound produced by the Streaming Server(IceCas).

2

Answers


  1. Chosen as BEST ANSWER

    Used MPG123 player and worked like a charm

    Udated MOH Class:

    mode=custom application=/usr/bin/mpg123 -q -r 8000 -f 8192 --mono -s http://mystreamingurl


  2. Asterisk’s internal sound format is 8khz mono PCM

    You should directly specify for sox which output format to use for in and out.

    Also sox is NOT streaming utility, you should use something like MPlayer.

    https://www.voip-info.org/asterisk-config-musiconholdconf/#StreamradiousingMPlayerforMOH

    #!/bin/bash
    
    if -n "`ls /tmp/asterisk-moh-pipe.*`" ; then
    rm /tmp/asterisk-moh-pipe.*
    fi
    
    PIPE="/tmp/asterisk-moh-pipe.$$"
    mknod $PIPE p
    
    mplayer http://address_of_radio_station -really-quiet -quiet -ao pcm:file=$PIPE -af resample=8000,channels=1,format=mulaw 2>/dev/null | cat $PIPE 2>/dev/null
    rm $PIPE
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search