Revision: 0f29a22fda1a
Author:   dmisol <[email protected]>
Date:     Sun Sep 29 22:39:17 2013 UTC
Log:      management and startup procedures are fine

http://code.google.com/p/isup2sip/source/detail?r=0f29a22fda1a

Deleted:
 /.gitignore
Modified:
/core/commonlibs/src/main/java/org/mobicents/isup2sip/commonlibs/Channel.java /core/domain/src/main/java/org/mobicents/isup2sip/management/CicManagement.java /core/domain/src/main/java/org/mobicents/isup2sip/management/Isup2SipManagement.java /core/domain/src/main/java/org/mobicents/isup2sip/management/Isup2SipPropertiesManagement.java /core/domain/src/main/java/org/mobicents/isup2sip/management/Isup2SipPropertiesManagementMBean.java /core/domain/src/main/java/org/mobicents/isup2sip/management/Isup2SipShellExecutor.java
 /core/domain/src/main/java/org/mobicents/isup2sip/management/Multiplex.java
/core/oam/cli/src/main/java/org/mobicents/isup2sip/management/console/impl/Isup2SipCommandHandler.java
 /core/slee/sbbs/src/main/java/org/mobicents/isup2sip/sbb/Isup2SipSbb.java
/core/slee/sbbs/src/main/java/org/mobicents/isup2sip/sbb/IsupManagementSbb.java /core/slee/sbbs/src/main/java/org/mobicents/isup2sip/sbb/MgcpManagementSbb.java
 /core/slee/sbbs/src/main/resources/META-INF/sbb-jar.xml

=======================================
--- /.gitignore Mon Jul 29 13:28:57 2013 UTC
+++ /dev/null
@@ -1,49 +0,0 @@
-# ignore .svn metadata files
-.svn
-# ignore Maven generated target folders
-~
-target
-# ignore eclipse files
-.project
-.classpath
-.settings
-.metadata
-# ignore IDEA files
-*.iml
-*.ipr
-*.iws
-.idea
-# ignore NetBeans files
-nbactions.xml
-nb-configuration.xml
-catalog.xml
-#
-maven-ant-tasks.jar
-test-output
-transaction.log
-# vim files
-*.swp
-/.gitk-tmp.*
-atlassian-ide-plugin.xml
-# temp files
-*~
-# maven versions plugin
-pom.xml.versionsBackup
-# hprof dumps
-/*.hprof
-# ignore 'randomly' strewn around logs
-server.log
-# ignore java crashes
-hs_err_pid*.log
-# H2 databases produced by tests
-*.h2.db
-# JBoss transaction generated files
-PutObjectStoreDirHere
-# ignore mvn-rpmbuild repo
-/.m2
-*debuglog.txt
-${env.JBOSS_HOME}
-debuglog.txt.*
-
-#generated doc src
-docs/sources-*/src
=======================================
--- /core/commonlibs/src/main/java/org/mobicents/isup2sip/commonlibs/Channel.java Thu Sep 19 20:15:05 2013 UTC +++ /core/commonlibs/src/main/java/org/mobicents/isup2sip/commonlibs/Channel.java Sun Sep 29 22:39:17 2013 UTC
@@ -73,4 +73,9 @@
        public void setState(State st) {
                state = st;
        }
+
+       @Override
+       public String toString(){
+ return "channel CIC=" + cic + " EP=" + this.endpointId + "@" + this.gatewayAddress;
+       }
 }
=======================================
--- /core/domain/src/main/java/org/mobicents/isup2sip/management/CicManagement.java Sat Sep 28 01:33:30 2013 UTC +++ /core/domain/src/main/java/org/mobicents/isup2sip/management/CicManagement.java Sun Sep 29 22:39:17 2013 UTC
@@ -77,11 +77,15 @@
                logger.warning("Isup2Sip cic management started");

                channelByCic.clear();
+// DEBUG!!
+//addMultiplex(0, "192.168.1.13:2427", 0);
        }

