Device and User mode - Finding the device for a user

I have a client (call centre) whoare using device & user mode. Yes, I know it’s unsupported & I can accept that. Most things are working properly but they have a need to use the ChanSpy functions to monitor agent’s calls. This works, if we use the DEVICE number and not the user. Unfortunately we need to use the user (extn.) numbers.

Does anyone know of a way to get this working - it seems to me it should be as simple as pointing ChanSpy to the device instead of the user but I can’t find a way to determine the logged-in device for a specific user.

Thoughts? Suggestions on a better way to achieve the same result (I’m open to dumping D&U if someone can pont tme to a suitable alternative).

Thanks,

Jim

For the benefit of anyone else trying to make this work, here’s how I eventually managed to get it going.

[ext-local-custom]

;listen-test
exten => _*222,1,Macro(user-callerid,)
exten => _*222,2,Authenticate(9713)
exten => _*222,3,Read(SPYNUM,agent-newlocation)
exten => _*222,4,Set(SPYDEV,${DB(DEVICE/${SPYNUM})})
exten => _*222,5,ChanSpy(SIP/${SPYDEV},q)
exten => _*222,6,Hangup

;whisper
exten => _*223,1,Macro(user-callerid,)
exten => _*223,n,Authenticate(9713)
exten => _*223,n,Read(SPYNUM,agent-newlocation)
exten => _*223,n,Set(SPYDEV,${DB(DEVICE/${SPYNUM})})
exten => _*223,n,ChanSpy(SIP/${SPYDEV},qw)
exten => _*223,n,Hangup

;barge
exten => _*224,1,Macro(user-callerid,)
exten => _*224,n,Authenticate(9713)
exten => _*224,n,Read(SPYNUM,agent-newlocation)
exten => _*224,n,Set(SPYDEV,${DB(DEVICE/${SPYNUM})})
exten => _*224,n,ChanSpy(SIP/${SPYDEV},qB)
exten => _*224,n,Hangup

There’s almost certainly a neater way to do it but this seems to work so the client’s happy!

Jim