Ejabberd Integration with Asterisk

I am trying to figure out if it is possible to use Ejabberd with Asterisk in a multitenant environment.

I want to use Asterisk as a PBX(obviously) and use Ejabberd as my IM chatting. When a phone user on Asterisk is called or on a phone I want that user, where ever that user is a Buddy, to show up as On Phone.

I know there is the following module for ejabberd
but there doesn’t seem to be a lot of documentation or examples on how to set this up or if this will allow me to do what I want to do.

Any help on this?

Have you found a solution for this since then?