public void addMultiplex(int multiplexId, String gateway, int multiplexPort){
                // create CICs in "unknown" state
                // fire NewMultiplexEvent to start corresponding Sbb
+ logger.info("adding multiplex " + multiplexId + " gatetway " + gateway + " port " + multiplexPort);
+
                for(int ts = 1; ts <= 31; ts++){
                        int cic = 32*multiplexId + ts;
                        int ep = 32*multiplexPort + ts;
@@ -89,15 +93,17 @@

                        // TODO this is Wrong!
// signaling timeslots should be detected by means of MGCP, not during a failure of a real SIP->ISUP call..
-                       ch.setState(State.IDLE);
+//ch.setState(State.IDLE);

                        channelByCic.put(cic, ch);
+                       logger.info("adding channel" + ch.toString());
                }
        }

        public void resetMultiplex(int multiplexId){
                logger.warning("resetting multiplex #" + multiplexId);
                for(int ts = 1; ts <= 31; ts++){
+//             for(int ts = 1; ts <= 2; ts++){              // just for debuf, 
to reduce logging
                        int cic = 32*multiplexId + ts;
                        Channel ch = channelByCic.get(cic);
                        ch.setState(State.UNKNOWN);
@@ -237,6 +243,7 @@
EventTypeID requestType = conn.getEventTypeID("org.mobicents.isup2sip.commonlibs.REQ_RSIP", "org.mobicents", "1.0");

                     RequestRsipEvent epEvent = new RequestRsipEvent(ch);
+ logger.info("firing event " + epEvent + " for " + ch + " ---- " + ch.getEndpointId() + " " + ch.getGatewayAddress());

// CustomEvent customEvent = new CustomEvent(orderId, amount, customerfullname, cutomerphone, userName);

=======================================
--- /core/domain/src/main/java/org/mobicents/isup2sip/management/Isup2SipManagement.java Wed Sep 4 15:12:34 2013 UTC +++ /core/domain/src/main/java/org/mobicents/isup2sip/management/Isup2SipManagement.java Sun Sep 29 22:39:17 2013 UTC
@@ -80,13 +80,16 @@
                ObjectName servicePropObjNname = new ObjectName(
                                Isup2SipManagement.JMX_DOMAIN
                                                + 
":name=ServicePropertiesManagement");
+
+               logger.info("Starting ISUP 2 SIP ServiceManagement");
+
                StandardMBean servicePropMxBean = new StandardMBean(
                                this.servicePropertiesManagement,
                                Isup2SipPropertiesManagementMBean.class, true);
+
                this.mbeanServer.registerMBean(servicePropMxBean, 
servicePropObjNname);

-               logger.info("Started ServiceManagement");
-
+
                logger.info("Started ISUP 2 SIP ServiceManagement");
        }

=======================================
--- /core/domain/src/main/java/org/mobicents/isup2sip/management/Isup2SipPropertiesManagement.java Sat Sep 28 08:11:53 2013 UTC +++ /core/domain/src/main/java/org/mobicents/isup2sip/management/Isup2SipPropertiesManagement.java Sun Sep 29 22:39:17 2013 UTC
@@ -50,7 +50,7 @@
        private static final org.apache.log4j.Logger logger = Logger
                        .getLogger(Isup2SipPropertiesManagement.class);

-       private FastSet <Multiplex> multiplexes = new FastSet<Multiplex>();
+       private FastSet <Multiplex> interfaces = new FastSet<Multiplex>();

 //     protected static final String GATEWAY = "gateway";    // to be removed
 //     protected static final String GATEWAY_PART = "part";  // to be removed
@@ -58,14 +58,16 @@
        protected static final String REMOTE_PC = "remote";
        protected static final String SIP_PEER = "sippeer";
        protected static final String SIP_IP = "sipip";
-       protected static final String MUX = "mux";
+       protected static final String TDM = "tdm";
+       protected static final String INTERFACES = "interfaces";
+

        public static final String ISUP_TO_SIP = "i2s";
        public static final String SIP_TO_ISUP = "s2i";

        private static final String TAB_INDENT = "\t";
        private static final String CLASS_ATTRIBUTE = "type";
-       private static final XMLBinding binding = new XMLBinding();
+       private XMLBinding binding = null;
        private static final String PERSIST_FILE_NAME = 
"isup2sip_properties.xml";
        private static final int TIMEOUT_BEFORE_ISUP_RESET = 15000;

@@ -82,8 +84,8 @@
        private boolean isupManagementSbbReady = false;

        private Multiplex findMultiplex(int index){
- for (FastSet.Record r = multiplexes.head(), end = multiplexes.tail(); (r = r.getNext()) != end;) {
-                    Multiplex mux = multiplexes.valueOf(r);
+ for (FastSet.Record r = interfaces.head(), end = interfaces.tail(); (r = r.getNext()) != end;) {
+                    Multiplex mux = interfaces.valueOf(r);
                     if (mux.getIndex() == index) return mux;
                }

@@ -96,36 +98,42 @@
                        delMultiplex(index);

                Multiplex mux = new Multiplex(index, gw, port);
-               multiplexes.add(mux);
+               interfaces.add(mux);

-               cicManagement.addMultiplex(index, gateway, port);
+               cicManagement.addMultiplex(index, gw, port);
        }

        public void delMultiplex(int index){
- for (FastSet.Record r = multiplexes.head(), end = multiplexes.tail(); (r = r.getNext()) != end;) {
-                    Multiplex mux = multiplexes.valueOf(r);
+ for (FastSet.Record r = interfaces.head(), end = interfaces.tail(); (r = r.getNext()) != end;) {
+                    Multiplex mux = interfaces.valueOf(r);
                     if (mux.getIndex() == index) {
-                        multiplexes.delete(r);
+                        interfaces.delete(r);
                         return;
                     }
                }
        }

        public void showMultiplexes(StringBuilder sb){
-               if( multiplexes.isEmpty() ) return;
+               if( interfaces.isEmpty() ) return;

- for (FastSet.Record r = multiplexes.head(), end = multiplexes.tail(); (r = r.getNext()) != end;) {
-                    Multiplex mux = multiplexes.valueOf(r);
+ for (FastSet.Record r = interfaces.head(), end = interfaces.tail(); (r = r.getNext()) != end;) {
+                    Multiplex mux = interfaces.valueOf(r);
                     sb.append(mux.toString());
                     sb.append("\n");
                }
        }

-       /**
-        * in release, there will be multiple gateways supported,
-        * each CIC will be mapped to some Endpoint @ some gateway
-        */
-       private String gateway;
+       private void initMultiplexes(){
+               if( interfaces.isEmpty() ) return;
+
+ for (FastSet.Record r = interfaces.head(), end = interfaces.tail(); (r = r.getNext()) != end;) {
+                    Multiplex mux = interfaces.valueOf(r);
+                    int index = mux.getIndex();
+                    cicManagement.addMultiplex(index, mux.getGateway(), 
mux.getPort());
+                        logger.info("resetting pcm #" + index);
+                    cicManagement.resetMultiplex(index);
+               }
+       }

        /** in ISUP->SIP case, this peer will get all calls
         *
@@ -147,11 +155,12 @@

        private Isup2SipPropertiesManagement(String name) {
                this.name = name;
-               binding.setClassAttribute(CLASS_ATTRIBUTE);
+               //binding.setClassAttribute(CLASS_ATTRIBUTE);
                //binding.setAlias(Multiplex.class, "pcm");
        }

        protected static Isup2SipPropertiesManagement getInstance(String name) {
+ //logger.error("--- requesting by name; name is <" + name + "> instance is " + instance);
                if (instance == null) {
                        instance = new Isup2SipPropertiesManagement(name);
                }
@@ -159,6 +168,7 @@
        }

        public static Isup2SipPropertiesManagement getInstance() {
+               //logger.error("--- requesting w/o parameter; instance is " + 
instance);
                return instance;
        }

@@ -262,6 +272,7 @@
                }

                // this.setUpDataSource();
+               this.initMultiplexes();

        }

@@ -273,6 +284,14 @@
        /**
         * Persist
         */
+       private void setXMLBinging(){
+               binding = new XMLBinding();
+ binding.setAlias(org.mobicents.isup2sip.management.Multiplex.class, "tdm");
+               binding.setAlias(Integer.class,"port");
+               binding.setAlias(Integer.class,"index");
+               binding.setAlias(String.class,"gateway");
+       }
+
        public void store() {

                // TODO : Should we keep reference to Objects rather than 
recreating
@@ -282,15 +301,17 @@
                                        .newInstance(new 
FileOutputStream(persistFile.toString()));

 //                     binding.setAlias(Multiplex.class, "pcm");
+                       this.setXMLBinging();
                        writer.setBinding(binding);
+
                        // Enables cross-references.
                        // writer.setReferenceResolver(new 
XMLReferenceResolver());
                        writer.setIndentation(TAB_INDENT);

                        writer.write(this.remoteSPC, REMOTE_PC,  Integer.class);
-                       writer.write(this.multiplexes, MUX, FastSet.class);
                        writer.write(this.sipIp, SIP_IP,  String.class);
                        writer.write(this.sipPeer, SIP_PEER,  String.class);
+                       writer.write(this.interfaces, INTERFACES, 
FastSet.class);


                        writer.close();
@@ -315,10 +336,13 @@

 //                     binding.setAlias(Multiplex.class, "pcm");
    //                  reader.setBinding(binding);
+                       this.setXMLBinging();
+                       reader.setBinding(binding);
+
                        this.remoteSPC = reader.read(REMOTE_PC, Integer.class);
-                       this.multiplexes = reader.read(MUX, FastSet.class);
                        this.sipIp = reader.read(SIP_IP, String.class);
                        this.sipPeer = reader.read(SIP_PEER, String.class);
+                       this.interfaces = reader.read(INTERFACES, 
FastSet.class);

                        reader.close();
                } catch (Exception e) {
@@ -340,8 +364,8 @@
if(this.cicManagement != null) return; // nothing to do if started already

                if(this.isupManagementSbbReady){
- for (FastSet.Record r = multiplexes.head(), end = multiplexes.tail(); (r = r.getNext()) != end;) {
-                               Multiplex mux = multiplexes.valueOf(r);
+ for (FastSet.Record r = interfaces.head(), end = interfaces.tail(); (r = r.getNext()) != end;) {
+                               Multiplex mux = interfaces.valueOf(r);
                                cicManagement.resetMultiplex(mux.getIndex());
                        }
                }
@@ -354,8 +378,8 @@
if(this.cicManagement != null) return; // nothing to do if started already

                if(this.mgcpManagementSbbReady){
- for (FastSet.Record r = multiplexes.head(), end = multiplexes.tail(); (r = r.getNext()) != end;) {
-                               Multiplex mux = multiplexes.valueOf(r);
+ for (FastSet.Record r = interfaces.head(), end = interfaces.tail(); (r = r.getNext()) != end;) {
+                               Multiplex mux = interfaces.valueOf(r);
                                cicManagement.resetMultiplex(mux.getIndex());
                        }
                }
=======================================
--- /core/domain/src/main/java/org/mobicents/isup2sip/management/Isup2SipPropertiesManagementMBean.java Sat Sep 28 01:33:30 2013 UTC +++ /core/domain/src/main/java/org/mobicents/isup2sip/management/Isup2SipPropertiesManagementMBean.java Sun Sep 29 22:39:17 2013 UTC
@@ -29,14 +29,6 @@

        public void setRemoteSPC(int pc);

-//     public int getGatewayPart();
-
-//     public void setGatewayPart(int part);
-
-//     public String getGateway();
-
-//     public void setGateway(String gw);
-
        public String getSipPeer();

        public void setSipPeer(String peer);
=======================================
--- /core/domain/src/main/java/org/mobicents/isup2sip/management/Isup2SipShellExecutor.java Sat Sep 28 01:33:30 2013 UTC +++ /core/domain/src/main/java/org/mobicents/isup2sip/management/Isup2SipShellExecutor.java Sun Sep 29 22:39:17 2013 UTC
@@ -34,7 +34,7 @@
  */
 public class Isup2SipShellExecutor implements ShellExecutor {

- private static final Logger logger = Logger.getLogger(Isup2SipShellExecutor.class); + private static final org.apache.log4j.Logger logger = Logger.getLogger(Isup2SipShellExecutor.class);

        private Isup2SipManagement isup2SipManagement;
private Isup2SipPropertiesManagement isup2sipPropertiesManagement = Isup2SipPropertiesManagement.getInstance();
@@ -118,13 +118,15 @@
                        isup2sipPropertiesManagement.setSipPeer(options[3]);
                } else if (parName.equals(Isup2SipPropertiesManagement.SIP_IP)) 
{
                        isup2sipPropertiesManagement.setSipIp(options[3]);
-               } else if(parName.equals(Isup2SipPropertiesManagement.MUX)){
+               } else if(parName.equals(Isup2SipPropertiesManagement.TDM)){
                        int index = Integer.parseInt(options[3]);
                        isup2sipPropertiesManagement.delMultiplex(index);

                        if(options.length > 5){
- isup2sipPropertiesManagement.addMultiplex(index, options[4], Integer.parseInt(options[5]));
-
+                               String gateway = options[4];
+                               int port = Integer.parseInt(options[5]);
+ logger.info("creating multiplex " + index + " gatetway " + gateway + " port " + port);
+                               
isup2sipPropertiesManagement.addMultiplex(index, gateway, port);
                                
isup2sipPropertiesManagement.getCicManagement().resetMultiplex(index);
                        }
                } else {
@@ -183,7 +185,7 @@

                        sb.append(Isup2SipPropertiesManagement.SIP_IP + " = ");
                        sb.append(isup2sipPropertiesManagement.getSipIp());
-                       sb.append("\n");
+                       sb.append(", ");

                        sb.append(Isup2SipPropertiesManagement.SIP_PEER + " = 
");
                        sb.append(isup2sipPropertiesManagement.getSipPeer());
=======================================
--- /core/domain/src/main/java/org/mobicents/isup2sip/management/Multiplex.java Sat Sep 28 01:33:30 2013 UTC +++ /core/domain/src/main/java/org/mobicents/isup2sip/management/Multiplex.java Sun Sep 29 22:39:17 2013 UTC
@@ -21,6 +21,11 @@
                gateway = gw;
                port = gatewayPort;
        }
+       public Multiplex(){
+               index = -1;
+               gateway = new String();
+               port = -1;
+       }

        public int getIndex(){
                return this.index;
@@ -33,9 +38,21 @@
        public int getPort(){
                return this.port;
        }
+
+       public void setIndex(int value){
+               this.index = value;
+       }
+
+       public void setGateway(String value){
+               this.gateway = value;
+       }
+
+       public void setPort(int value){
+               this.port = value;
+       }

        public String toString(){
-               return "multiplex " + index + " gateway" + gateway + " port " + 
port;
+               return "multiplex " + index + " gateway " + gateway + " port " 
+ port;
        }

protected static final XMLFormat<Multiplex> ASP_FACTORY_XML = new XMLFormat<Multiplex>(Multiplex.class) {
@@ -44,8 +61,9 @@
public void read(javolution.xml.XMLFormat.InputElement xml, Multiplex mux)
                                throws XMLStreamException {
                        mux.index       = xml.getAttribute(INDEX, 0);
-                       mux.gateway = xml.getAttribute(GATEWAY, "");
+                       mux.gateway = xml.getAttribute(GATEWAY, "-");
                        mux.port        = xml.getAttribute(PORT, 0);
+//                     mux.setGateway(xml.getAttribute(GATEWAY, " - "));
                }

                @Override
@@ -56,4 +74,5 @@
                        xml.setAttribute(PORT, mux.port);
                }
        };
+
 }
=======================================
--- /core/oam/cli/src/main/java/org/mobicents/isup2sip/management/console/impl/Isup2SipCommandHandler.java Sat Sep 28 08:11:53 2013 UTC +++ /core/oam/cli/src/main/java/org/mobicents/isup2sip/management/console/impl/Isup2SipCommandHandler.java Sun Sep 29 22:39:17 2013 UTC
@@ -37,7 +37,7 @@
                Node parent = commandTree.getTopNode();

                Node set = parent.addChild("set");
-               set.addChild("mux");
+               set.addChild("tdm");
                set.addChild("remote");
                set.addChild("sipip");
                set.addChild("sippeer");
@@ -45,7 +45,7 @@


                Node get = parent.addChild("get");
-               get.addChild("mux");
+               get.addChild("tdm");
                get.addChild("remote");
                get.addChild("sipip");
                get.addChild("sippeer");
=======================================
--- /core/slee/sbbs/src/main/java/org/mobicents/isup2sip/sbb/Isup2SipSbb.java Sat Sep 28 01:33:30 2013 UTC +++ /core/slee/sbbs/src/main/java/org/mobicents/isup2sip/sbb/Isup2SipSbb.java Sun Sep 29 22:39:17 2013 UTC
@@ -138,12 +138,12 @@
     protected ISUPParameterFactory isupParameterFactory;
protected org.mobicents.slee.resources.ss7.isup.ratype.ActivityContextInterfaceFactory isupActivityContextInterfaceFactory;

- private static final Isup2SipPropertiesManagement isup2SipPropertiesManagement =
+    private Isup2SipPropertiesManagement isup2SipPropertiesManagement =
                Isup2SipPropertiesManagement.getInstance();

- private final CicManagement cicManagement = isup2SipPropertiesManagement.getCicManagement(); + private CicManagement cicManagement = isup2SipPropertiesManagement.getCicManagement();

- private final int remoteSPC = isup2SipPropertiesManagement.getRemoteSPC();
+    private int remoteSPC = isup2SipPropertiesManagement.getRemoteSPC();

     public Isup2SipSbb(){ }

@@ -713,7 +713,7 @@
        }

public void onServiceStartedEvent(ServiceStartedEvent event, ActivityContextInterface aci){
-               tracer.severe("service started");
+               tracer.severe("-- service started");
 //             isup2SipPropertiesManagement.registerIsupManagement();
 //             aci.detach(sbbContext.getSbbLocalObject());
        }
@@ -884,6 +884,7 @@
                        ex.printStackTrace();
                }

+               tracer.info("CRCX: " + createConnection);
                mgcpProvider.sendMgcpEvents(new JainMgcpEvent[] { 
createConnection });
                tracer.info("CRCX sent; ep ID=" + endpointID + " sbb=" + 
sbbLocalObject);
        }
=======================================
--- /core/slee/sbbs/src/main/java/org/mobicents/isup2sip/sbb/IsupManagementSbb.java Sat Sep 28 01:33:30 2013 UTC +++ /core/slee/sbbs/src/main/java/org/mobicents/isup2sip/sbb/IsupManagementSbb.java Sun Sep 29 22:39:17 2013 UTC
@@ -76,7 +76,7 @@
  */
 public abstract class IsupManagementSbb implements javax.slee.Sbb {
        private SbbContext sbbContext;
-       private TimerFacility timerFacility;
+       private TimerFacility timerFacility = null;
        private static Tracer tracer;

        protected RAISUPProvider isupProvider;
@@ -84,12 +84,12 @@
     protected ISUPParameterFactory isupParameterFactory;
protected org.mobicents.slee.resources.ss7.isup.ratype.ActivityContextInterfaceFactory isupActivityContextInterfaceFactory;

- private static final Isup2SipPropertiesManagement isup2SipPropertiesManagement =
+    private Isup2SipPropertiesManagement isup2SipPropertiesManagement =
                Isup2SipPropertiesManagement.getInstance();

- private static final CicManagement cicManagement = isup2SipPropertiesManagement.getCicManagement(); + private CicManagement cicManagement = isup2SipPropertiesManagement.getCicManagement();

- private static final int remoteSPC = isup2SipPropertiesManagement.getRemoteSPC();
+    private int remoteSPC = isup2SipPropertiesManagement.getRemoteSPC();

     public IsupManagementSbb(){ }

@@ -168,9 +168,9 @@
        }

public void onServiceStartedEvent(ServiceStartedEvent event, ActivityContextInterface aci){
-               tracer.severe("service started");
+               tracer.severe("-- service started");
 //             isup2SipPropertiesManagement.registerIsupManagement();
-//             aci.detach(sbbContext.getSbbLocalObject());
+               aci.detach(sbbContext.getSbbLocalObject());
        }


@@ -179,12 +179,32 @@
                if (tracer == null) {
                        tracer = 
sbbContext.getTracer(IsupManagementSbb.class.getSimpleName());
                }
+               Context ctx = null;
+
                try{
-                       Context ctx = (Context) new InitialContext();
+                       tracer.severe("trying to start!!!!");
+                       ctx = (Context) new 
InitialContext().lookup(Isup2SipManagement.CONTEXT);
+               } catch (Exception e) {
+                       tracer.severe("error setting context" + e);
+               }
+
+               try {
                        timerFacility = (TimerFacility) 
ctx.lookup(TimerFacility.JNDI_NAME);
+               } catch (Exception e) {
+                       tracer.severe("error configuring timer" + e);
+               }
+
+               try{
+                       // ISUP
+ isupProvider = (RAISUPProvider) ctx.lookup("slee/resources/isup/1.0/provider");
+            isupMessageFactory = isupProvider.getMessageFactory();
+            isupParameterFactory = isupProvider.getParameterFactory();
+ isupActivityContextInterfaceFactory = (org.mobicents.slee.resources.ss7.isup.ratype.ActivityContextInterfaceFactory) ctx.lookup("slee/resources/isup/1.0/acifactory");
+
                } catch (Exception e) {
-                       tracer.severe("error setting context");
+                       tracer.severe("error configuring isup" + e);
                }
+               tracer.warning("contex is set ---- ");
        }

        public void unsetSbbContext() {
=======================================
--- /core/slee/sbbs/src/main/java/org/mobicents/isup2sip/sbb/MgcpManagementSbb.java Sat Sep 28 01:33:30 2013 UTC +++ /core/slee/sbbs/src/main/java/org/mobicents/isup2sip/sbb/MgcpManagementSbb.java Sun Sep 29 22:39:17 2013 UTC
@@ -26,12 +26,16 @@
 import jain.protocol.ip.mgcp.JainMgcpCommandEvent;
 import jain.protocol.ip.mgcp.JainMgcpEvent;
 import jain.protocol.ip.mgcp.JainMgcpResponseEvent;
+import jain.protocol.ip.mgcp.message.AuditEndpoint;
+import jain.protocol.ip.mgcp.message.AuditEndpointResponse;
+import jain.protocol.ip.mgcp.message.CreateConnection;
 import jain.protocol.ip.mgcp.message.RestartInProgress;
 import jain.protocol.ip.mgcp.message.RestartInProgressResponse;
 import jain.protocol.ip.mgcp.message.parms.CallIdentifier;
 import jain.protocol.ip.mgcp.message.parms.ConflictingParameterException;
 import jain.protocol.ip.mgcp.message.parms.ConnectionDescriptor;
 import jain.protocol.ip.mgcp.message.parms.ConnectionIdentifier;
+import jain.protocol.ip.mgcp.message.parms.ConnectionMode;
 import jain.protocol.ip.mgcp.message.parms.EndpointIdentifier;
 import jain.protocol.ip.mgcp.message.parms.RestartMethod;
 import jain.protocol.ip.mgcp.message.parms.ReturnCode;
@@ -70,39 +74,31 @@
        private static Tracer tracer;

        // MGCP
-       private JainMgcpProvider mgcpProvider;
- private MgcpActivityContextInterfaceFactory mgcpActivityContestInterfaceFactory;
+       private JainMgcpProvider mgcpProvider = null;
+ private MgcpActivityContextInterfaceFactory mgcpActivityContestInterfaceFactory = null;

private static final Isup2SipPropertiesManagement isup2SipPropertiesManagement =
                Isup2SipPropertiesManagement.getInstance();

- private static final CicManagement cicManagement = isup2SipPropertiesManagement.getCicManagement(); + private CicManagement cicManagement = isup2SipPropertiesManagement.getCicManagement();

- private static final int remoteSPC = isup2SipPropertiesManagement.getRemoteSPC();
+    private int remoteSPC = isup2SipPropertiesManagement.getRemoteSPC();

     public MgcpManagementSbb(){ }

public void onRequestRsipEvent(RequestRsipEvent event, ActivityContextInterface aci){
        tracer.info("MGCP Management Sbb started " + event);
-
-       final SbbLocalObject sbbLocalObject = sbbContext.getSbbLocalObject();
+
        final Channel channel = event.getChannel();
+       tracer.info("RSIP for channel " + channel);
+//     tracer.info("mgcpProvider is " + mgcpProvider);
+// tracer.info("mgcpActContIF is " + mgcpActivityContestInterfaceFactory);

- EndpointIdentifier endpointID = new EndpointIdentifier(channel.getEndpointId(),channel.getGatewayAddress());
-               this.setEndpointIdentifier(endpointID);
- RestartInProgress rsip = new RestartInProgress(this, endpointID, RestartMethod.Graceful);
-
-               final int txID = mgcpProvider.getUniqueTransactionHandler();
-               rsip.setTransactionHandle(txID);
-
- MgcpConnectionActivity connectionActivity = mgcpProvider.getConnectionActivity(txID, endpointID); - ActivityContextInterface epnAci = mgcpActivityContestInterfaceFactory.getActivityContextInterface(connectionActivity);
-               epnAci.attach(sbbLocalObject);
-
-               mgcpProvider.sendMgcpEvents(new JainMgcpEvent[] { rsip });
-               tracer.info("RSIP sent; ep ID=" + endpointID + " sbb=" + 
sbbLocalObject);
+//     sendCRCX(channel);
+//     sendRSIP(channel);
+       sendAUEP(channel);
     }
-
+/*
public void onRestartInProgressResponse(RestartInProgressResponse event, ActivityContextInterface aci) {
                tracer.info("RSIP RESP " + event);

@@ -125,9 +121,35 @@
                //cicManagement.setIdle(cic);
                aci.detach(sbbContext.getSbbLocalObject());
        }
-
+*/
+ public void onAuditEndpointResponse(AuditEndpointResponse event, ActivityContextInterface aci) {
+               tracer.info("AUEP RESP " + event);
+               aci.detach(sbbContext.getSbbLocalObject());
+
+               final EndpointIdentifier endpointID = 
this.getEndpointIdentifier();
+               final int cic = this.getCic(endpointID);
+
+               if(cic == -1) {
+                       tracer.severe("invalid endpoint id " + endpointID);
+                       aci.detach(sbbContext.getSbbLocalObject());
+                       return;
+               }
+
+               ReturnCode status = event.getReturnCode();
+
+               if(status.getValue() != 
ReturnCode.TRANSACTION_EXECUTED_NORMALLY){
+                       tracer.warning("removing unequipped endpoint id " + 
endpointID);
+                       cicManagement.remove(cic);
+               }
+
+               //EndpointIdentifier[] z = response.getEndpointIdentifierList();
+
+               cicManagement.setIdle(cic);
+       }
+
public void onMgcpTIMEOUT(TransactionTimeout event, ActivityContextInterface aci){
                tracer.severe("Mgcp Timeout" + event);
+               aci.detach(sbbContext.getSbbLocalObject());

                final JainMgcpCommandEvent mgcpEvent = 
event.getJainMgcpCommandEvent();
                final EndpointIdentifier endpointID = 
mgcpEvent.getEndpointIdentifier();
@@ -135,7 +157,6 @@

                if(cic == -1) {
                        tracer.severe("invalid endpoint id " + endpointID);
-                       aci.detach(sbbContext.getSbbLocalObject());
                        return;
                }

@@ -143,7 +164,6 @@
                        tracer.severe("no resp for RSIP " + endpointID);
                        cicManagement.remove(cic);
                }
-               aci.detach(sbbContext.getSbbLocalObject());
        }


@@ -167,12 +187,15 @@
                        tracer = sbbContext.getTracer(MgcpManagementSbb.class
                                        .getSimpleName());
                }
+               tracer.info("sbbContext=" + sbbContext);
+
                try {
+                       tracer.severe("trying to start! sbbContext " + 
sbbContext);
final Context ctx = (Context) new InitialContext().lookup(Isup2SipManagement.CONTEXT);
                        // MGCP
mgcpProvider = (JainMgcpProvider) ctx.lookup(Isup2SipManagement.MGCP_PROVIDER); mgcpActivityContestInterfaceFactory = (MgcpActivityContextInterfaceFactory) ctx.lookup(Isup2SipManagement.MGCP_ACI_FACTORY);
-
+                       tracer.info("sbbContext is set");
                } catch (NamingException e) {
                        tracer.severe(e.getMessage(), e);
                }
@@ -217,4 +240,74 @@
                if(pos == -1) return pos;
                return Integer.parseInt(epStr.substring(0, pos), 16);
        }
+/*
+       void sendCRCX(Channel channel){
+
+               final SbbLocalObject sbbLocalObject = 
sbbContext.getSbbLocalObject();
+
+               CallIdentifier mgcpCallID = 
mgcpProvider.getUniqueCallIdentifier();
+ EndpointIdentifier endpointID = new EndpointIdentifier(channel.getEndpointId(),channel.getGatewayAddress());
+               CreateConnection createConnection = new CreateConnection(this,
+                               mgcpCallID, endpointID, 
ConnectionMode.SendRecv);
+
+               final int txID = mgcpProvider.getUniqueTransactionHandler();
+               createConnection.setTransactionHandle(txID);
+
+               MgcpConnectionActivity connectionActivity = null;
+               try {
+ connectionActivity = mgcpProvider.getConnectionActivity(txID, endpointID); + ActivityContextInterface epnAci = mgcpActivityContestInterfaceFactory.getActivityContextInterface(connectionActivity);
+                       epnAci.attach(sbbLocalObject);
+               } catch (FactoryException ex) {
+                       ex.printStackTrace();
+               } catch (NullPointerException ex) {
+                       ex.printStackTrace();
+               } catch (UnrecognizedActivityException ex) {
+                       ex.printStackTrace();
+               }
+
+               tracer.info("CRCX: " + createConnection);
+               mgcpProvider.sendMgcpEvents(new JainMgcpEvent[] { 
createConnection });
+               tracer.info("CRCX sent; ep ID=" + endpointID + " sbb=" + 
sbbLocalObject);
+       }
+*/
+/*
+       void sendRSIP(Channel channel){
+               final SbbLocalObject sbbLocalObject = 
sbbContext.getSbbLocalObject();
+
+ EndpointIdentifier endpointID = new EndpointIdentifier(channel.getEndpointId(),channel.getGatewayAddress());
+               this.setEndpointIdentifier(endpointID);
+               tracer.info("RSIP EpId " + endpointID);
+ RestartInProgress rsip = new RestartInProgress(this, endpointID, RestartMethod.Graceful);
+
+               final int txID = mgcpProvider.getUniqueTransactionHandler();
+               rsip.setTransactionHandle(txID);
+
+ MgcpConnectionActivity connectionActivity = mgcpProvider.getConnectionActivity(txID, endpointID); + ActivityContextInterface epnAci = mgcpActivityContestInterfaceFactory.getActivityContextInterface(connectionActivity);
+               epnAci.attach(sbbLocalObject);
+
+               mgcpProvider.sendMgcpEvents(new JainMgcpEvent[] { rsip });
+               tracer.info("RSIP sent; ep ID=" + endpointID + " sbb=" + 
sbbLocalObject);
+       }
+*/
+       void sendAUEP(Channel channel){
+               final SbbLocalObject sbbLocalObject = 
sbbContext.getSbbLocalObject();
+
+ EndpointIdentifier endpointID = new EndpointIdentifier(channel.getEndpointId(),channel.getGatewayAddress());
+               this.setEndpointIdentifier(endpointID);
+               tracer.info("AUEP EpId " + endpointID);
+               AuditEndpoint auep = new AuditEndpoint(this, endpointID);
+
+               final int txID = mgcpProvider.getUniqueTransactionHandler();
+               auep.setTransactionHandle(txID);
+
+ // FIXME seems it is useless to attach AUEP and wait for response - let response be initial event +// MgcpConnectionActivity connectionActivity = mgcpProvider.getConnectionActivity(txID, endpointID); +// ActivityContextInterface epnAci = mgcpActivityContestInterfaceFactory.getActivityContextInterface(connectionActivity);
+//             epnAci.attach(sbbLocalObject);
+
+               mgcpProvider.sendMgcpEvents(new JainMgcpEvent[] { auep });
+ tracer.info("AUEP sent; ep ID=" + endpointID + " sbbContext=" + sbbContext + " sbb=" + sbbLocalObject);
+       }
 }
