MOH streaming for wideband g722/slin16

Any ideas how to stream 16 kHz audio from shoutcast ? I tried mpg123 -r 16000 with type slin16 but the results were terrible.
I would like to use the full potential of my g722 phone.

The problem is 8kHz is hardcoded in res_musiconhold. Here is a little patch:

---  asterisk-   2011-02-01 09:02:09.000000000 -0800
+++ asterisk-     2011-11-26 18:10:24.000000000 -0800
@@ -634,7 +634,7 @@
        if ((strncasecmp(class->dir, "http://", 7) && strcasecmp(class->dir, "nodir")) && AST_LIST_EMPTY(&class->members))
        /* Read mp3 audio */
-       len = ast_codec_get_len(class->format, res);
+       len = ast_codec_get_len(class->format, res * (ast_format_rate(class->format) / 8000 )); // some codecs do not use 8khZ
        if ((res2 = read(class->srcfd, sbuf, len)) != len) {
                if (!res2) {

Now you can stream high quality MoH using config like this:

[SmoothJazz] mode=custom application=/usr/bin/mpg123 -q -s -m -r 16000 -b 512 -@ format=slin16

Some links for reference: … 49119.html

Patches posted here will never be included in the official code.

For them to be accepted, you must sign the electronic licence grant on and you must attach the patch, marking it as a code submission.

For bug fixes, it must be against a supported version or trunk.

For new features, it must be against trunk.

Posting here can poison the normal submission process, as only you are allowed to submit it formally and there could be a suspicion that your account represents a third party who copied it from here.