Fetch extensions

Hello! I need to fetch extension status(online/offline) like in reports->asterisk info. But graphql doesn`t provide this thing. Is it possible to do with rest api or ami?

I assume online means registered. See DEVICE_STATE - Asterisk Documentation and Device State - Asterisk Documentation

You can generally use dialplan functions wherever dialplan variables can be accessed.