Probably using Custom device state. When Agent answers the call on mobile, set custom device state to INUSE and when call ends set it back to NOT_INUSE.
thanks i have done that but the issue is something else whenever I give any call to agent’s phone i have to check whether agent’s phone is having any live channel with my asterisk server or not because sometime call gets disconnect from mobile but channel does not get cleared