Streaming moh from VLC

Get help with installing, upgrading and running Asterisk.

Moderators: muppetmaster, Moderator, Support

Streaming moh from VLC

Postby burteaga » Fri Dec 16, 2011 1:47 am

Hi all,
I'm trying to stream mp3 files for music on hold from an VLC player, so that I can control (play, pause, next song...) it.
In order to get that, I've configured the musiconhold.conf file to run the VLC application listening at UDP port 1234.
However, I can see that music is captured but nothing is played at the SIP devices (they support mp3 codecs).

This is the musiconhold.conf file:
Code: Select all

[default]
mode=custom
application=/usr/bin/vlc-wrapper -vvv udp://@:1234


Should I do anything else to adapt VLC to asterisk? Which could be the mistake?
Any suggestion?
Thank you!
burteaga
Oldsterisk
 
Posts: 50
Joined: Fri Dec 16, 2011 1:21 am

Re: Streaming moh from VLC

Postby thor » Sat Dec 17, 2011 2:36 am

The application needs to write audio to stdout. Not sure how to do that with vlc.
I was able to stream from vlc to asterisk using mg123 version 1.13.4.
Configure VLC to stream using HTTP and put this in your musiconhold.conf:

Code: Select all
[vlc]
mode=custom
application=/usr/bin/mpg123 -q -s -m -r 8000 --ignore-mime http://IP:PORT


The ignore-mime parameter is required as VLC does not set the mime type properly (VLC 1.1.12 on Mac OSX)
thor
Oldsterisk
 
Posts: 238
Joined: Thu Mar 18, 2010 12:19 pm

Re: Streaming moh from VLC

Postby burteaga » Mon Dec 19, 2011 1:40 am

thank you thor!
But in that case, the quality wouldn't be very high, right? In my case, I'd like to stream directly at a mp3 quality. Is it compulsory to set a 8000 kHz samplerate?
Thanx a lot!
burteaga
Oldsterisk
 
Posts: 50
Joined: Fri Dec 16, 2011 1:21 am

Re: Streaming moh from VLC

Postby david55 » Mon Dec 19, 2011 6:01 am

Nearly all phone codecs are 8kHz. The PSTN is 8kHz, 8 bit, mu- or A-law. One or two phone codecs for local use are 16kHz. There is no way you will get MP3 quality over a phone system, in real time.

Many codecs are designed for speech use only, e.g. GSM, because they are based on a vocal tract model.

Is this a licensed use of the internet streams?
david55
Moves Like Spencer
 
Posts: 12570
Joined: Fri Sep 26, 2008 5:03 am

Re: Streaming moh from VLC

Postby burteaga » Mon Dec 19, 2011 8:06 am

Thanks for such a fast response David,

Let's see if I get it right: So even if I had a device (not an IPphone) which is able to decode mp3 files and do all the SIP stuff (Register, receive calls...), Asterisk doesn't support it and can't send that kind of traffic.

As for the license, it's just me who's using this for the moment so don't worry. I will look that up in the future... :wink:

Thanks and sorry if i'm being too stupid... :oops:
burteaga
Oldsterisk
 
Posts: 50
Joined: Fri Dec 16, 2011 1:21 am

Re: Streaming moh from VLC

Postby david55 » Mon Dec 19, 2011 8:14 am

Asterisk doesn't have MP3 pass through support, because no VoIP phones support MP3, or 44kHz audio. You could write an MP3 format module for Asterisk, which would allow it to do so, but you would still have the problem of finding SIP or H.232 devices that supported MP3.

I am not sure if the Asterisk architecture can handle variable bit rate coding, and it might not like sample rates that are not divisible by 8000.
david55
Moves Like Spencer
 
Posts: 12570
Joined: Fri Sep 26, 2008 5:03 am

Re: Streaming moh from VLC

Postby thor » Mon Dec 19, 2011 2:02 pm

You can get better quality when using 16kHz codec. More details in this thread:
viewtopic.php?t=74366

You could potentially use siren14 @32 kHz or g719 @48kHz

the full list of supported codecs in 1.8 branch is in main/frame.c :

https://code.asterisk.org/code/browse/a ... =true#to95
thor
Oldsterisk
 
Posts: 238
Joined: Thu Mar 18, 2010 12:19 pm

Re: Streaming moh from VLC

Postby burteaga » Tue Dec 20, 2011 2:15 am

alright, thank you!!
this looks like i'll have to get deeper so it'll take some time...
By the way, can the streaming be made with UDP? I've tried but mpg123 doesn't work properly...
Thanks again, bye!
burteaga
Oldsterisk
 
Posts: 50
Joined: Fri Dec 16, 2011 1:21 am

Re: Streaming moh from VLC

Postby burteaga » Tue Dec 20, 2011 5:10 am

After some little investigation...
Would it work if I changed res_musiconhold.c as explained in the link thor suggested (viewtopic.php?t=74366) for 48kHz samplerate? or is it just for 16kHz? And as for musiconhold.conf, would it be enough to add:
Code: Select all
mode=custom
application=/usr/bin/mpg123 -q -s -m -r 48000 -b 512 -@ http://IP:PORT
format=g719

Sorry for being so tiring but i'm new to this... :?

Thank you!
burteaga
Oldsterisk
 
Posts: 50
Joined: Fri Dec 16, 2011 1:21 am

Re: Streaming moh from VLC

Postby thor » Wed Dec 21, 2011 3:34 pm

the format= specification must match the output from the program specified in application=
mpg123 can only do slin and g711(ulaw/alaw) so you can not use it to produce a g719 audio stream.

Note that asterisk10 adds support for higher bitrate slin codecs up to 192kHz:

https://wiki.asterisk.org/wiki/display/ ... io+Formats

It could be used to play higher bitrate music on hold after patching res_musiconhold.c as it still assumes
"8 samples per millisecond":

https://code.asterisk.org/code/browse/a ... true#to703

Keep in mind using higher bitrates is pointless when your end devices do not support it.
What is that you planning on listening to those streams on ?
thor
Oldsterisk
 
Posts: 238
Joined: Thu Mar 18, 2010 12:19 pm

Re: Streaming moh from VLC

Postby burteaga » Mon Dec 26, 2011 2:13 am

Thank you thor!
So, coming back to the first situation, does anybody know which format VLC outputs the audio captured from streaming? or just how to configure it?

At the moment I'm using asterisk 1.8.8.4, and of course, if my end devices (some specific modules) don't support the codecs it makes no sense turning the bitrate up... :wink:

Thank you!
burteaga
Oldsterisk
 
Posts: 50
Joined: Fri Dec 16, 2011 1:21 am

Re: Streaming moh from VLC

Postby thor » Mon Dec 26, 2011 3:59 am

I posted a howto in the documentation forum:


viewtopic.php?t=81088
thor
Oldsterisk
 
Posts: 238
Joined: Thu Mar 18, 2010 12:19 pm

Re: Streaming moh from VLC

Postby burteaga » Tue Dec 27, 2011 4:05 am

I get permission problems with that...
even if I chmod the vlc.sh file, it says permission denied at the asterisk CLI...
burteaga
Oldsterisk
 
Posts: 50
Joined: Fri Dec 16, 2011 1:21 am


Return to Asterisk Support

Who is online

Users browsing this forum: Google [Bot] and 1 guest