Package org.cipango.kaleo.location.event

Examples of org.cipango.kaleo.location.event.RegResource


        subscribe.getApplicationSession().invalidate();
        return;
      }
    }
   
    RegResource regResource = _regEventPackage.get(uri);
   
    try
    {
      Subscription subscription = null;
     
      if (expires == 0)
      {
        subscription = regResource.removeSubscription(session.getId());
       
        if (subscription == null)
        {
          subscription = new Subscription(regResource, session, -1);
        }
        else
        {
          subscription.setExpirationTime(System.currentTimeMillis());
          if (_log.isDebugEnabled())
            _log.debug("removed reg subscription {} to registration resource {}",
              subscription.getSession().getId(), regResource.getUri());
       
        subscription.setState(Subscription.State.TERMINATED, Reason.TIMEOUT);
      }
      else
      {
        long now = System.currentTimeMillis();
       
        subscription = regResource.getSubscription(session.getId());
   
        if (subscription == null)
        {
          subscription = new Subscription(regResource, session, now + expires*1000);
          subscription.setState(State.ACTIVE, Reason.SUBSCRIBE);
          regResource.addSubscription(subscription);
         
          session.setAttribute(Constants.SUBSCRIPTION_ATTRIBUTE, uri);
         
          if (_log.isDebugEnabled())
            _log.debug("added reg subscription {} to registration resource {}",
                subscription.getSession().getId(), regResource.getUri());
        }
        else
        {
          subscription.setExpirationTime(now + expires * 1000);
         
          if (_log.isDebugEnabled())
            _log.debug("refreshed reg subscription {} to registration resource {}",
                subscription.getSession().getId(), regResource.getUri());
        }
      }
     
      int code = (subscription.getState() != Subscription.State.PENDING) ?
          SipServletResponse.SC_OK : SipServletResponse.SC_ACCEPTED;
View Full Code Here

TOP

Related Classes of org.cipango.kaleo.location.event.RegResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.