Revision: 16400
Author: emmartins
Date: Thu Jan 13 02:23:14 2011
Log: [No log message]
http://code.google.com/p/mobicents/source/detail?r=16400

Modified:
/trunk/servers/jain-slee/examples/mscontrol-demo/sbb/src/main/java/org/mobicents/slee/example/msc/CallSbb.java

=======================================
--- /trunk/servers/jain-slee/examples/mscontrol-demo/sbb/src/main/java/org/mobicents/slee/example/msc/CallSbb.java Tue Jan 11 08:08:34 2011 +++ /trunk/servers/jain-slee/examples/mscontrol-demo/sbb/src/main/java/org/mobicents/slee/example/msc/CallSbb.java Thu Jan 13 02:23:14 2011
@@ -35,6 +35,7 @@
 import javax.slee.RolledBackContext;
 import javax.slee.Sbb;
 import javax.slee.SbbContext;
+import javax.slee.SbbLocalObject;
 import javax.slee.facilities.Tracer;
 import net.java.slee.resource.sip.DialogActivity;
 import net.java.slee.resource.sip.SipActivityContextInterfaceFactory;
@@ -68,6 +69,8 @@
        public void onInvite(RequestEvent event, ActivityContextInterface aci) {
                tracer.info("Receive call ");

+               SbbLocalObject sbbLocalObject = sbbContext.getSbbLocalObject();
+
                Request request = event.getRequest();

                // sending provisional response to the UA which indiactes that 
initial
@@ -90,7 +93,7 @@
                        Dialog dialog = 
sipProvider.getNewDialog(event.getServerTransaction());
                        dialog.terminateOnBye(true);
callActivity = acif.getActivityContextInterface((DialogActivity) dialog);
-                       callActivity.attach(sbbContext.getSbbLocalObject());
+                       callActivity.attach(sbbLocalObject);
                } catch (Exception e) {
                        // oops, this is unexpected core problem. there is only 
one way -
                        // terminate call
@@ -122,7 +125,7 @@
                ActivityContextInterface activityContextInterface = null;
                try {
activityContextInterface = mscAcifFactory.getActivityContextInterface(connection);
-                       
activityContextInterface.attach(sbbContext.getSbbLocalObject());
+                       activityContextInterface.attach(sbbLocalObject);
                } catch (Exception e) {
                        tracer.severe("Unexpected error", e);
                        reject();
@@ -169,8 +172,9 @@
ContactHeader contact = headerFactory.createContactHeader(contactAddress);

                try {
-                       ServerTransaction st = getServerTransaction();
-
+                       ActivityContextInterface serverTxACI = 
getServerTransactionACI();
+                       serverTxACI.detach(sbbContext.getSbbLocalObject());
+                       ServerTransaction st = (ServerTransaction) 
serverTxACI.getActivity();
Response ok = messageFactory.createResponse(Response.OK, st.getRequest(), contentType, sdp);
                        ok.setHeader(contact);
                        st.sendResponse(ok);
@@ -222,7 +226,9 @@

        private void reject() {
                try {
-                       ServerTransaction  st = getServerTransaction();
+                       ActivityContextInterface serverTxACI = 
getServerTransactionACI();
+                       serverTxACI.detach(sbbContext.getSbbLocalObject());
+                       ServerTransaction st = (ServerTransaction) 
serverTxACI.getActivity();
Response response = messageFactory.createResponse(Response.SERVER_INTERNAL_ERROR, st.getRequest());
                        st.sendResponse(response);
                } catch (Exception ex) {
@@ -260,12 +266,10 @@
                return null;
        }

-       private ServerTransaction getServerTransaction() {
+       private ActivityContextInterface getServerTransactionACI() {
                for (ActivityContextInterface aci : 
this.sbbContext.getActivities()) {
                        if (aci.getActivity() instanceof ServerTransaction) {
-
-                               ServerTransaction da = (ServerTransaction) 
aci.getActivity();
-                               return da;
+                               return aci;
                        }
                }
                return null;

Reply via email to