Sip peer status


In order to check peer status on dialplan level im using: ${SIPPEER(${PEER})

My problem is that this status is not always reliable. For example Iphone clients are closing sockets when phone is locked (unregister message is not sent to the server), In such case SIPPEER is showing that client is available on IP XXX, but tcp connection with this client was closed.

Can i somehow (on dialplan level) check whather client’s socket was closed and because of this this client is no longer available?

Im using chan_sip

Best regards, KB