Call Recording for Both Inbound and Outbound

I can record incoming call to an extension or a group of extensions by using the following dial plan rules.

exten => 1898,1,Set(FILENAME=${STRFTIME(${EPOCH},,%Y_%m_%d-%H_%M_%S)}-from-${CALLERID(num)}-to-${EXTEN})
same => n,MixMonitor(${FILENAME}.wav,b)
same => n,Dial(SIP/${EXTEN}
same => n,Hangup

So in this case, say 1800 calling to 1898 then the call will be recorded but if 1898 call any other extension the call won’t be recorded.

I want to record both incoming call to a extension [example: 1898] and outgoing call from that extension [example: 1898]. Please note that i don’t want to enable call recording features for all extension.

How can i do that? Can anybody help me?

You will need to include code in every extension that matches the caller ID, put device 1898 in a context that turns on recording before doing normal extension processing.