I’d think that what you want to do might be best done outside of Asterisk. If you’re working with SIP, I’d suggest packet capture tools.
I’d suggest you take a look at Voipmonitor, it may have what you need in the community version. It’s built for monitoring SIP/VoIP traffic.
Pretty inexpensive to license the reporting tool as well, if needed.
Also, you may need to have a switch/router that supports port mirroring.