Appending SIP diversion to callerid(num)

Hi all. I’m an Asterisk newbie and I’ve been given a project.
I am creating a standalone voicemail server, connected to a mobile phone network, using Asterisk 13.
The mobile core will connect to Asterisk via SIP.
The problem I have is that for our subscribers retrieving their voicemail messages from their mailboxes, they need to be identified by their callerid, and calls will be diverted.
Therefore, I need to extract the original callerid from the SIP diversion header and append it to the callerid(num). If that’s the best method of doing this.
Can anyone offer any help or direction…please!?

TIA