Asterisk 11 - Stopmixmonitor issues

Hi Asterisk world…

I have asterisk 11 running on an ubuntu system and I am having problems getting the desired behaviour for mixmonitor recordings.

I have queues set up and working fine, mixmonitor is called just before queue in the dialplan.

I have features set up that allow the users to press #5 and #6 to stop and restart the recordings, these features work when the key sequences are pressed, I can see this is the cli.

What doesn’t work as expected is calling StopMixMonitor(), the recording continues. I have tried several different ways of passing the mixmonitor id to stopmixmonitor but I cannot get the recording to stop.

I tried storing the mixmonitor id and the original channel name in the channel variables:
MixMonitor(${RECORDING_FILENAME}.wav,bi(__MIXMONID));
or
MixMonitor(${RECORDING_FILENAME}.wav,bi(__MIXMONID));
Set(__MIXMONCHANNEL=${CHANNEL});

but this then doesn’t work:
[macro-pause-recording]
exten => s,1,Verbose(Stopping Recording ${RECORDING_FILENAME} mixmonid ${MIXMONID})
same => n,DumpChan()
same => n,StopMixMonitor(${MIXMONID}) ; this doesn’t work…
same => n,StopMixMonitor(${MIXMONCHANNEL}) ; nor does this…
same => n,Verbose(macro-pause-recording done)

Please could someone shed any light on the correct way to stop mixmonitor?

Many thanks,
Ed

From the docs for StopMixMonitor:

In other words: StopMixMonitor will only stop a Monitoring started at the current channel.
If MixMonitor is started outside the queue it is started at the callers Channel while Your interruption command comes from the callees Channel which doesn’t have any MixMonitor started thus it can’t stop it.
I’m not completely sure, but You may try setting AUDIOHOOK_INHERIT before calling StartMixMonitor.
The alternative approach is to use the Monitoring-function within the Queue-apllication itself (see queues.conf). To be honest: I never tried this in combination with callee-induced key-sequences for interruption and restart …