=======================================
--- /core/slee/sbbs/src/main/resources/META-INF/sbb-jar.xml Sat Sep 28 01:33:30 2013 UTC +++ /core/slee/sbbs/src/main/resources/META-INF/sbb-jar.xml Sun Sep 29 22:39:17 2013 UTC
@@ -171,6 +171,16 @@
                        </event-type-ref>
                </event>

+<!--
+               <event event-direction="Receive" initial-event="False">
+                       <event-name>RestartInProgress</event-name>
+                       <event-type-ref>
+ <event-type-name>net.java.slee.resource.mgcp.RESTART_IN_PROGRESS</event-type-name>
+                               <event-type-vendor>net.java</event-type-vendor>
+                               <event-type-version>1.0</event-type-version>
+                       </event-type-ref>
+               </event>
+-->
                <event event-direction="Receive" initial-event="False">
                        <event-name>CreateConnectionResponse</event-name>
                        <event-type-ref>
@@ -296,6 +306,8 @@
                        </event-type-ref>
                </event>
 -->
+
+<!-- no reason to process..
                <event event-direction="Receive" initial-event="False">
                        <event-name>MgcpTIMEOUT</event-name>
                        <event-type-ref>
@@ -304,7 +316,8 @@
                                <event-type-version>1.0</event-type-version>
                        </event-type-ref>
                </event>
