Refer-to / gotoif

User1 on Asterisk calls user2, forwarded off PBX to an external sip Voice Mail application.

User1 presses a Key to transfer to a DN, that is not on Asterisk.

The REFER transfer comes in to the Sip External context of the extensions.conf, and asterisk only looks at the extension in the refer-to uri in the Header. I am looking for a way that I can either dial the entire refer-to address, or setup a gotoif that branches based on the IP address in the refer-to uri.

A list of the Predefined Varialbes does not seem to have what I need.