Read a custom parameter sent in registration request for later use

I am using Asterisk 15.5.
It is possible to read and save a custom parameter sent in the sip registration request to be used at a later time?
I want to send a custom flag while registering a session with Asterisk which I need to read before executing incoming call in the dialplan or ARI and just wanted to know if this is possible?

Nope. You can’t touch or parse the REGISTER requests.

SIP header function just read the INVITE request parameters, so tecnilcally you cant do what you want. an idea is use the call back extension parameter to send your custom value and then get such value using AMI ManagerEvent_Registry it should be on the domain portion, I havent test it,