The Monitor dialplan application and module in Asterisk have been around for quite some time, since even before I was part of the project. It has since been replaced by the MixMonitor dialplan application and module and will be removed as of Asterisk 21. Let’s take a look at the differences between the two!
A core difference between the two is that Monitor pushes the responsibility for mixing the inbound and outbound audio to the user. You have to invoke an outside application or script which then merges and mixes the two audio files. There is no option for doing this inside of Asterisk.
MixMonitor on the other hand, as the name suggests, allows this to occur within Asterisk. This is in fact the default behavior. This is not the ONLY behavior however. You can still have it write the audio to two separate files and then mix it externally. This is a common complaint I’ve seen of MixMonitor, when in fact it supports the Monitor behavior. Check out the available options to MixMonitor to see.
Another key difference between Monitor and MixMonitor is the underlying implementation. The Monitor application, due to its age, is actually tightly integrated into the Asterisk core. As each audio frame passes through the core it also passes through the Monitor logic.
MixMonitor leverages an API used by other things in order to get the audio. It’s the same API that powers ChanSpy called audiohooks. It’s a defined mechanism for inserting hooks into the audio path.
Asynchronous / Synchronous
The final major difference is that the Monitor application is synchronous which can have an impact on flowing audio. As the audio flows through the core it is written to the appropriate file, within the same path that the audio is flowing. This means that the I/O performance of the system can actually have an impact on the audio you hear.
MixMonitor on the other hand works in an asynchronous fashion. Audio flows through the core and a copy of it is queued up for another thread to handle at its own pace. Any I/O issues don’t impact the flow of audio that you hear.
I hope this sheds some light on these two applications as you hopefully move from Monitor to MixMonitor, if you haven’t already done so!