I am trying to stream MOH using Asterisk 1.2 using the following musiconhold.conf settings
[default]
mode=custom
application=/usr/sbin/streamplayer 68.238.170.139 9000
format=ulaw
– Executing Answer(“SIP/101-9a59”, “”) in new stack
– Executing SetMusicOnHold(“SIP/101-9a59”, “default”) in new stack
– Executing WaitMusicOnHold(“SIP/101-9a59”, “200”) in new stack
– Started music on hold, class ‘default’, on channel 'SIP/101-9a59’
I get no sound, however, and when I hang up the phone I get
– Stopped music on hold on SIP/101-9a59
Note:
I had deleted mpg123 prior to this and was using Asterisk to play .raw files just fine.
I can hear sound from the Slimserver just fine using RealPlayer to test the stream 68.238.170.139:9000/stream.mp3
I have also been to everywhere I could Google to make this work before asking it here. I noticed that most people who were asking this question either never got the answers or, once they received them privately, never posted them publicly. Hopefully, here we can resolve it.
The most common error I encountered while I was playing with streaming moh was what you are seeing. Turns out, the url was incorrect. This one works as a test case.
Note the / at the end. Without it , didn’t work.
nerdvittles has a good tutorial. Just make sure the url is correct as the initial examples for url did not work for me.
Thanks for the reply, hopefully this dialogue moves us closer to a solution. Unfortunately, the Nerd Vittles tutorial uses deprecated commands - but it is a good reference on how to get streaming to work with 1.0-1.1x versions of Asterisk (or for those wishing to use mpg123 in Asterisk 1.2x), though the calling of a playlist (.pls) file in musiconhold.conf has never worked well, so I might avoid that part of the tutorial entirely.
Also of note, the streamplayer utility does not accept url’s in the format you listed, so I am not sure you used the same utility. It sounds like you used another method - could you post the musiconhold.conf that produced correct streaming audio?
To clarify so that there is no confusion: I am using Asterisk 1.2x with a verified URL.
Update: I have also tried re-installing mpg123 v0.60 and using it as the audio controller for the stream with no results.
Update From Russell Bryant (creator of Streamplayer):
I wrote that application for a customer that had a device that could stream ulaw audio over a raw TCP stream. There isn’t much more to it than that. If you have an endpoint that you can connect to via TCP and will provide a raw stream of audio, it should work.
I have never used slimserver, but assuming it is capable of streaming with just a raw TCP stream and does not require something like http, it should work.
Is there a way to connect to streams from Slimserver or Shoutcast via TCP without using an http: call?
Here is what I have tried that hasn?t worked. In most all cases the response is ?Music on hold started?, immediately followed by ?Music on hold stopped? with no sound in any case.
I have since deleted my streaming moh set up, but the nerdvittles tutorial worked on my asterisk 1.2.5 setup when I followed it step by step except for the url.
The key to not getting the music stop error is using the correct url, often I found needing a / at the end. And, I did not use .pls (never worked for me).
look at my comments attached to nerdvittles article.
If you are really stumped and would like to get it working in this manner, I will try to find some time to set it up again, test it, then post it.
I setup my own Shoutcast server and streamed MP3’s to the phone system that way.
The information is available on the web, but I had to do extra stuff pulled from lots of different sources to get it all to work with the best sound quality. I will post a blog somewhere and link to it.