master moved from b792d9f532ab to beec7c88ed49

2 new revisions:

Revision: 1c54e424184d
Author:   dmisol <[email protected]>
Date:     Sat Sep 28 01:33:30 2013 UTC
Log:      trying management, cli and persistence
http://code.google.com/p/isup2sip/source/detail?r=1c54e424184d

Revision: beec7c88ed49
Author:   dmisol <[email protected]>
Date:     Sat Sep 28 08:11:53 2013 UTC
Log:      added cli commands
http://code.google.com/p/isup2sip/source/detail?r=beec7c88ed49

==============================================================================
Revision: 1c54e424184d
Author:   dmisol <[email protected]>
Date:     Sat Sep 28 01:33:30 2013 UTC
Log:      trying management, cli and persistence

http://code.google.com/p/isup2sip/source/detail?r=1c54e424184d

Added:
 /core/domain/src/main/java/org/mobicents/isup2sip/management/Multiplex.java
Modified:
 /core/commonlibs/src/main/resources/META-INF/event-jar.xml
/core/domain/src/main/java/org/mobicents/isup2sip/management/CicManagement.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/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
 /core/slee/services-du/pom.xml

=======================================
--- /dev/null
+++ /core/domain/src/main/java/org/mobicents/isup2sip/management/Multiplex.java Sat Sep 28 01:33:30 2013 UTC
@@ -0,0 +1,59 @@
+package org.mobicents.isup2sip.management;
+
+import javolution.xml.XMLFormat;
+import javolution.xml.XMLSerializable;
+import javolution.xml.stream.XMLStreamException;
+
+public class Multiplex implements XMLSerializable{
+
+       private static final String INDEX       = "index";
+       private static final String GATEWAY     = "gateway";
+       private static final String PORT                = "port";
+
+       protected int index;
+
+       protected String gateway;
+
+       protected int port;
+
+       public Multiplex(int num, String gw, int gatewayPort){
+               index = num;
+               gateway = gw;
+               port = gatewayPort;
+       }
+
+       public int getIndex(){
+               return this.index;
+       }
+
+       public String getGateway(){
+               return this.gateway;
+       }
+
+       public int getPort(){
+               return this.port;
+       }
+
+       public String toString(){
+               return "multiplex " + index + " gateway" + gateway + " port " + 
port;
+       }
+
+ protected static final XMLFormat<Multiplex> ASP_FACTORY_XML = new XMLFormat<Multiplex>(Multiplex.class) {
+
+               @Override
+ public void read(javolution.xml.XMLFormat.InputElement xml, Multiplex mux)
+                               throws XMLStreamException {
+                       mux.index       = xml.getAttribute(INDEX, 0);
+                       mux.gateway = xml.getAttribute(GATEWAY, "");
+                       mux.port        = xml.getAttribute(PORT, 0);
+               }
+
+               @Override
+ public void write(Multiplex mux, javolution.xml.XMLFormat.OutputElement xml)
+                               throws XMLStreamException {
+                       xml.setAttribute(INDEX, mux.index);
+                       xml.setAttribute(GATEWAY, mux.gateway);
+                       xml.setAttribute(PORT, mux.port);
+               }
+       };
+}
=======================================
--- /core/commonlibs/src/main/resources/META-INF/event-jar.xml Thu Sep 19 20:15:05 2013 UTC +++ /core/commonlibs/src/main/resources/META-INF/event-jar.xml Sat Sep 28 01:33:30 2013 UTC
@@ -2,16 +2,23 @@
<!DOCTYPE event-jar PUBLIC "-//Sun Microsystems, Inc.//DTD JAIN SLEE Event 1.0//EN"
                            "http://java.sun.com/dtd/slee-event-jar_1_0.dtd";>
 <event-jar>
+       <description>Event definitions ISUP-SIP management events</description>
+<!--        <library-ref>
+               <library-name>isup2sip</library-name>
+               <library-vendor>mobicents.org</library-vendor>
+               <library-version>1.0</library-version>
+       </library-ref>
+-->
        <event-definition>
                <description>request RSIP  to verify endpoint</description>
-               
<event-type-name>org.mobicents.isup2sip.REQ_RSIP</event-type-name>
+ <event-type-name>org.mobicents.isup2sip.commonlibs.REQ_RSIP</event-type-name>
                <event-type-vendor>org.mobicents</event-type-vendor>
                <event-type-version>1.0</event-type-version>
