Monitor extension status

Is there a way i can get extensions status to log or maybe to mysql table or to a file?
I want to check periodically or on demand extensions status, who is online who is offline…
I tried to search through asterisk’s mysql tables for some kind
information about currect location of extension such as
[email protected]:port’ but i cant find such information
Any suggestions?

This is trivial to do with PHP on the PBX. This block of PHP code will do it:

<?php // include FreePBX bootstrap, requires FreePBX 2.9+ if ([email protected]_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) { include_once('/etc/asterisk/freepbx.conf'); } $state = $astman->ExtensionState('445', 'from-internal'); echo $state['Status']; The above will output a status of 0 (zero) if the line is free, 1 if in-use, 2 if DND, etc. Read more about the FreePBX bootstrap on this page:

The formatting above is all messed up and I can’t edit. :frowning: