Codota Logo
SipSession.getAttribute
Code IndexAdd Codota to your IDE (free)

How to use
getAttribute
method
in
javax.servlet.sip.SipSession

Best Java code snippets using javax.servlet.sip.SipSession.getAttribute (Showing top 15 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
origin: org.restcomm/restcomm-connect.telephony.api

public static SipServletResponse getLinkedResponse(SipServletMessage message) {
  SipSession linkedB2BUASession = getLinkedSession(message);
  // if this is an ACK that belongs to a B2BUA session, then we proxy it to the other client
  if (linkedB2BUASession != null) {
    SipServletResponse response = (SipServletResponse) linkedB2BUASession.getAttribute(B2BUA_LAST_RESPONSE);
    return response;
  }
  return null;
}
origin: org.restcomm/restcomm-connect.telephony.api

public static SipServletRequest getLinkedRequest(SipServletMessage message) {
  SipSession linkedB2BUASession = getLinkedSession(message);
  if (linkedB2BUASession != null) {
    SipServletRequest linkedRequest = (SipServletRequest) linkedB2BUASession.getAttribute(B2BUA_LAST_REQUEST);
    return linkedRequest;
  }
  return null;
}
origin: org.mobicents.servlet.sip.examples/shopping-demo-business-jsr309

  public void onEvent(SdpPortManagerEvent arg0) {
    if((Boolean.TRUE).equals(inviteRequest.getSession().getAttribute("playAnnouncement"))) {
      NetworkConnection connection = (NetworkConnection) inviteRequest.getSession().getAttribute("connection");
      MediaGroup mg =(MediaGroup)inviteRequest.getSession().getAttribute("mediaGroup");
      try {
        playAnnouncement(mg, inviteRequest.getSession(), (String)inviteRequest.getSession().getAttribute("audioFilePath"));
      }catch (Exception e) {
        logger.error(e);
      }

    }

  }
}
origin: org.restcomm/restcomm-connect.telephony.api

public static SipSession getLinkedSession(SipServletMessage message) {
  SipSession sipSession = null;
  if (message.getSession().isValid()) {
    sipSession = (SipSession) message.getSession().getAttribute(B2BUA_LINKED_SESSION);
  }
  if (sipSession == null) {
    if(logger.isInfoEnabled()) {
      logger.info("SIP SESSION is NULL");
    }
  }
  return sipSession;
}
origin: org.restcomm/restcomm-connect.telephony.api

  private static void sendCallInfoStreamEvent(ActorSystem system, SipServletMessage message, CallStateChanged.State state) {
    SipSession session = message.getSession();
    Object sid = session.getAttribute(CDR_SID);
    if (sid != null) {
      CallInfo callInfo = new CallInfo(
          (Sid) sid,
          (Sid) session.getAttribute(CDR_ACCOUNT_SID),
          state,
          null,
          (String) session.getAttribute(CDR_DIRECTION),
          null,
          null,
          null,
          (String) session.getAttribute(CDR_FROM),
          (String) session.getAttribute(CDR_TO),
          null, null, false, false, false, null, null
      );
      system.eventStream().publish(new CallInfoStreamEvent(callInfo));
    }
  }
}
origin: org.mobicents.servlet.sip.examples/shopping-demo-business-jsr309

  public static void playFileInResponseToDTMFInfo(SipSession session,
      String audioFile) {
    logger.info("playing " + audioFile + " in response to DTMF");
    MediaGroup mg = (MediaGroup) session.getAttribute("mediaGroup");

    // Let us request for Announcement Complete event or Failure
    // in case if it happens

    try {
      mg.getPlayer().play(URI.create(audioFile), null, null);
    } catch (MsControlException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    session.setAttribute("DTMFSession", DTMFListener.DTMF_SESSION_STOPPED);
    logger.info("played " + audioFile + " in response to DTMF");
  }
}
origin: org.mobicents.servlet.sip.examples/shopping-demo-business-jsr309

  public void onEvent(SignalDetectorEvent arg0) {
    String signal = arg0.getSignalString();
    if(session.getAttribute("orderApproval") != null) {
      if(session.getAttribute("adminApproval") != null) {
        logger.info("admin approval in progress.");
        DTMFUtils.adminApproval(session, signal, pathToAudioDirectory);
      } else {
        logger.info("customer approval in progress.");
        DTMFUtils.orderApproval(session, signal, pathToAudioDirectory);
      }
    } else if(session.getAttribute("deliveryDate") != null) {
      logger.info("delivery date update in progress.");
      if(!DTMFUtils.updateDeliveryDate(session, signal)) {				
        try {
          mg.getSignalDetector().receiveSignals(1, null, null, null);
        } catch (MsControlException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
      }
    }        
  }
}
origin: org.mobicents.servlet.sip.examples/shopping-demo-business-jsr309