<event-class-name>org.mobicents.isup2sip.commonlibs.RequestRsipEvent</event-class-name>
        </event-definition>
        <event-definition>
<description>request ISUP activities to initialize channels within a multiplex</description>
-               
<event-type-name>org.mobicents.isup2sip.REQ_RSC_GRS</event-type-name>
+ <event-type-name>org.mobicents.isup2sip.commonlibs.REQ_RSC_GRS</event-type-name>
                <event-type-vendor>org.mobicents</event-type-vendor>
                <event-type-version>1.0</event-type-version>
<event-class-name>org.mobicents.isup2sip.commonlibs.RequestIsupResetsEvent</event-class-name>
=======================================
--- /core/domain/src/main/java/org/mobicents/isup2sip/management/CicManagement.java Thu Sep 19 20:15:05 2013 UTC +++ /core/domain/src/main/java/org/mobicents/isup2sip/management/CicManagement.java Sat Sep 28 01:33:30 2013 UTC
@@ -67,38 +67,16 @@
 import org.mobicents.isup2sip.commonlibs.RequestIsupResetsEvent;
 import org.mobicents.isup2sip.commonlibs.RequestRsipEvent;

-//import org.mobicents.slee.service.events.CustomEvent;
-//import org.mobicents.slee.service.events;
-
 public class CicManagement {
private static final Logger logger = Logger.getLogger(CicManagement.class.getName());

        private static final Object synchCic = new Object();
protected static Map<Integer, Channel> channelByCic = new HashMap<Integer, Channel>();

-       public CicManagement(String gateway, int part) throws Exception {
-               logger.warning("Isup2Sip cic mahagement started");
+       public CicManagement(){ //throws Exception {
+               logger.warning("Isup2Sip cic management started");

                channelByCic.clear();
-               // TODO: this is for DEBUG only,
-               // real configuration should be read from a file
- // for testing, half of a card is acting as one equipment, a second as is another
-/*
-               for (int cic = 1; cic < 31; cic++) {
-                       if(cic == 16) continue;
-                       Channel ch;
- if(part!=0) ch = new Channel(gateway,Integer.toHexString(cic + 32), cic);
-                       else            ch = new 
Channel(gateway,Integer.toHexString(cic), cic);
-                       channelByCic.put(cic, ch);
-
-                       // TODO: in fact, need to reset circuits
-                       //ch.setState(State.IDLE);
-
-                       logger.warning("created channel " + ch +
-                                       " cic=" + cic + ": " + ch.getCic() + 
"|" +
-                                       ch.getEndpointId() + "|" + 
ch.getGatewayAddress());
-               }
-*/
        }

public void addMultiplex(int multiplexId, String gateway, int multiplexPort){
@@ -108,11 +86,25 @@
                        int cic = 32*multiplexId + ts;
                        int ep = 32*multiplexPort + ts;
                        Channel ch = new Channel(gateway, 
Integer.toHexString(ep), cic);
+
+                       // 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);
+
                        channelByCic.put(cic, ch);
+               }
+       }
+
+       public void resetMultiplex(int multiplexId){
+               logger.warning("resetting multiplex #" + multiplexId);
+               for(int ts = 1; ts <= 31; ts++){
+                       int cic = 32*multiplexId + ts;
+                       Channel ch = channelByCic.get(cic);
+                       ch.setState(State.UNKNOWN);

                        this.fireMgcpRsipEvent(ch);
                }
-               this.fireIsupResetEvent(multiplexId);
+               this.fireIsupResetEvent(multiplexId);
        }

        public Channel allocateIdleChannel() {
@@ -195,51 +187,16 @@
                if(state.equals(Channel.State.OUTGO)) return true;
                return false;
        }
-
+/*
public void resetChannels(Object obj, Context ctx, SbbLocalObject sbbLocalObject){
                logger.info("resetting channels");
-/*
-               // MGCP
-               JainMgcpProvider mgcpProvider = null;
- MgcpActivityContextInterfaceFactory mgcpActivityContestInterfaceFactory = null;
-               try{
- mgcpProvider = (JainMgcpProvider) ctx.lookup(Isup2SipManagement.MGCP_PROVIDER); - mgcpActivityContestInterfaceFactory = (MgcpActivityContextInterfaceFactory) ctx.lookup(Isup2SipManagement.MGCP_ACI_FACTORY);
-               } catch (Exception e) {
-                       logger.severe("exception " + e.getMessage());
-                       return;
-               }
-
-               // 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");
-*/
                synchronized(synchCic) {
                        Iterator <Channel> i = null; i = 
channelByCic.values().iterator();
                        while(i.hasNext()){
                                        Channel ch = i.next();
                                        if(ch.getState() == State.UNKNOWN){
                                                try {
-                                                       // fire MGCP RSIP
-/* EndpointIdentifier endpointID = new EndpointIdentifier(ch.getEndpointId(),ch.getGatewayAddress()); - RestartInProgress rsip = new RestartInProgress(obj, 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 });
- logger.info("RSIP sent; ep ID=" + endpointID + " sbb=" + sbbLocalObject);
-*/
-                                                       // TODO:
-                                                       // fire ISUP RSC
-
                                            // hack:
                                                        ch.setState(State.IDLE);

@@ -250,7 +207,7 @@
                        }
                }
        }
-
+*/
        private Channel getNeededState(Channel.State state){
                Iterator <Channel> i = null; i = 
channelByCic.values().iterator();
                while(i.hasNext()){
@@ -277,7 +234,7 @@

ExternalActivityHandle handle = conn.createActivityHandle();

- EventTypeID requestType = conn.getEventTypeID("org.mobicents.isup2sip.REQ_RSIP", "org.mobicents", "1.0"); + EventTypeID requestType = conn.getEventTypeID("org.mobicents.isup2sip.commonlibs.REQ_RSIP", "org.mobicents", "1.0");

                     RequestRsipEvent epEvent = new RequestRsipEvent(ch);

@@ -312,7 +269,7 @@

ExternalActivityHandle handle = conn.createActivityHandle();

- EventTypeID requestType = conn.getEventTypeID("org.mobicents.isup2sip.REQ_RSC_GRS", "org.mobicents", "1.0"); + EventTypeID requestType = conn.getEventTypeID("org.mobicents.isup2sip.commonlibs.REQ_RSC_GRS", "org.mobicents", "1.0");

RequestIsupResetsEvent isupEvent = new RequestIsupResetsEvent(multiplexId);

=======================================
--- /core/domain/src/main/java/org/mobicents/isup2sip/management/Isup2SipPropertiesManagement.java Thu Sep 19 20:15:05 2013 UTC +++ /core/domain/src/main/java/org/mobicents/isup2sip/management/Isup2SipPropertiesManagement.java Sat Sep 28 01:33:30 2013 UTC
@@ -25,14 +25,21 @@
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;

 import javolution.text.TextBuilder;
+import javolution.util.FastSet;
 import javolution.xml.XMLBinding;
 import javolution.xml.XMLObjectReader;
 import javolution.xml.XMLObjectWriter;
 import javolution.xml.stream.XMLStreamException;

 import org.apache.log4j.Logger;
+import org.mobicents.isup2sip.commonlibs.Channel;
 /**
  * @author dmitri soloviev
  *
@@ -43,11 +50,15 @@
        private static final org.apache.log4j.Logger logger = Logger
                        .getLogger(Isup2SipPropertiesManagement.class);

-       protected static final String GATEWAY = "gateway";
-       protected static final String GATEWAY_PART = "part";
+       protected FastSet <Multiplex> multiplexes = new FastSet<Multiplex>();
+
+//     protected static final String GATEWAY = "gateway";    // to be removed
+//     protected static final String GATEWAY_PART = "part";  // to be removed
+
        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";

        public static final String ISUP_TO_SIP = "i2s";
        public static final String SIP_TO_ISUP = "s2i";
@@ -70,6 +81,46 @@

        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);
+                    if (mux.getIndex() == index) return mux;
+               }
+
+               return null;
+       }
+
+       public void addMultiplex(int index, String gw, int port){
+
+               if( findMultiplex(index) != null )
+                       delMultiplex(index);
+
+               Multiplex mux = new Multiplex(index, gw, port);
+               multiplexes.add(mux);
+
+               cicManagement.addMultiplex(index, gateway, port);
+       }
+
+       public void delMultiplex(int index){
+ for (FastSet.Record r = multiplexes.head(), end = multiplexes.tail(); (r = r.getNext()) != end;) {
+                    Multiplex mux = multiplexes.valueOf(r);
+                    if (mux.getIndex() == index) {
+                        multiplexes.delete(r);
+                        return;
+                    }
+               }
+       }
+
+       public void showMultiplexes(StringBuilder sb){
+               if( multiplexes.isEmpty() ) return;
+
+ for (FastSet.Record r = multiplexes.head(), end = multiplexes.tail(); (r = r.getNext()) != end;) {
+                    Multiplex mux = multiplexes.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
@@ -86,19 +137,18 @@
/** during developing, a single Telscale Card is shared between 2 isup2sip instances,
         * that are running one agains another
         */
-       private int gatewayPartForDebug;
+//     private int gatewayPartForDebug;

-       // private DataSource dataSource;
-
        private boolean countersEnabled = true;

-       private CicManagement cicManagement = null;
+       private CicManagement cicManagement = new CicManagement();

        private int remoteSPC;

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

        protected static Isup2SipPropertiesManagement getInstance(String name) {
@@ -133,7 +183,7 @@
                this.remoteSPC = pc;
                logger.warn("remote SPC is set to " + pc);
        }
-
+/*
        @Override
        public int getGatewayPart(){
                return this.gatewayPartForDebug;
@@ -154,7 +204,7 @@
        public void setGateway(String gw){
                this.gateway = gw;
        }
-
+*/
        @Override
        public String getSipPeer(){
                return this.sipPeer;
@@ -213,9 +263,6 @@

                // this.setUpDataSource();

-// this.cicManagement = new CicManagement(this.gateway, this.gatewayPartForDebug);
-               // this should be done when all Sbbs are ready
-
        }

        public void stop() throws Exception {
@@ -233,17 +280,19 @@
                try {
                        XMLObjectWriter writer = XMLObjectWriter
                                        .newInstance(new 
FileOutputStream(persistFile.toString()));
+
+//                     binding.setAlias(Multiplex.class, "pcm");
                        writer.setBinding(binding);
                        // Enables cross-references.
                        // writer.setReferenceResolver(new 
XMLReferenceResolver());
                        writer.setIndentation(TAB_INDENT);

-                       writer.write(this.gateway, GATEWAY,  String.class);
-                       writer.write(this.gatewayPartForDebug, GATEWAY_PART,  
Integer.class);
                        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.close();

                        logger.error("sipIp=" + this.sipIp + ", sipPeer=" + 
this.sipPeer);
@@ -264,15 +313,16 @@
                        reader = XMLObjectReader.newInstance(new 
FileInputStream(
                                        persistFile.toString()));

+//                     binding.setAlias(Multiplex.class, "pcm");
                        reader.setBinding(binding);
-                       this.gateway = reader.read(GATEWAY, String.class);
-                       this.gatewayPartForDebug = reader.read(GATEWAY_PART, 
Integer.class);
                        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);

                        reader.close();
-               } catch (XMLStreamException ex) {
+               } catch (Exception e) {
+                       logger.error("Error while loading file",e);
                        // this.logger.info(
                        // "Error while re-creating Linksets from persisted 
file", ex);
                }
@@ -289,13 +339,12 @@

if(this.cicManagement != null) return; // nothing to do if started already

-               if(this.isupManagementSbbReady)
-                       try{
-                               logger.info("trying to start CicManagement");
- this.cicManagement = new CicManagement(this.gateway, this.gatewayPartForDebug);
-                       } catch (Exception e) {
-                               logger.error("exception when starting 
CicManagement");
+               if(this.isupManagementSbbReady){
+ for (FastSet.Record r = multiplexes.head(), end = multiplexes.tail(); (r = r.getNext()) != end;) {
+                               Multiplex mux = multiplexes.valueOf(r);
+                               cicManagement.resetMultiplex(mux.getIndex());
                        }
+               }
        }

        public void registerIsupManagement(){
@@ -304,13 +353,12 @@

if(this.cicManagement != null) return; // nothing to do if started already

-               if(this.mgcpManagementSbbReady)
-                       try{
-                               logger.info("trying to start CicManagement");
- this.cicManagement = new CicManagement(this.gateway, this.gatewayPartForDebug);
-                       } catch (Exception e) {
-                               logger.error("exception when starting 
CicManagement");
+               if(this.mgcpManagementSbbReady){
+ for (FastSet.Record r = multiplexes.head(), end = multiplexes.tail(); (r = r.getNext()) != end;) {
+                               Multiplex mux = multiplexes.valueOf(r);
+                               cicManagement.resetMultiplex(mux.getIndex());
                        }
+               }
        }

 }
=======================================
--- /core/domain/src/main/java/org/mobicents/isup2sip/management/Isup2SipPropertiesManagementMBean.java Fri Aug 16 18:40:11 2013 UTC +++ /core/domain/src/main/java/org/mobicents/isup2sip/management/Isup2SipPropertiesManagementMBean.java Sat Sep 28 01:33:30 2013 UTC
@@ -29,13 +29,13 @@

        public void setRemoteSPC(int pc);

-       public int getGatewayPart();
+//     public int getGatewayPart();

-       public void setGatewayPart(int part);
+//     public void setGatewayPart(int part);

-       public String getGateway();
+//     public String getGateway();

-       public void setGateway(String gw);
+//     public void setGateway(String gw);

        public String getSipPeer();

=======================================
--- /core/domain/src/main/java/org/mobicents/isup2sip/management/Isup2SipShellExecutor.java Fri Aug 16 18:40:11 2013 UTC +++ /core/domain/src/main/java/org/mobicents/isup2sip/management/Isup2SipShellExecutor.java Sat Sep 28 01:33:30 2013 UTC
@@ -22,6 +22,8 @@
 package org.mobicents.isup2sip.management;

 import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Set;

 import org.apache.log4j.Logger;
 import org.mobicents.ss7.management.console.ShellExecutor;
@@ -105,14 +107,26 @@
                }

                String parName = options[2].toLowerCase();
-               if (parName.equals(Isup2SipPropertiesManagement.GATEWAY)) {
+/*             if (parName.equals(Isup2SipPropertiesManagement.GATEWAY)) {
                        isup2sipPropertiesManagement.setGateway(options[3]);
                } else if 
(parName.equals(Isup2SipPropertiesManagement.GATEWAY_PART)) {
isup2sipPropertiesManagement.setGatewayPart(Integer.parseInt(options[3]));
-               } else if 
(parName.equals(Isup2SipPropertiesManagement.REMOTE_PC)) {
+               } else */
+               if (parName.equals(Isup2SipPropertiesManagement.REMOTE_PC)) {
                        
isup2sipPropertiesManagement.setRemoteSPC(Integer.parseInt(options[3]));
                } else if 
(parName.equals(Isup2SipPropertiesManagement.SIP_PEER)) {
                        isup2sipPropertiesManagement.setSipPeer(options[3]);
+               } else if (parName.equals(Isup2SipPropertiesManagement.SIP_IP)) 
{
+                       isup2sipPropertiesManagement.setSipIp(options[3]);
+               } else if(parName.equals(Isup2SipPropertiesManagement.MUX)){
+                       int index = Integer.parseInt(options[3]);
+                       isup2sipPropertiesManagement.delMultiplex(index);
+
+                       if(options.length > 5){
+ isup2sipPropertiesManagement.addMultiplex(index, options[4], Integer.parseInt(options[5]));
+
+                               
isup2sipPropertiesManagement.getCicManagement().resetMultiplex(index);
+                       }
                } else {
                        return Isup2SipOAMMessages.INVALID_COMMAND;
                }
@@ -134,37 +148,49 @@
                        StringBuilder sb = new StringBuilder();
                        sb.append(options[2]);
                        sb.append(" = ");
-                       if 
(parName.equals(Isup2SipPropertiesManagement.GATEWAY)) {
-                               
sb.append(isup2sipPropertiesManagement.getGateway());
-                       } else if 
(parName.equals(Isup2SipPropertiesManagement.GATEWAY_PART)) {
- sb.append(Integer.toString(isup2sipPropertiesManagement.getGatewayPart()));
-                       } else if 
(parName.equals(Isup2SipPropertiesManagement.REMOTE_PC)) {
+
+                       if 
(parName.equals(Isup2SipPropertiesManagement.REMOTE_PC)) {
sb.append(Integer.toString(isup2sipPropertiesManagement.getRemoteSPC()));
                        } else if 
(parName.equals(Isup2SipPropertiesManagement.SIP_PEER)) {
                                
sb.append(isup2sipPropertiesManagement.getSipPeer());
+                       } else if 
(parName.equals(Isup2SipPropertiesManagement.SIP_IP)) {
+                               
sb.append(isup2sipPropertiesManagement.getSipIp());
                        } else {
                                return Isup2SipOAMMessages.INVALID_COMMAND;
                        }

                        return sb.toString();
-               } else {
+               } /*else if (options.length == 4) {     // isup2sip get 
multiplex N
+                       String parName = options[2].toLowerCase();
+
+                       StringBuilder sb = new StringBuilder();
+
+                       if (parName.equals(Isup2SipPropertiesManagement.MUX)) {
+                               int index = Integer.valueOf(options[3]);
+                               Multiplex mux = 
isup2sipPropertiesManagement.getMultimplex(index);
+                               sb.append(mux);
+                       } else {
+                               return Isup2SipOAMMessages.INVALID_COMMAND;
+                       }
+
+                       return sb.toString();
+               } */else {
                        StringBuilder sb = new StringBuilder();
-                       sb.append(Isup2SipPropertiesManagement.GATEWAY + " = ");
-                       sb.append(isup2sipPropertiesManagement.getGateway());
-                       sb.append(", ");
-
-                       sb.append(Isup2SipPropertiesManagement.GATEWAY_PART + " = 
");
- sb.append(Integer.toString(isup2sipPropertiesManagement.getGatewayPart()));
-                       sb.append(", ");

                        sb.append(Isup2SipPropertiesManagement.REMOTE_PC + " = 
");
sb.append(Integer.toString(isup2sipPropertiesManagement.getRemoteSPC()));
                        sb.append(", ");

+                       sb.append(Isup2SipPropertiesManagement.SIP_IP + " = ");
+                       sb.append(isup2sipPropertiesManagement.getSipIp());
+                       sb.append("\n");
+
                        sb.append(Isup2SipPropertiesManagement.SIP_PEER + " = 
");
                        sb.append(isup2sipPropertiesManagement.getSipPeer());
                        sb.append("\n");

+                       isup2sipPropertiesManagement.showMultiplexes(sb);
+
                        return sb.toString();
                }
        }
=======================================
--- /core/oam/cli/src/main/java/org/mobicents/isup2sip/management/console/impl/Isup2SipCommandHandler.java Sun Aug 4 00:08:46 2013 UTC +++ /core/oam/cli/src/main/java/org/mobicents/isup2sip/management/console/impl/Isup2SipCommandHandler.java Sat Sep 28 01:33:30 2013 UTC
@@ -39,14 +39,15 @@
                Node set = parent.addChild("set");
set.addChild("part"); // gateway's part, for debuggig. When a single card acts as two gateways
                set.addChild("remote");
-               set.addChild("gateway");
+               set.addChild("gateway");      // to be removed
+               set.addChild("mux");


                Node get = parent.addChild("get");
                get.addChild("part");
                get.addChild("remote");
                get.addChild("gateway");
-
+               get.addChild("mux");
        };

        public Isup2SipCommandHandler() {
=======================================
--- /core/slee/sbbs/src/main/java/org/mobicents/isup2sip/sbb/Isup2SipSbb.java Thu Sep 19 20:15:05 2013 UTC +++ /core/slee/sbbs/src/main/java/org/mobicents/isup2sip/sbb/Isup2SipSbb.java Sat Sep 28 01:33:30 2013 UTC
@@ -76,7 +76,7 @@
 import javax.slee.SbbLocalObject;
 import javax.slee.UnrecognizedActivityException;
 import javax.slee.facilities.Tracer;
-
+import javax.slee.serviceactivity.ServiceStartedEvent;

 import net.java.slee.resource.mgcp.JainMgcpProvider;
 import net.java.slee.resource.mgcp.MgcpActivityContextInterfaceFactory;
@@ -711,8 +711,12 @@
                        tracer.severe(e.getMessage(), e);
                }
        }
-
-
+
+ public void onServiceStartedEvent(ServiceStartedEvent event, ActivityContextInterface aci){
+               tracer.severe("service started");
+//             isup2SipPropertiesManagement.registerIsupManagement();
+//             aci.detach(sbbContext.getSbbLocalObject());
+       }

        public void showMe(){
                tracer.warning("object: " + sbbContext.getSbbLocalObject()
=======================================
--- /core/slee/sbbs/src/main/java/org/mobicents/isup2sip/sbb/IsupManagementSbb.java Thu Sep 19 20:15:05 2013 UTC +++ /core/slee/sbbs/src/main/java/org/mobicents/isup2sip/sbb/IsupManagementSbb.java Sat Sep 28 01:33:30 2013 UTC
@@ -87,13 +87,17 @@
private static final Isup2SipPropertiesManagement isup2SipPropertiesManagement =
                Isup2SipPropertiesManagement.getInstance();

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

-
+ private static final int remoteSPC = isup2SipPropertiesManagement.getRemoteSPC();
+
+    public IsupManagementSbb(){ }
+
     // Initial event
public void onRequestIsupResetsEvent(RequestIsupResetsEvent event, ActivityContextInterface aci){
+
+       tracer.warning("ISUP reset requested for some multiplex");
+
        final int mux = event.getMultiplexId();
        this.setMultiplex(mux);

@@ -165,8 +169,8 @@

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


=======================================
--- /core/slee/sbbs/src/main/java/org/mobicents/isup2sip/sbb/MgcpManagementSbb.java Thu Sep 19 20:15:05 2013 UTC +++ /core/slee/sbbs/src/main/java/org/mobicents/isup2sip/sbb/MgcpManagementSbb.java Sat Sep 28 01:33:30 2013 UTC
@@ -76,13 +76,15 @@
private static final Isup2SipPropertiesManagement isup2SipPropertiesManagement =
                Isup2SipPropertiesManagement.getInstance();

- private final CicManagement cicManagement = isup2SipPropertiesManagement.getCicManagement();
-
- private final int remoteSPC = isup2SipPropertiesManagement.getRemoteSPC();
-
+ private static final CicManagement cicManagement = isup2SipPropertiesManagement.getCicManagement();
+
+ private static final 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();

@@ -144,10 +146,11 @@
                aci.detach(sbbContext.getSbbLocalObject());
        }

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


=======================================
--- /core/slee/sbbs/src/main/resources/META-INF/sbb-jar.xml Thu Sep 19 20:15:05 2013 UTC +++ /core/slee/sbbs/src/main/resources/META-INF/sbb-jar.xml Sat Sep 28 01:33:30 2013 UTC
@@ -37,6 +37,17 @@
                        </sbb-abstract-class>
                </sbb-classes>

+               <event event-direction="Receive" initial-event="True">
+                       <event-name>ServiceStartedEvent</event-name>
+                       <event-type-ref>
+                               <event-type-name>
+                                       
javax.slee.serviceactivity.ServiceStartedEvent
+                               </event-type-name>
+                               
<event-type-vendor>javax.slee</event-type-vendor>
+                               <event-type-version>1.1</event-type-version>
+                       </event-type-ref>
+               </event>
+
                <event event-direction="Receive" initial-event="True">
                        <event-name>IAM</event-name>
                        <event-type-ref>
@@ -45,16 +56,18 @@
                                <event-type-version>1.0</event-type-version>
                        </event-type-ref>
                </event>
+
                <event event-direction="Receive" initial-event="False">
-               <event-name>ACM</event-name>
+                       <event-name>ACM</event-name>
                        <event-type-ref>
<event-type-name>net.java.slee.resource.isup.ADDRESS_COMPLETE</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>ANM</event-name>
+                       <event-name>ANM</event-name>
                        <event-type-ref>
                                
<event-type-name>net.java.slee.resource.isup.ANSWER</event-type-name>
                                <event-type-vendor>net.java</event-type-vendor>
@@ -266,12 +279,12 @@
                <event event-direction="Receive" initial-event="True">
                        <event-name>RequestRsipEvent</event-name>
                        <event-type-ref>
-                               
<event-type-name>org.mobicents.isup2sip.REQ_RSIP</event-type-name>
+ <event-type-name>org.mobicents.isup2sip.commonlibs.REQ_RSIP</event-type-name>
                                
<event-type-vendor>org.mobicents</event-type-vendor>
                                <event-type-version>1.0</event-type-version>
                        </event-type-ref>
                </event>
-
+<!--
                <event event-direction="Receive" initial-event="True">
                        <event-name>ServiceStartedEvent</event-name>
                        <event-type-ref>
@@ -282,7 +295,7 @@
                                <event-type-version>1.1</event-type-version>
                        </event-type-ref>
                </event>
-
+-->
                <event event-direction="Receive" initial-event="False">
                        <event-name>MgcpTIMEOUT</event-name>
                        <event-type-ref>
@@ -344,7 +357,14 @@
                                </cmp-field>
                        </sbb-abstract-class>
                </sbb-classes>
-
+<!--
+                <library-ref>
+                        <library-name>isup2sip.management</library-name>
+                        <library-vendor>org.mobicents</library-vendor>
+                        <library-version>1.0</library-version>
+                </library-ref>
+-->
+<!--
                <event event-direction="Receive" initial-event="True">
                        <event-name>ServiceStartedEvent</event-name>
                        <event-type-ref>
@@ -355,11 +375,11 @@
                                <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>
-                               
<event-type-name>org.mobicents.isup2sip.REQ_RSC_GRS</event-type-name>
+ <event-type-name>org.mobicents.isup2sip.commonlibs.REQ_RSC_GRS</event-type-name>
                                
<event-type-vendor>org.mobicents</event-type-vendor>
                                <event-type-version>1.0</event-type-version>
                        </event-type-ref>
@@ -374,7 +394,7 @@
                        </event-type-ref>
                </event>

-                <event event-direction="Receive" initial-event="False">
+<!--                <event event-direction="Receive" initial-event="False">
                        <event-name>TimerEvent</event-name>
                        <event-type-ref>
                                
<event-type-name>javax.slee.facilities.TimerEvent</event-type-name>
@@ -382,7 +402,7 @@
                                <event-type-version>1.0</event-type-version>
                        </event-type-ref>
                </event>
-
+-->
                <resource-adaptor-type-binding>
                        <resource-adaptor-type-ref>
<resource-adaptor-type-name>ISUPResourceAdaptorType</resource-adaptor-type-name>
=======================================
--- /core/slee/services-du/pom.xml      Sun Aug  4 00:08:46 2013 UTC
+++ /core/slee/services-du/pom.xml      Sat Sep 28 01:33:30 2013 UTC
@@ -14,11 +14,18 @@
        <name>Core : SLEE : Service</name>

        <dependencies>
+               <dependency>
+                       <artifactId>commonlibs</artifactId>
+                       <groupId>${pom.groupId}</groupId>
+                       <version>${pom.version}</version>
+               </dependency>
+
                <dependency>
                        <artifactId>sbbs</artifactId>
                        <groupId>${pom.groupId}</groupId>
                        <version>${pom.version}</version>
                </dependency>
+
        </dependencies>



==============================================================================
Revision: beec7c88ed49
Author:   dmisol <[email protected]>
Date:     Sat Sep 28 08:11:53 2013 UTC
Log:      added cli commands

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

Modified:
/core/domain/src/main/java/org/mobicents/isup2sip/management/Isup2SipPropertiesManagement.java /core/oam/cli/src/main/java/org/mobicents/isup2sip/management/console/impl/Isup2SipCommandHandler.java

=======================================
--- /core/domain/src/main/java/org/mobicents/isup2sip/management/Isup2SipPropertiesManagement.java Sat Sep 28 01:33:30 2013 UTC +++ /core/domain/src/main/java/org/mobicents/isup2sip/management/Isup2SipPropertiesManagement.java Sat Sep 28 08:11:53 2013 UTC
@@ -50,14 +50,14 @@
        private static final org.apache.log4j.Logger logger = Logger
                        .getLogger(Isup2SipPropertiesManagement.class);

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

 //     protected static final String GATEWAY = "gateway";    // to be removed
 //     protected static final String GATEWAY_PART = "part";  // to be removed

        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 SIP_PEER = "sippeer";
+       protected static final String SIP_IP = "sipip";
        protected static final String MUX = "mux";

        public static final String ISUP_TO_SIP = "i2s";
@@ -314,7 +314,7 @@
                                        persistFile.toString()));

 //                     binding.setAlias(Multiplex.class, "pcm");
-                       reader.setBinding(binding);
+   //                  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);
=======================================
--- /core/oam/cli/src/main/java/org/mobicents/isup2sip/management/console/impl/Isup2SipCommandHandler.java Sat Sep 28 01:33:30 2013 UTC +++ /core/oam/cli/src/main/java/org/mobicents/isup2sip/management/console/impl/Isup2SipCommandHandler.java Sat Sep 28 08:11:53 2013 UTC
@@ -37,17 +37,19 @@
                Node parent = commandTree.getTopNode();

                Node set = parent.addChild("set");
- set.addChild("part"); // gateway's part, for debuggig. When a single card acts as two gateways
+               set.addChild("mux");
                set.addChild("remote");
-               set.addChild("gateway");      // to be removed
-               set.addChild("mux");
+               set.addChild("sipip");
+               set.addChild("sippeer");
+


                Node get = parent.addChild("get");
-               get.addChild("part");
+               get.addChild("mux");
                get.addChild("remote");
-               get.addChild("gateway");
-               get.addChild("mux");
+               get.addChild("sipip");
+               get.addChild("sippeer");
+
        };

        public Isup2SipCommandHandler() {

--

--- 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