Package javax.servlet.sip

Examples of javax.servlet.sip.SipApplicationSession


    @Override
    protected void doAck(SipServletRequest ack) throws ServletException,
            IOException {
        log("doAck");
        SipApplicationSession sipApplicationSession =
            ack.getApplicationSession();
        Player player = (Player)sipApplicationSession.getAttribute(
                Player.class.getName());
        player.play();
    }
View Full Code Here


    @Override
    protected void doBye(SipServletRequest bye) throws ServletException,
            IOException {
        log("doBye");
        bye.createResponse(SipServletResponse.SC_OK).send();
        SipApplicationSession sipApplicationSession =
            bye.getApplicationSession();
        Player player = (Player)sipApplicationSession.getAttribute(
                Player.class.getName());
        player.stop();
        ServletContext servletContext = getServletContext();
        Map<Integer, Recorder> recorders = (Map<Integer, Recorder>)
            servletContext.getAttribute(Recorder.class.getName());
        Recorder recorder = recorders.get(player.getLocalPort());
        recorder.stop();
        recorders.remove(player.getLocalPort());
        bye.getSession().invalidate();
        sipApplicationSession.invalidate();
    }
View Full Code Here

    @Override
    protected void doAck(SipServletRequest ack) throws ServletException,
            IOException {
        log("doAck");
        SipApplicationSession sipApplicationSession =
            ack.getApplicationSession();
        DtmfSession dtmfSession = (DtmfSession)
            sipApplicationSession.getAttribute(DtmfSession.class.getName());
        dtmfSession.start();
    }
View Full Code Here

    @Override
    protected void doBye(SipServletRequest bye) throws ServletException,
            IOException {
        log("doBye");
        bye.createResponse(SipServletResponse.SC_OK).send();
        SipApplicationSession sipApplicationSession =
            bye.getApplicationSession();
        DtmfSession dtmfSession = (DtmfSession)
            sipApplicationSession.getAttribute(DtmfSession.class.getName());
        dtmfSession.stop();
        bye.getSession().invalidate();
        sipApplicationSession.invalidate();
    }
View Full Code Here

    _calls = new ArrayList<SipApplicationSession>();
  }
   
  public void call(String from, String to) throws ServletException, IOException
  {
    SipApplicationSession session = _sipFactory.createApplicationSession();
    synchronized (_calls)
    {
      _calls.add(session);
   
    SipServletRequest request = _sipFactory.createRequest(session, "INVITE", from, to);
View Full Code Here

    synchronized (_calls)
    {
      Iterator<SipApplicationSession> it = _calls.iterator();
      while (it.hasNext())
      {
        SipApplicationSession session = (SipApplicationSession) it.next();
        if (session.isValid())
          calls.add(new Call(session, _b2bHelper));
        else
        {
          log("Session " + session + " is not valid, so remove it");
          it.remove();
View Full Code Here

    public SipServletRequest createInvite()
    {
      if (_session != null)
        throw new IllegalStateException();
     
      SipApplicationSession appSession = _factory.createApplicationSession();
      SipServletRequest invite = _factory.createRequest(
          appSession,
          SipMethods.INVITE,
          _localAddress,
          _remoteAddress);
View Full Code Here

    message.getSession().setAttribute(MessageHandler.class.getName(), handler);
  }
 
  public SipServletRequest createRequest(String method, Address destination)
  {
    SipApplicationSession appSession = _factory.createApplicationSession();
    SipServletRequest request = _factory.createRequest(appSession, method, _localAddress, destination);
    request.addHeader(SipHeaders.USER_AGENT, "Cipango-Client");
    return request;
  }
View Full Code Here

        }

        // Add to active cache
        SipSessionManager mgr = getSipSessionManager();
        if (mgr != null) {
            SipApplicationSession sas = mgr.addSipApplicationSession(this);
            if (sas != null) {
                // While this thread has been in the process of loading the
                // requested sas, and is now trying to activate it, another
                // thread has also loaded the same sas, and has already
                // added it to the active cache. Abort activation.
View Full Code Here

        return false;
      }
      if(!sipSession.isValid()){
        return false;
      }
      SipApplicationSession sipApplicationSession = getApplicationSession();
      if(sipApplicationSession==null){
        return false;
      }
      return sipApplicationSession.isValid();
  }
View Full Code Here

TOP

Related Classes of javax.servlet.sip.SipApplicationSession

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.