try
{
SipSession session = subscription.getSession();
if (session.isValid())
{
SipServletRequest notify = session.createRequest(Constants.NOTIFY);
notify.addHeader(Constants.EVENT, getName());
String s = subscription.getState().getName();
if (subscription.getState() == Subscription.State.ACTIVE
|| subscription.getState() == Subscription.State.PENDING)