Stopping mixmonitor by agents using touch #

Hello,

I have a purpose below:

When the agent in queue pick up the call, the caller says that he does not want that his call will be recorded, So the agent put the touch “#” to stopping the recording.

In my dialplan i have:

[queue1] ;support
exten => _9XXXX,1,Answer()
same=>n,MixMonitor(queuetest1.wav,b)
same => n,Queue(support,t)
same=>n,StopMixMonitor()
same => n,Hangup()
In this way, the call is always recording when the bridge is created between caller and the agent.
So my question is:

How should I put into my dialplan and then when agent put “#”, the function stopmixmonitor will be called immediatly

You might be able to do it with DYNAMIC_FEATURES per /etc/asterisk/features.conf file.

That or reverse the process – only start recording if user presses key (by using the ‘x’ option to Queue() application.)