-
+-->
+<!--
                <event event-direction="Receive" initial-event="False">
                        <event-name>RestartInProgressResponse</event-name>
                        <event-type-ref>
@@ -313,6 +326,25 @@
                                <event-type-version>1.0</event-type-version>
                        </event-type-ref>
                </event>
+-->
+<!--
+               <event event-direction="Receive" initial-event="False">
+                       <event-name>AuditEndpointResponse</event-name>
+                       <event-type-ref>
+ <event-type-name>net.java.slee.resource.mgcp.AUDIT_ENDPOINT_RESPONSE</event-type-name>
+                               <event-type-vendor>net.java</event-type-vendor>
+                               <event-type-version>1.0</event-type-version>
+                       </event-type-ref>
+               </event>
+-->
+ <event event-direction="Receive" initial-event="True"><!-- as I was not able to get it back to the same Sbb from which AUEP was fired-->
+                       <event-name>AuditEndpointResponse</event-name>
+                       <event-type-ref>
+ <event-type-name>net.java.slee.resource.mgcp.AUDIT_ENDPOINT_RESPONSE</event-type-name>
+                               <event-type-vendor>net.java</event-type-vendor>
+                               <event-type-version>1.0</event-type-version>
+                       </event-type-ref>
+               </event>

                <resource-adaptor-type-binding>
                        <resource-adaptor-type-ref>
@@ -364,7 +396,7 @@
                         <library-version>1.0</library-version>
                 </library-ref>
 -->
-<!--
+
                <event event-direction="Receive" initial-event="True">
                        <event-name>ServiceStartedEvent</event-name>
                        <event-type-ref>
@@ -375,7 +407,7 @@
                                <event-type-version>1.1</event-type-version>
                        </event-type-ref>
                </event>
--->
+
                <event event-direction="Receive" initial-event="True">
                        <event-name>RequestIsupResetsEvent</event-name>
                        <event-type-ref>

--

--- You received this message because you are subscribed to the Google Groups "mobicents-commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to