Dialplan issues for prepending the extension in parking timeouts

I wanted to have the extension prepended to the caller ID when a parked call times out and sends it back to the original extension that parked it or the alternate destination. I set the Auto CallerID Prepend selection accordingly but noticed that it always prepended UNKNOWN instead. I couldn’t figure out why it wouldn’t work so I dug into the dialplan within extensions_additional.conf to see what was going on. I added some Verbose commands so that I could debug it as shown below:

exten => s,1,Set(UEXTEN=UNKNOWN)
exten => s,n,Set(UNAME=UNKNOWN)
exten => s,n,Set(DEVS=${DB_KEYS(DEVICE)})
exten => s,n,While($["${SET(DEV=${POP(DEVS)})}" != ""])
exten => s,n,Verbose(2, ${DB(DEVICE/${DEV}/dial)} compares to {CUT(CHANNEL(name),-,1)})
exten => s,n,GotoIf($["${DB(DEVICE/${DEV}/dial)}" = "${CUT(CHANNEL(name),-,1)}"]?found)

Once found, it updates UEXTEN with the matching extension. DEVS is a list of extensions (eg. - 301,302,303,304) and gets the associated entry for the extension’s channel. However, CHANNEL(name) is always returning a channel for the inbound call’s trunk meaning this will never match. I don’t see how this feature would ever work yet I don’t find anything in my searches that even mention people using the feature. Is there a bug in the default parking lot dialplan generation or am I missing something?