Skip to main content

CDI scopes and SIP Servlets

  • From: Binod < >
  • To:
  • Subject: CDI scopes and SIP Servlets
  • Date: Tue, 04 Dec 2012 18:19:04 +0530

Hi everyone,

I have been analyzing CDI for the use of SIP Servlets. To begin with, I looked
at what scopes would make sense for SIP Servlets. Here is the list of scopes
I came up with.

@SipSessionScoped (equivalent to @SessionScoped)
@SipMessageScoped (equivalent to @RequestScoped)
@SipTransactionScoped (if we decide to have a Transaction interface)

CDI sort of assumes that the scopes are initialized as a message (eg: http)
arrives in the container. However, in SIP Servlet programming, a scope context
(eg: SipSession) may be created as part of an outgoing request and that session
might be used for further incoming messages. And CDI does not appear to
accommodate these use-cases well (correct me if I am wrong).

ConversationScoped does not cover this outbound case either. Even the
ConversationScope begins as a transient scope when a request is received
in the container. It can later be upgraded to long running. From whatever
I have read, it appear like there can be only one Conversation for a servlet
request lifecycle.

To model this correctly for SIP, I was thinking of a model of multiple conversations
and associated sessions and sip application sessions. The thinking is to extend the
model of javax.enterprise.inject.Instance to select the beans associated with a particular

<pseudo-code> //Not a proposal
public class B2b {

  Instance<B2bLeg> legs;

  SipServletRequest request;

  SipFactory factory;

  SipApplicationSession sas;

  public B2bLeg createNewLeg() {
    SipServletRequest otherLegRequest =
    factory.createRequest(sas, request.getMethod(), request.getFrom(), request.getTo());
    B2bLeg otherLeg =; //Not possible with CDI today
    return otherLeg;

Do anyone know of accommodating this model with the existing CDI


CDI scopes and SIP Servlets

Binod 12/04/2012

Re: CDI scopes and SIP Servlets

Binod 12/07/2012

Re: CDI scopes and SIP Servlets

Lewis, Keith 12/14/2012

Re: CDI scopes and SIP Servlets

George Vagenas 12/14/2012

Re: CDI scopes and SIP Servlets

Binod 12/17/2012

Re: CDI scopes and SIP Servlets

brian_pulito 12/31/2012
Please Confirm