Recording the announcement using Mixmonitor

Hi we are using Asterisk 15.4, we are using MixMonitor to record the call. I am also playing an announcement “We are recording this call” to the user using A(x) in Dial function. If user rises a concern we are stoping the recording using dynamic features from features.conf.

  1. Announcement is not being recorded in the file. How can I make sure the announcement I played to come in the recorded file. Is there any changes needed in my dialplan, or Is there any other way I can record the announcement. This is very important for our legal concerns.

Here is my dialplan:

exten => _+1NXXNXXXXXX,1,Set(foo=${PJSIP_HEADER(read,Do-Record)})

same => n,Set(__DYNAMIC_FEATURES=record_stop)
;same => n,GotoIf(["{foo}" != “true”]?test,ext,1)
same => n,MixMonitor(recordingTest.wav, i(__MIXMONID))
same => n,Dial(PJSIP/${EXTEN}@bandwidth,30,aA(record-per))