How can I set the moh in asterisk to play continuously and not start the file each time?
You can have a stream running in the background
I don’t see
streamplayer in my /usr/bin/ directory
streamplayer was depreciated some time ago.
This can be done with streaming your moh content, although it’s not a simple procedure. You will need to set up something like icecast as well as software to feed a stream to icecast and a client to stream in to Asterisk.
I’ve written up what I know here. I run this on my Asterisk myself.
In short; what do I need to put in the musiconhold.conf? I have a directory with 8khz mono wav files and I want to play it continuously
Asterisk will not do this on it’s own. You need external software.
If you could chop your stream into several files MOH can pick the one to begin with at random and thus seam more like a stream. This won’t be of much use if your MOH is one long podcast but it works well if you have several files.
This is literally the first example in /etc/asterisk/musiconhold.conf file:
[default] mode=files directory=moh
Is that what you are looking for?
I want it should play at the same position in the file for all callers
You could add:
That would play the files in the same alphabetical order for all users. Each time a new user enters MusicOnHold, they would start at the top of the sorted list of file names in the directory you choose.
mode=playlist entry=/path/to/file1.wav entry=/path/to/file2.wav entry=/some/other/path/to/another/file0.wav
That would play the the files in the order you specify (in this case: file1, file2, file0).
I don’t want it should start at the beginning of the file each time
I think what the OP specifically wants is what I call “classic hold”, which mimics the old systems where the MOH was physically fed to the system rather than just starting playback from the beginning each time you put someone into it. Even if you randomize the files, there’s still the effect of playback starting at the beginning each and every time.
As I stated…you can’t do that with Asterisk directly. You need to create a stream that is then fed into MOH using an application. You can do it all on the same system running your PBX; but you need to put some pieces together to do it. There is no “single line configuration” that does this. Even if you did something like making a node in the filesystem that you “played” data in to; you’d need a second application to play in to that node. I’ve done this as a middle-man for mplayer since it doesn’t support file-pipes; I don’t know how Asterisk would behave. It’s been more reliable to stream to icecast using ices and then using ogg123 to stream in to Asterisk.
This sounds to me like a job for a server-type process, accepting connections via FastAGI. I see that there is a “stream file” AGI command; could this be used to connect to a pipe instead? (A new pipe being created for each connection.) Then the server process can take care of feeding audio in sync to all current connections.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.