If custom_popup is calling an Asterisk connected service (I've been playing with tomcat and Asterisk-Java), that process can find out everything about the inbound call (e.g. if it is a transfer, what is the originating caller id). With the extensions one can infer the channel, but getting it explicitly would be great.
Tx,
Ted