Set asterisk variable systemname to dns name of server

I’m trying to figure out a way to automatically set the variable ${SYSTEMNAME} in asterisk.conf to the DNS name of the server.

To be clear, here is the line to edit:

systemname = “a_string”

Where “a_string” is a line of code that determines the DNS name of the server.

What I am ultimately trying to accomplish is in voicemail.conf, setting the voicemail notification to provide the actual server which the voicemail is originating.

Is it even possible to use the variable ${SYSTEMNAME} in voicemail.conf?

Thanks!