User-and-Device Mode: How to determine user's current device via CLI?


We are running FreePBX distro in user-and-device mode on FreePBX Distro v2.11.0.27 with Asterisk 11. I am looking for a CLI command I can use for an AGI script which will determine a given Agent’s (user’s) current deviceID.

For example, Agent 46600 (userID 46600) is logged into a hotdesk phone with the deviceID of 401000. What CLI command do I issue to get FreePBX/Asterisk to tell me the deviceID if I only know the userID?