this is wrong.
if you are trying to lookup the user so you can get their one or more devices, you would have to go to the AMPUSER object, get the one or more devices, then go to the device object for each of those devices and get the dial string which will provide the proper channel technology and native device information. (and if you have multiple devices logged into the same user, you would have to deal with that which is maybe looking for the active channel to choose which one, and if there are more then 1, then make some decision?)
Closing the ticket since the example is misleading to others, if you want to update it so it is correct I'll be glad to re-open it in case it is of interest to others. As far as ChanSpy in general, it does need some rewriting mostly around ACLs and easier usage although it is another type of feature where environments that it is important are better served with visual tools such as iSymphony which has the capability to choose specific calls to spy on.