Openfire/asterisk: knowing onchat/onphone status

Good day everyone,

with openfire’s Asterisk-IM plugin is possible to know when the operator is on phone and when a user looks for an operator, openfire exclude him by the queue.

I would like to obtain the same result on Asterisk side: know if the operator is on chat, and set him not available for incoming calls in that case.

Anyone know if it is possible? Evenly, how?

Thanks in advance