Stopping recordings on all legs

I’d like to use a feature code for stopping recordings. Things are quite easy when the call is received from the outside or just dialed from inside to outside, but it can go really crazy when there are blind and attended transfer going on. It ends I don’t know on which call leg is the recording started, so I cannot stop the recording on the right one.

I usually use the following features.conf

# => <DTMF_sequence>,[/],[,[,MOH_Class]]

FromOutsideStopMixMonitor => #0,peer/callee,Macro(pause-recording)
FromOutsideStartMixMonitor => #1,peer/callee,Macro(unpause-recording)

FromInsideStopMixMonitor => #0,self/caller,Macro(pause-recording)
FromInsideStartMixMonitor => #1,self/caller,Macro(unpause-recording)

So if the call is coming from inside, I use the “FromInside”, while if the call is coming from outside, I use the “FromOutside” in DYNAMIC_FEATURES.

I can use “both” for the ActivatedBy, but I want also to run the pause-recording on both channel legs because I do not know on which one the recording has been started. How can I do?

Here the macros used:

exten => s,1,NoOp(Stopping Recording - MIXMONITOR_FILENAME is ${MIXMONITOR_FILENAME})
exten => s,n,StopMixMonitor()

exten => s,1,NoOp(Resuming Recording - MIXMONITOR_FILENAME is ${MIXMONITOR_FILENAME})
exten => s,n,MixMonitor(${MIXMONITOR_FILENAME},ab)