Get callers Caller ID in Queue gosub

How can I get the caller’s caller ID information in the gosub of a Queue() assignment? (Macro would also be OK.) My current code is below. I’m guessing that the MMCID is in the callers channel, while the gosub executes in the members channel, so that variable is not available.

[code][queues]
exten =>sales,1,Verbose(2,${CALLERID(all)} entering the sales queue)
same =>n,Set(MMCID=${CALLERID(all)})
same =>n,Verbose(2,mmcid=${MMCID})
same =>n,Queue(sales,subQueueConnected)
same =>n,Hangup()

[subQueueConnected]
exten =>s,1,NoOp()
same =>n,Verbose(2, connected to queue gosub interface ${MEMBERINTERFACE} name ${MEMBERNAME} caller ${MMCID} )
same =>n,DumpChan()
same =>n,Return()
[/code]

Set an inheritable (_ prefix) variable in the main dialplan.

Also, there is probably a channel variable set pointing back to the initiating channel. You may be able to use that and the import function, but I’m not sure whether functions (CALLERID) are allowed in that context.

The inheritable variable works, as does function CONNECTEDLINE. Both are demonstrated in the code below.

[code][queues]
exten =>sales,1,Verbose(2,${CALLERID(all)} entering the sales queue)
same =>n,Set(_MMCID=${CALLERID(all)})
same =>n,Verbose(2,mmcid=${MMCID})
same =>n,Queue(sales,subQueueConnected)
same =>n,Hangup()

[subQueueConnected]
exten =>s,1,NoOp()
same =>n,Verbose(2, connected to queue gosub interface ${MEMBERINTERFACE} name ${MEMBERNAME} caller ${MMCID} )
same =>n,Verbose(2, CONNECTEDLINE(name)=${CONNECTEDLINE(name)} )
same =>n,Verbose(2, CONNECTEDLINE(num)=${CONNECTEDLINE(num)} )
;same =>n,DumpChan()
same =>n,Return()
[/code]