1

I'm studying Sip Servlet and there is something that it's not clear to me.

With an application server like mobicents, I could have two type of session:

  1. SipSession: is the session linked to the request/response;
  2. SipApplicationSession: is the session that wrap SipSession and (eventually) HttpSession. This should be used to communicate between the web and sip servlet.

Why should we have the second one? If I call:

getServletContext.setAttribute("something", somethingObject);

is this shared with the two servlets, or am I wrong?

The ServletContext is something that wraps the servlet in an application, and so we can communicate across the servlets.

So why should we use SipApplicationSession?

Thanks for answering.

xcsob
  • 837
  • 1
  • 12
  • 27

1 Answers1

1

You're right on the concept behind SIPSession and SIPApplicationSession.

Think of SIPApplicationSession as a meta-session holding up N SIP Session (and HTTPSession if the application is a convergent SIP and HTTP one and uses them). So the attributes in this can be shared across SIP Sessions if you're building a B2BUA (and also WebSession if you include Web in your application) but it is always limited in time to the context of the SIP Session and HTTP Session lifetime.

ServletContext however is for the lifetime of the application and completely independent of SIP calls or Web requests so you only want to put attributes there that are meant to live longer than that and that you don't want to persist or store in a DataBase.

jeand
  • 2,325
  • 14
  • 12
  • 1
    First of all, it's my pleasure to be helped by you. I understand your answer, and it was just like I supposed. So, in the scenario of a B2BUA, like for example a 3PCC, where there is a web interface (and so HttpServlet also) when I call SipFactory.createRequest(SipApplicationSession...), I'm creating a request that belongs to its SipSession, and this SipSession belongs to the SipApplicationSession. – xcsob Jul 21 '16 at 09:21
  • 1
    If, for some reason, we press the button "hang up", and this makes a get request to our HttpServlet, this will get the reference to SipApplicationSession and for each SipSession (in the SipApplicationSession) for example create a bye request. Thanks :) – xcsob Jul 21 '16 at 09:22
  • You got it correctly. Feel free to upvote the answer if it was helpful to guide future readers. – jeand Jul 21 '16 at 09:23