I can think of a few mechanisms, depending on use-case/scenario:
- TAPI/JTAPI these APIs provide real-time call and phone events, including de-registration. Complexity and scalability are considerations, as continuously monitoring a large number of phones can have performance implications
https://developer.cisco.com/site/jtapi/
https://developer.cisco.com/site/tapi/
- Syslog I seem to recall that there is a specific syslog event generated when a phone de-registers. You may need to experiment and look at a few events to find the best way to identify the event and device
- SNMP there is a dynamic table in the CUCM SNMP MIB that provides IP address and registration info for all phones. Walking this periodically is a fairly slow/expensive process - there is an accompanying table of just phones that have changed registration status recently that would be better for polling (once a minute or maybe 15 sec)
- Serviceability SOAP Risport API this SOAP API provides info analogous to the SNMP info - it does not offer a 'recently changed' collection, though it does provide a 'state' mechanism to detect if any phones have changed registration status since the last query
https://developer.cisco.com/docs/sxml/#!risport70-api-reference