asterisk-hass-addons icon indicating copy to clipboard operation
asterisk-hass-addons copied to clipboard

Custom wait music for parking

Open stefanschoemaker opened this issue 2 years ago • 9 comments

It would be nice to be able to edit the music what is played when parking a call.

stefanschoemaker avatar Mar 11 '22 14:03 stefanschoemaker

In /config/asterisk/musiconhold.conf you will find the config file for this. Just adjust it to your own needs. This even supports a playlist mode with HTTP(S) based URL access to get the sound files from.

In res_parking.conf you can find the MOH class that is to be used. Default is: parkedmusicclass = default

"default" is specified in musiconhold.conf as the default MOH music which is played from the "moh" dir in the container.

nanosonde avatar Mar 11 '22 16:03 nanosonde

@stefanschoemaker if @nanosonde's suggestion does not solve your problem, please let us know.

felipecrs avatar Mar 11 '22 22:03 felipecrs

While you can always copy the music files into the config folder, this might not be nice as there is already a folder dedicated to media. @felipecrs So maybe we should map the media folder into the docker container as well in config.yaml?

nanosonde avatar Mar 12 '22 16:03 nanosonde

Awesome, I agree! @TECH7Fox do you too?

felipecrs avatar Mar 12 '22 19:03 felipecrs

It's harmless to map /media as we the addon won't create any files there by default anyway.

felipecrs avatar Mar 13 '22 02:03 felipecrs

It's harmless to map /media as we the addon won't create any files there by default anyway.

That is the question. The asterisk docker build also includes downloading all the sound files incl. default MOH music. Maybe we should keep this. It would also shrink the docker image size.

What I could image is that it would be nice to mount the media folder RW and let the asterisk.sh startup script check in the media folder if there is an "asterisk" folder. If it is not there, it could download and install the default asterisk sound files. That way we don't have the sound files in the docker images. Currently they are default ENGLISH anyway. Maybe people want to change and play with the sound files. So they would be able to do so by exchanging them in the media folder.

nanosonde avatar Mar 13 '22 09:03 nanosonde

Sound great! Let's do that. :)

TECH7Fox avatar Mar 13 '22 10:03 TECH7Fox

I also find it a very cool idea!

felipecrs avatar Mar 13 '22 17:03 felipecrs

The sound files are in /var/lib/asterisk/ in moh en sounds/<language>.

Should we have them both in /media/asterisk/? Or do you guys have another idea?

TECH7Fox avatar Apr 23 '22 17:04 TECH7Fox

I would say /media/asterisk/moh/sounds/<language> and /media/asterisk/sounds/sounds/<language> to keep the hierarchy as close as from Asterisk itself.

By the way, it would be nice to support downloading multiple languages. For example, I would like both English and Portuguese.

And just to summarize, if I understood well:

The language would only be downloaded if there isn't yet a folder for it, or the folder is empty.

felipecrs avatar Mar 21 '23 00:03 felipecrs

I have a question: can we simply download all sounds from https://www.asterisksounds.org, even the English ones (i.e. totally ignore core sounds)?

felipecrs avatar Mar 21 '23 00:03 felipecrs

I would say /media/asterisk/moh/sounds/ and /media/asterisk/sounds/sounds/ to keep the hierarchy as close as from Asterisk itself.

Can't we better have /media/asterisk/moh and /media/asterisk/sounds/<language>? Music on hold doesn't have to be langauge specific.

Should we add a automatic language download? It's probably a one time thing, and how would we make the config for that? And while still allowing users to add their own files.

So only the default sounds would be included like now. But what if other sounds get's added by a Asterisk update? A default and custom folder would take a lot more space.

TECH7Fox avatar Mar 21 '23 00:03 TECH7Fox

I'm working on this. Let me push my first draft and we continue discussing there.

felipecrs avatar Mar 21 '23 01:03 felipecrs

As housekeeping, I'm closing this issue in favor of #226 (released in 3.2.0).

  1. You can set custom sounds as you want, and refer to files in /media (as suggested by @nanosonde)
  2. The add-on is now capable of downloading language sounds automatically to /media

Notes:

  1. moh are still included in the image: they are not language-based, so I don't think there would be any usefulness of removing them from the image. They would need to be otherwise downloaded on add-on startup anyway, which means no space would be saved (except that it would make add-on upgrades slightly faster). I don't think it's worth implementing this.
  2. en core sounds are still included in the image: I did some search and realized that downloading the core sounds isn't as simple as 123. The Asterisk scripts to download these sounds relies on the Asterisk source code, make, autoconf and several other tools that we strip out from the image to make it smaller. If we go that route we would be exchanging size from the EN core sounds in favor of the tools needed to download them again. I honestly don't think it is worth the compromise.

If you disagree, please open a separate issue for the item you would like implemented.

felipecrs avatar Mar 21 '23 14:03 felipecrs