public static void adminApproval(SipSession session, String signal, String pathToAudioDirectory) {			
  
  if("1".equalsIgnoreCase(signal)) {
    // Order Approved
    logger.info("Order approved !");
    String audioFile = pathToAudioDirectory + "OrderApproved.wav";					
    
    playFileInResponseToDTMFInfo(session, audioFile);                    
  } else if("2".equalsIgnoreCase(signal)) {
    // Order Rejected
    logger.info("Order rejected !");
    String audioFile = pathToAudioDirectory + "OrderCancelled.wav";					
    
    playFileInResponseToDTMFInfo(session, audioFile);
  }
  MediaGroup mg = (MediaGroup)session.getAttribute("mediaGroup");
  try {
    mg.getPlayer().addListener(new EndCallWhenPlaybackCompletedListener(session));
  } catch (MsControlException e) {
    logger.error("Error", e);
  }
}
origin: org.mobicents.servlet.sip.examples/shopping-demo-business-jsr309

public static void orderApproval(SipSession session, String signal, String pathToAudioDirectory) {
  long orderId = (Long) session.getAttribute("orderId");
  MediaGroup mg = (MediaGroup)session.getAttribute("mediaGroup");
  try {
    mg.getPlayer().addListener(new EndCallWhenPlaybackCompletedListener(session));
origin: org.mobicents.servlet.sip.examples/shopping-demo-business-jsr309

String dateAndTime = (String) session.getAttribute("dateAndTime");
if(dateAndTime == null) {
  dateAndTime = "";
    InitialContext ctx = new InitialContext();
    OrderManager orderManager = (OrderManager) ctx.lookup("shopping-demo/OrderManagerBean/remote");
    orderManager.setDeliveryDate(session.getAttribute("orderId"), timeStamp);
  } catch (NamingException e) {
    logger.error("An exception occured while retrieving the EJB OrderManager",e);
    logger.info("Playing delivery date summary : " + "TTS:" + stringBuffer);
    MediaGroup mg = (MediaGroup) session.getAttribute("mediaGroup");
    mg.getPlayer().play(delieryDateSummary, null, null);
    mg.getPlayer().addListener(new EndCallWhenPlaybackCompletedListener(session));
origin: org.mobicents.servlet.sip.examples/shopping-demo-business-jsr309

public static void playAnnouncement(MediaGroup mg, SipSession sipSession, String pathToAudioDirectory) {
  try {
    java.net.URI uri = (java.net.URI) sipSession.getAttribute("speechUri");
    if(sipSession.getAttribute("orderApproval") != null) {
  
      logger.info("Playing confirmation announcement : " + uri);
      mg.getPlayer().play(uri, null, null);
      mg.getSignalDetector().receiveSignals(1, null, null, null);
      sipSession.setAttribute("DTMFSession", DTMFListener.DTMF_SESSION_STARTED);
      logger.info("Waiting for DTMF at the same time..");				
    } else if (sipSession.getAttribute("deliveryDate") != null) {			
      logger.info("Playing Delivery Date Announcement : " + uri);
      mg.getPlayer().play(uri, null, null);
      mg.getSignalDetector().receiveSignals(1, null, null, null);
      sipSession.setAttribute("DTMFSession", DTMFListener.DTMF_SESSION_STARTED);
      logger.info("Waiting for DTMF at the same time..");
    } else if (sipSession.getAttribute("shipping") != null) {			
      logger.info("Playing shipping announcement : " + uri);
      mg.getPlayer().play(uri, null, null);
      mg.getPlayer().addListener(new EndCallWhenPlaybackCompletedListener(sipSession));
      logger.info("shipping announcement played. tearing down the call");
    }        
  } catch (Exception e) {
    logger.error(e);
  }
}
origin: org.mobicents.servlet.sip.examples/shopping-demo-business-jsr309

public void onEvent(PlayerEvent event) {
  try {
    logger.info("ENDING CALL ");
    Player player = event.getSource();
    MediaGroup mg = player.getContainer();
    if (event.isSuccessful()
        && (PlayerEvent.PLAY_COMPLETED == event.getEventType())) {
      MediaSession session =(MediaSession)sipSession.getAttribute("mediaSession");
      session.release();
      Thread.sleep(1500);
      
      SipServletRequest byeRequest = sipSession.createRequest("BYE");				
      byeRequest.send();
      
    }
  }
  catch (Exception e) {
    logger.error("Error", e);
  }
}
origin: org.restcomm/restcomm-connect.telephony.api

public static void updateCDR(ActorSystem system, SipServletMessage message, CallStateChanged.State state) {
  CallDetailRecordsDao records = daoManager.getCallDetailRecordsDao();
  SipServletRequest request = null;
  // Update CallDetailRecord
  if (message instanceof SipServletResponse) {
    request = (SipServletRequest) getLinkedSession(message).getAttribute(B2BUA_LAST_REQUEST);
  } else if (message instanceof SipServletRequest) {
    request = (SipServletRequest) message;
  }
  CallDetailRecord callRecord = records.getCallDetailRecord((Sid) request.getSession().getAttribute(CDR_SID));
  if (callRecord != null) {
    if(logger.isInfoEnabled()) {
      logger.info("CDR found! Updating");
    }
    callRecord = callRecord.setStatus(state.name());
    final DateTime now = DateTime.now();
    callRecord = callRecord.setEndTime(now);
    int seconds;
    if (callRecord.getStartTime() != null) {
      seconds = (int) (DateTime.now().getMillis() - callRecord.getStartTime().getMillis()) / 1000;
    } else {
      seconds = 0;
    }
    callRecord = callRecord.setDuration(seconds);
    records.updateCallDetailRecord(callRecord);
    sendCallInfoStreamEvent(system, message, state);
  }
}
origin: org.restcomm/restcomm-connect.telephony.api

  SipServletRequest request = (SipServletRequest) getLinkedSession(response).getAttribute(B2BUA_LAST_REQUEST);
  CallDetailRecord callRecord = records.getCallDetailRecord((Sid) request.getSession().getAttribute(CDR_SID));
  response.getSession().setAttribute(B2BUA_LAST_RESPONSE, response);
SipServletRequest linkedRequest = (SipServletRequest) getLinkedSession(response).getAttribute(B2BUA_LAST_REQUEST);
SipServletResponse clonedResponse = linkedRequest.createResponse(response.getStatus());
SipURI originalURI = null;
CallDetailRecord callRecord = records.getCallDetailRecord((Sid) linkedRequest.getSession().getAttribute(CDR_SID));
Sid organizationSid = daoManager.getAccountsDao().getAccount(callRecord.getAccountSid()).getOrganizationSid();
origin: org.restcomm/restcomm-connect.telephony.api

Map<String,ArrayList<String>> extensionHeaders = (Map<String,ArrayList<String>>)incomingSession.getAttribute(EXTENSION_HEADERS);
addHeadersToMessage(outRequest, extensionHeaders, sipFactory);
outRequest.send();
javax.servlet.sipSipSessiongetAttribute

Javadoc

Returns the object bound with the specified name in this session, or null if no object is bound under the name.

Popular methods of SipSession

  • createRequest
    Returns a new request object. This method is used by user agents only. Note that this method must no
  • setAttribute
    Binds an object to this session, using the name specified. If an object of the same name is already
  • getApplicationSession
    Returns the application session with which this SipSession is associated.
  • getServletContext
    Returns the ServletContext to which this session belongs. By definition, there is one ServletContext
  • getState
    Returns the current SIP dialog state, which is one of INITIAL, EARLY, CONFIRMED, or TERMINATED. Thes
  • invalidate
    Invalidates this session and unbinds any objects bound to it. A session cannot be invalidate if it i
  • isValid
    Returns true if this SipSession is valid, false otherwise. The SipSession can be invalidated by call
  • setHandler
    Sets the handler for this SipSession. This method can be used to explicitly specify the name of the

Popular in Java

  • Making http post requests using okhttp
  • getApplicationContext (Context)
  • getSharedPreferences (Context)
  • getContentResolver (Context)
  • Kernel (java.awt.image)
  • BufferedInputStream (java.io)
    Wraps an existing InputStream and buffers the input. Expensive interaction with the underlying input
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • JButton (javax.swing)
  • JTextField (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now