Revision: 73aa0f07b6a7
Author:   Alexandre Mendonça <ammendonca>
Date:     Wed Jan 29 00:43:39 2014 UTC
Log:      Several enhancements:
- Rating can be enabled/disabled by SBB configuration;
- Ability to pass generic data from CCR AVPs to ABMF Module/SBB, configured at SBB;
- Added Final-Unit-Indication AVP to terminate/error answers;
- Added a Local rating Module/SBB;
- Other fixes and enhancements...

http://code.google.com/p/charging-server/source/detail?r=73aa0f07b6a7

Added:
/sbb/src/main/java/org/mobicents/charging/server/ratingengine/local/LocalRatingEngineSbb.java
Modified:
 /.gitignore
/sbb/src/main/java/org/mobicents/charging/server/DiameterChargingServerSbb.java /sbb/src/main/java/org/mobicents/charging/server/account/AccountBalanceManagementSbb.java /sbb/src/main/java/org/mobicents/charging/server/account/CreditControlInfo.java
 /sbb/src/main/resources/META-INF/sbb-jar.xml
 /testsuite/seagull/logs/.gitignore

=======================================
--- /dev/null
+++ /sbb/src/main/java/org/mobicents/charging/server/ratingengine/local/LocalRatingEngineSbb.java Wed Jan 29 00:43:39 2014 UTC
@@ -0,0 +1,60 @@
+/*
+ * TeleStax, Open Source Cloud Communications
+ * Copyright 2014, TeleStax and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for
+ * a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.mobicents.charging.server.ratingengine.local;
+
+import org.mobicents.charging.server.BaseSbb;
+import org.mobicents.charging.server.ratingengine.RatingEngineClient;
+import org.mobicents.charging.server.ratingengine.RatingInfo;
+import org.mobicents.slee.SbbContextExt;
+
+import javax.slee.Sbb;
+import javax.slee.SbbContext;
+import javax.slee.facilities.Tracer;
+import java.util.HashMap;
+
+/**
+ * SBB for Rating Engine Client implementation sample. This always returns success.
+ *
+ * @author ammendonca
+ */
+public class LocalRatingEngineSbb extends BaseSbb implements Sbb, RatingEngineClient {
+
+       private Tracer tracer;
+
+       private SbbContextExt sbbContext;
+
+       public void setSbbContext(SbbContext context) {
+
+               this.sbbContext = (SbbContextExt) context;
+               this.tracer = sbbContext.getTracer("CS-RF-FREE");
+       }
+       @Override
+       public RatingInfo getRateForService(HashMap params) {
+               String sessionId = (String) params.get("SessionId");
+               if (tracer.isInfoEnabled()) {
+ tracer.info("[$$] SID<" + sessionId + "> Performing rating with the FREE Rating Module.");
+               }
+               return new RatingInfo(0, sessionId);
+       }
+
+}
=======================================
--- /.gitignore Tue Sep 10 02:24:21 2013 UTC
+++ /.gitignore Wed Jan 29 00:43:39 2014 UTC
@@ -1,6 +1,7 @@
 # Java compiled #
 #################
 *.class
+classes

 # Eclipse #
 ###########
=======================================
--- /sbb/src/main/java/org/mobicents/charging/server/DiameterChargingServerSbb.java Tue Sep 10 00:45:40 2013 UTC +++ /sbb/src/main/java/org/mobicents/charging/server/DiameterChargingServerSbb.java Wed Jan 29 00:43:39 2014 UTC
@@ -51,11 +51,16 @@
 import javax.slee.resource.ResourceAdaptorTypeID;
 import javax.slee.serviceactivity.ServiceStartedEvent;

+import net.java.slee.resource.diameter.base.events.avp.DiameterAvp;
+import net.java.slee.resource.diameter.base.events.avp.DiameterAvpType;
 import net.java.slee.resource.diameter.base.events.avp.DiameterResultCode;
+import net.java.slee.resource.diameter.base.events.avp.GroupedAvp;
 import net.java.slee.resource.diameter.cca.events.avp.CcMoneyAvp;
 import net.java.slee.resource.diameter.cca.events.avp.CcRequestType;
 import net.java.slee.resource.diameter.cca.events.avp.CcUnitType;
import net.java.slee.resource.diameter.cca.events.avp.CreditControlResultCode;
+import net.java.slee.resource.diameter.cca.events.avp.FinalUnitActionType;
+import net.java.slee.resource.diameter.cca.events.avp.FinalUnitIndicationAvp; import net.java.slee.resource.diameter.cca.events.avp.GrantedServiceUnitAvp; import net.java.slee.resource.diameter.cca.events.avp.MultipleServicesCreditControlAvp; import net.java.slee.resource.diameter.cca.events.avp.RequestedServiceUnitAvp;
@@ -92,6 +97,8 @@
        private static final long DEFAULT_VALIDITY_TIME = 86400;
private static final TimerOptions DEFAULT_TIMER_OPTIONS = new TimerOptions(0, TimerPreserveMissed.ALL);

+ private boolean performRating = true; // true = centralized, false = decentralized (ie, has been done by CTF (eg SIP AS))
+
        private static TimerOptions createDefaultTimerOptions() {
                TimerOptions timerOptions = new TimerOptions();
                timerOptions.setPreserveMissed(TimerPreserveMissed.ALL);
@@ -115,6 +122,8 @@
         */
        private static HashMap<Integer, Integer> serviceIdUnits;

+ private static HashMap<String, String> abmfAVPs = new HashMap<String, String>();
+
// ---------------------------- SLEE Callbacks ----------------------------

        public void setSbbContext(SbbContext context) {
@@ -262,7 +271,23 @@

                try {
                        Context ctx = (Context) new 
InitialContext().lookup("java:comp/env");
- boolean loadUsersFromCSV = Boolean.valueOf((Boolean)ctx.lookup("loadUsersFromCSV"));
+                       boolean loadUsersFromCSV = (Boolean) 
ctx.lookup("loadUsersFromCSV");
+                       performRating = (Boolean) ctx.lookup("performRating");
+
+                       String abmfAVPsProp = ((String) 
ctx.lookup("ABMF_AVPs"));
+                       try {
+                               String[] avps = abmfAVPsProp.trim().split(",");
+                               for (String avp : avps) {
+                                       String[] codeName = 
avp.trim().split("=");
+                                       if (tracer.isInfoEnabled()) {
+ tracer.info("[><] Mapping AVP with Code " + codeName[0] + " as '" + codeName[1] + "' on received CCRs for ABMF Data.");
+                                       }
+                                       abmfAVPs.put(codeName[0], codeName[1]);
+                               }
+                       }
+                       catch (Exception e) {
+ tracer.warning("[!!] Error reading ABMF Data AVPs. Format should be: code=name,code2=name2,... No custom data will be passed.");
+                       }

                        if (loadUsersFromCSV) {
                                try {
@@ -373,13 +398,7 @@
                if (endUserId == null) {
tracer.severe("[xx] SID<" + sessionId + "> Subscription-Id AVP is present but could not read it's data. Rejecting CCR."); cca = createCCA(ccServerActivity, ccr, null, DiameterResultCode.DIAMETER_MISSING_AVP);
-                       try {
-                               ccServerActivity.sendRoCreditControlAnswer(cca);
-                       }
-                       catch (IOException e) {
- tracer.severe("[xx] SID<" + sessionId + "> Error while trying to send Credit-Control-Answer.", e);
-                       }
-                       aci.detach(this.getSbbContext().getSbbLocalObject());
+                       sendCCA(cca, aci, true);
                        return;
                }

@@ -392,7 +411,8 @@
                        // ... intentionally did not break;
                        // UPDATE_REQUEST 2
                case UPDATE_REQUEST:
- timerFacility.setTimer(aci, null, System.currentTimeMillis() + 15000, DEFAULT_TIMER_OPTIONS);
+                       // FIXME: We may need to set timeout timer.. but not 
like this.
+ // timerFacility.setTimer(aci, null, System.currentTimeMillis() + 15000, DEFAULT_TIMER_OPTIONS);

                        try {
                                accountBalanceManagement = getAccountManager();
@@ -417,7 +437,7 @@
                                        ratingEngineManagement = 
getRatingEngineManager();
                                }
                                catch (Exception e) {
- tracer.severe("[xx] Unable to fetch Rating Engine Management Child SBB .", e); + tracer.severe("[xx] Unable to fetch Rating Engine Management Child SBB.", e);
                                        return;
                                }

@@ -425,6 +445,9 @@
                                long resultCode = 
DiameterResultCode.DIAMETER_SUCCESS;

MultipleServicesCreditControlAvp[] multipleServicesCreditControlAvps = ccr.getMultipleServicesCreditControls(); + if (multipleServicesCreditControlAvps != null && tracer.isInfoEnabled()) { + tracer.info("[--] SID<" + sessionId + "> Received CCR has Multiple-Services-Credit-Control AVP with length = " + multipleServicesCreditControlAvps.length);
+                               }
for (MultipleServicesCreditControlAvp mscc : multipleServicesCreditControlAvps) {

                                        long[] serviceIds = 
mscc.getServiceIdentifiers();
@@ -438,10 +461,13 @@
                                        if (requestedUnits > 0) {
                                                CreditControlUnit ccUnit = new 
CreditControlUnit();
                                                
ccUnit.setUnitType(CcUnitType.INPUT_OCTETS);
- double rateForService = getRateForService(ccr, ratingEngineManagement, serviceIds[0], CcUnitType.INPUT_OCTETS.getValue(), requestedUnits);
-                                               
ccUnit.setRateForService(rateForService);
+                                               if (performRating) {
+ double rateForService = getRateForService(ccr, ratingEngineManagement, serviceIds[0], CcUnitType.INPUT_OCTETS.getValue(), requestedUnits);
+                                                       
ccUnit.setRateForService(rateForService);
+ // FIXME: This is not right. Rating should convert to monetary units... + ccUnit.setRequestedAmount((long) Math.ceil(requestedUnits * rateForService));
+                                               }
                                                
ccUnit.setRequestedUnits(requestedUnits);
- ccUnit.setRequestedAmount((long)Math.ceil(requestedUnits*rateForService));
                                                ccRequestedUnits.add(ccUnit);
                                        }
                                        // Money
@@ -451,10 +477,13 @@
                                                if (requestedUnits > 0) {
                                                        CreditControlUnit 
ccUnit = new CreditControlUnit();
                                                        
ccUnit.setUnitType(CcUnitType.MONEY);
- double rateForService = getRateForService(ccr, ratingEngineManagement, serviceIds[0],CcUnitType.MONEY.getValue(), requestedUnits);
-                                                       
ccUnit.setRateForService(rateForService);
+                                                       if (performRating) {
+ double rateForService = getRateForService(ccr, ratingEngineManagement, serviceIds[0],CcUnitType.MONEY.getValue(), requestedUnits);
+                                                               
ccUnit.setRateForService(rateForService);
+ // FIXME: This is not right. Rating should convert to monetary units... + ccUnit.setRequestedAmount((long) Math.ceil(requestedUnits * rateForService));
+                                                       }
                                                        
ccUnit.setRequestedUnits(requestedUnits);
- ccUnit.setRequestedAmount((long)Math.ceil(requestedUnits*rateForService));
                                                        
ccUnit.setCcMoney(rsu.getCreditControlMoneyAvp());
                                                        
ccRequestedUnits.add(ccUnit);
                                                }
@@ -464,10 +493,13 @@
                                        if (requestedUnits > 0) {
                                                CreditControlUnit ccUnit = new 
CreditControlUnit();
                                                
ccUnit.setUnitType(CcUnitType.OUTPUT_OCTETS);
- double rateForService = getRateForService(ccr, ratingEngineManagement, serviceIds[0], CcUnitType.OUTPUT_OCTETS.getValue(), requestedUnits);
-                                               
ccUnit.setRateForService(rateForService);
+                                               if (performRating) {
+ double rateForService = getRateForService(ccr, ratingEngineManagement, serviceIds[0], CcUnitType.OUTPUT_OCTETS.getValue(), requestedUnits);
+                                                       
ccUnit.setRateForService(rateForService);
+ // FIXME: This is not right. Rating should convert to monetary units... + ccUnit.setRequestedAmount((long) Math.ceil(requestedUnits * rateForService));
+                                               }
                                                
ccUnit.setRequestedUnits(requestedUnits);
- ccUnit.setRequestedAmount((long)Math.ceil(requestedUnits*rateForService));
                                                ccRequestedUnits.add(ccUnit);
                                        }
                                        // Service Specific Units
@@ -475,10 +507,13 @@
                                        if (requestedUnits > 0) {
                                                CreditControlUnit ccUnit = new 
CreditControlUnit();
                                                
ccUnit.setUnitType(CcUnitType.SERVICE_SPECIFIC_UNITS);
- double rateForService = getRateForService(ccr, ratingEngineManagement, serviceIds[0], CcUnitType.SERVICE_SPECIFIC_UNITS.getValue(), requestedUnits);
-                                               
ccUnit.setRateForService(rateForService);
+                                               if (performRating) {
+ double rateForService = getRateForService(ccr, ratingEngineManagement, serviceIds[0], CcUnitType.SERVICE_SPECIFIC_UNITS.getValue(), requestedUnits);
+                                                       
ccUnit.setRateForService(rateForService);
+ // FIXME: This is not right. Rating should convert to monetary units... + ccUnit.setRequestedAmount((long) Math.ceil(requestedUnits * rateForService));
+                                               }
                                                
ccUnit.setRequestedUnits(requestedUnits);
- ccUnit.setRequestedAmount((long)Math.ceil(requestedUnits*rateForService));
                                                ccRequestedUnits.add(ccUnit);
                                        }
                                        // Time
@@ -486,10 +521,13 @@
                                        if (requestedUnits > 0) {
                                                CreditControlUnit ccUnit = new 
CreditControlUnit();
                                                
ccUnit.setUnitType(CcUnitType.TIME);
- double rateForService = getRateForService(ccr, ratingEngineManagement, serviceIds[0], CcUnitType.TIME.getValue(), requestedUnits);
-                                               
ccUnit.setRateForService(rateForService);
+                                               if (performRating) {
+ double rateForService = getRateForService(ccr, ratingEngineManagement, serviceIds[0], CcUnitType.TIME.getValue(), requestedUnits);
+                                                       
ccUnit.setRateForService(rateForService);
+ // FIXME: This is not right. Rating should convert to monetary units... + ccUnit.setRequestedAmount((long) Math.ceil(requestedUnits * rateForService));
+                                               }
                                                
ccUnit.setRequestedUnits(requestedUnits);
- ccUnit.setRequestedAmount((long)Math.ceil(requestedUnits*rateForService));
                                                ccRequestedUnits.add(ccUnit);
                                        }
                                        // Total Octets
@@ -497,10 +535,13 @@
                                        if (requestedUnits > 0) {
                                                CreditControlUnit ccUnit = new 
CreditControlUnit();
                                                
ccUnit.setUnitType(CcUnitType.TOTAL_OCTETS);
- double rateForService = getRateForService(ccr, ratingEngineManagement, serviceIds[0], CcUnitType.TOTAL_OCTETS.getValue(), requestedUnits);
-                                               
ccUnit.setRateForService(rateForService);
+                                               if (performRating) {
+ double rateForService = getRateForService(ccr, ratingEngineManagement, serviceIds[0], CcUnitType.TOTAL_OCTETS.getValue(), requestedUnits);
+                                                       
ccUnit.setRateForService(rateForService);
+ // FIXME: This is not right. Rating should convert to monetary units... + ccUnit.setRequestedAmount((long) Math.ceil(requestedUnits * rateForService));
+                                               }
                                                
ccUnit.setRequestedUnits(requestedUnits);
- ccUnit.setRequestedAmount((long)Math.ceil(requestedUnits*rateForService));
                                                ccRequestedUnits.add(ccUnit);
                                        }

@@ -666,7 +707,13 @@
                                                
ccInfo.setSubscriptionId(endUserId);
                                                
ccInfo.setSubscriptionIdType(endUserType);
                                                
ccInfo.setCcUnits(ccRequestedUnits);
-                                               // Call ABMF with this Credit 
Control Info
+
+                                               // Iterate CCR to capture 
needed AVPs
+                                               for (DiameterAvp avp : 
ccr.getAvps()) {
+                                                       fetchDataFromAvp(avp, 
ccInfo);
+                                               }
+
+                                               // Call ABMF with this Credit 
Control Info
                                                
accountBalanceManagement.initialRequest(ccInfo);

                                                // Store Credit Control Info in 
CMP
@@ -678,7 +725,7 @@
                                                setSessionInfo(sessionInfo);

                                                return; // we'll continue @ 
resumeOnCreditControlRequest(..)
-                                       }
+                                       }
                                }

                                if (reservations.size() > 0) {
@@ -1138,9 +1185,22 @@
                                        }
                                        ansMscc.setGrantedServiceUnit(gsu);
                                        
ansMscc.setResultCode(DiameterResultCode.DIAMETER_SUCCESS);
+
+                                       // TODO: Have Final-Unit-Indication 
when needed...
+ // If we are terminating gracefully we MAY include the Final-Unit-Indication
+                                       if (answer.getCcRequestType() == 
CcRequestType.TERMINATION_REQUEST) {
+ FinalUnitIndicationAvp fuiAvp = avpFactory.createFinalUnitIndication();
+                                               
fuiAvp.setFinalUnitAction(FinalUnitActionType.TERMINATE);
+                                               
ansMscc.setFinalUnitIndication(fuiAvp);
+                                       }
                                }
                                else {
-                                       
ansMscc.setResultCode(getResultCode(ccInfo.getErrorCodeType()));
+                                       // In case it's not successful we want 
to have Final-Unit-Indication
+ FinalUnitIndicationAvp fuiAvp = avpFactory.createFinalUnitIndication();
+                                       
fuiAvp.setFinalUnitAction(FinalUnitActionType.TERMINATE);
+                                       ansMscc.setFinalUnitIndication(fuiAvp);
+
+                                       ansMscc.setResultCode(resultCode);
                                }
                                ansMSCCs.add(ansMscc);
                                ansMscc.setValidityTime(DEFAULT_VALIDITY_TIME);
@@ -1173,6 +1233,28 @@

                return answer;
        }
+
+       /**
+        * Sends the Credit-Control-Answer through the ACI and detaches if set 
to.
+        * @param cca the Credit-Control-Answer to send
+        * @param aci the ACI where to send from
+        * @param detach boolean indicating whether to detach or not
+        * @return true if it succeeds sending, false otherwise
+        */
+ private boolean sendCCA(RoCreditControlAnswer cca, ActivityContextInterface aci, boolean detach) {
+               try {
+ RoServerSessionActivity ccServerActivity = (RoServerSessionActivity) aci.getActivity();
+                       ccServerActivity.sendRoCreditControlAnswer(cca);
+                       if (detach) {
+                               
aci.detach(this.getSbbContext().getSbbLocalObject());
+                       }
+                       return true;
+               }
+               catch (IOException e) {
+ tracer.severe("[xx] SID<" + cca.getSessionId() + "> Error while trying to send Credit-Control-Answer.", e);
+                       return false;
+               }
+       }

        //private String storedEndUserId;
        //private long storedRequestedUnits;
@@ -1199,8 +1281,10 @@
                        if (tracer.isInfoEnabled()) {
tracer.info("[>>] SID<" + storedCCR.getSessionId() + "> '" + sessionInfo.getEndUserId() + "' DENIED for '" + Arrays.toString(sessionInfo.getServiceIds()) + "'.");
                        }
-                       resultCode = getResultCode(ccInfo.getErrorCodeType());
+                       // If we can't determine error, say UNABLE_TO_COMPLY
+ resultCode = ccInfo.getErrorCodeType() != null ? getResultCode(ccInfo.getErrorCodeType()) : DiameterResultCode.DIAMETER_UNABLE_TO_COMPLY;
                }
+
                try {
RoServerSessionActivity activity = getServerSessionActivityToReply(storedCCR.getCcRequestType() == CcRequestType.TERMINATION_REQUEST || storedCCR.getCcRequestType() == CcRequestType.EVENT_REQUEST); RoCreditControlAnswer cca = sessionInfo.getReservations().size() > 0 ? createCCA(activity, storedCCR, sessionInfo.getReservations(), resultCode) : createCCA(activity, storedCCR, null, DiameterResultCode.DIAMETER_MISSING_AVP);
@@ -1487,6 +1571,99 @@
                return unitId;
        }
        */
+
+       /**
+        * Convert IP4 address to String
+        * @param address byte array
+        * @return String
+        */
+       private String byteArrayToStringIp(byte[] address) {
+               if(address == null || address.length != 4) {
+                       return "0.0.0.0";
+               }
+               String stringIp = "";
+               for (byte number:address) {
+                       stringIp+=(number & 0xFF) + ".";
+               }
+               return stringIp.substring(0, stringIp.length()-1);
+       }
+
+       /**
+ * Fetch data from AVP to be passed in CreditControlInfo, as configured in env entry.
+        * @param avp the AVP to look at
+        * @param ccInfo the CreditControlInfo object to store properties at
+        */
+       private void fetchDataFromAvp(DiameterAvp avp, CreditControlInfo 
ccInfo) {
+               fetchDataFromAvp(avp, ccInfo, 0);
+       }
+
+       /**
+ * Fetch data from AVP to be passed in CreditControlInfo, as configured in env entry.
+        * @param avp the AVP to look at
+        * @param ccInfo the CreditControlInfo object to store properties at
+        * @param depth the AVP depth, for recursive calls
+        */
+ private void fetchDataFromAvp(DiameterAvp avp, CreditControlInfo ccInfo, int depth) {
+               if (tracer.isFineEnabled()) {
+ tracer.fine("[><] Scanning AVP at depth " + depth + " with code " + avp.getCode() + " and type " + avp.getType() + " ...");
+               }
+               if(avp.getType() == DiameterAvpType.GROUPED) {
+                       GroupedAvp gAvp = (GroupedAvp) avp;
+                       DiameterAvp[] subAvps = gAvp.getExtensionAvps();
+                       for(DiameterAvp subAvp : subAvps) {
+                               fetchDataFromAvp(subAvp, ccInfo, depth+1);
+                       }
+               }
+               else {
+                       String name = 
abmfAVPs.get(String.valueOf(avp.getCode()));
+                       if (name != null) {
+                               Object value = null;
+                               switch (avp.getType().getType())
+                               {
+                                       case DiameterAvpType._ADDRESS:
+                                       case DiameterAvpType._DIAMETER_IDENTITY:
+                                       case DiameterAvpType._DIAMETER_URI:
+                                       case DiameterAvpType._IP_FILTER_RULE:
+                                       case DiameterAvpType._OCTET_STRING:
+                                       case DiameterAvpType._QOS_FILTER_RULE:
+                                               value = avp.octetStringValue();
+                                               break;
+                                       case DiameterAvpType._ENUMERATED:
+                                       case DiameterAvpType._INTEGER_32:
+                                               value = avp.intValue();
+                                               break;
+                                       case DiameterAvpType._FLOAT_32:
+                                               value = avp.floatValue();
+                                               break;
+                                       case DiameterAvpType._FLOAT_64:
+                                               value = avp.doubleValue();
+                                               break;
+                                       case DiameterAvpType._INTEGER_64:
+                                               value = avp.longValue();
+                                               break;
+                                       case DiameterAvpType._TIME:
+                                               value = avp.longValue();
+                                               break;
+                                       case DiameterAvpType._UNSIGNED_32:
+                                               value = avp.longValue();
+                                               break;
+                                       case DiameterAvpType._UNSIGNED_64:
+                                               value = avp.longValue();
+                                               break;
+                                       case DiameterAvpType._UTF8_STRING:
+                                               value = avp.octetStringValue();
+                                               break;
+                                       default:
+                                               value = avp.byteArrayValue();
+                                               break;
+                               }
+                               if (tracer.isFineEnabled()) {
+ tracer.info("[><] Storing AVP with code " + avp.getCode() + " as '" + name + "' with value '" + value.toString() + "'");
+                               }
+                               ccInfo.addServiceInfo(name, value.toString());
+                       }
+               }
+       }

        // 'sessionInfo' CMP field setter
        public abstract void setSessionInfo(UserSessionInfo value);
=======================================
--- /sbb/src/main/java/org/mobicents/charging/server/account/AccountBalanceManagementSbb.java Tue Sep 10 00:45:40 2013 UTC +++ /sbb/src/main/java/org/mobicents/charging/server/account/AccountBalanceManagementSbb.java Wed Jan 29 00:43:39 2014 UTC
@@ -264,6 +264,11 @@
                }
        }

+       /**
+        * Callback method from JDBC
+        * @param ccInfo
+        * @param uad
+        */
        @Override
public void reserveUnitsResult(CreditControlInfo ccInfo, UserAccountData uad) {
                if (tracer.isInfoEnabled()) {
=======================================
--- /sbb/src/main/java/org/mobicents/charging/server/account/CreditControlInfo.java Fri Jul 5 18:15:38 2013 UTC +++ /sbb/src/main/java/org/mobicents/charging/server/account/CreditControlInfo.java Wed Jan 29 00:43:39 2014 UTC
@@ -24,6 +24,7 @@

 import java.io.Serializable;
 import java.util.ArrayList;
+import java.util.HashMap;

 /**
  * Helper class for handling unit reservation
@@ -246,6 +247,21 @@
        public void setCcUnits(ArrayList<CreditControlUnit> ccUnits) {
                this.ccUnits = ccUnits;
        }
+
+       // Support for service specific values
+       HashMap<String, Object> serviceInfo = new HashMap<String, Object>();
+
+       public Object addServiceInfo(String name, Object value) {
+               return serviceInfo.put(name, value);
+       }
+
+       public Object removeServiceInfo(String name) {
+               return serviceInfo.remove(name);
+       }
+
+       public Object getServiceInfo(String name) {
+               return serviceInfo.get(name);
+       }

        @Override
        public String toString() {
=======================================
--- /sbb/src/main/resources/META-INF/sbb-jar.xml Tue Sep 10 00:45:40 2013 UTC +++ /sbb/src/main/resources/META-INF/sbb-jar.xml Wed Jan 29 00:43:39 2014 UTC
@@ -25,14 +25,15 @@
                </sbb-ref>

                <sbb-ref>
- <sbb-name>Mobicents Charging Server - Unit Rating and Determination Server HTTP Integration</sbb-name>
+                       <!--<sbb-name>Mobicents Charging Server HTTP Rating 
SBB</sbb-name>-->
+                       <sbb-name>Mobicents Charging Server Local Rating 
SBB</sbb-name>
                        <sbb-vendor>org.mobicents</sbb-vendor>
                        <sbb-version>1.0</sbb-version>
                        <sbb-alias>RatingEngineManagement</sbb-alias>
                </sbb-ref>

                <sbb-classes>
-                       <sbb-abstract-class>
+                       <sbb-abstract-class reentrant="True">
<sbb-abstract-class-name>org.mobicents.charging.server.DiameterChargingServerSbb</sbb-abstract-class-name>
                                <cmp-field>
                                        
<cmp-field-name>sessionInfo</cmp-field-name>
@@ -88,6 +89,20 @@
                        </event-type-ref>
                </event>

+               <env-entry>
+ <description>AVPs to pass to ABMF SBB (via CCInfo object) in format CODE/NAME,CODE/TYPE/NAME,...</description>
+                       <env-entry-name>ABMF_AVPs</env-entry-name>
+                       <env-entry-type>java.lang.String</env-entry-type>
+ <env-entry-value>9=location, 6=location-backup, 30=apn, 421=data-amount</env-entry-value>
+               </env-entry>
+
+               <env-entry>
+ <description>Perform Rating. If false no rating is performed and give units are used.</description>
+                       <env-entry-name>performRating</env-entry-name>
+                       <env-entry-type>java.lang.Boolean</env-entry-type>
+                       <env-entry-value>true</env-entry-value>
+               </env-entry>
+
                <env-entry>
                        <description>Load users database from CSV on start 
up</description>
                        <env-entry-name>loadUsersFromCSV</env-entry-name>
@@ -139,6 +154,7 @@
                        </sbb-local-interface>
                </sbb-classes>
        </sbb>
+
        <sbb>
                <description/>
                <sbb-name>Mobicents Charging Server Datasource SBB</sbb-name>
@@ -184,9 +200,27 @@
        </sbb>

        <sbb>
-               <description/>
+ <description>Rating Module/SBB for performing rating locally.</description>

- <sbb-name>Mobicents Charging Server - Unit Rating and Determination Server HTTP Integration</sbb-name>
+               <sbb-name>Mobicents Charging Server Local Rating SBB</sbb-name>
+               <sbb-vendor>org.mobicents</sbb-vendor>
+               <sbb-version>1.0</sbb-version>
+
+               <sbb-classes>
+                       <sbb-abstract-class>
+ <sbb-abstract-class-name>org.mobicents.charging.server.ratingengine.local.LocalRatingEngineSbb</sbb-abstract-class-name>
+                       </sbb-abstract-class>
+                       <sbb-local-interface 
isolate-security-permissions="False">
+ <description>SBB LO which allows integration with Rating Engine.</description> + <sbb-local-interface-name>org.mobicents.charging.server.ratingengine.RatingEngineManagementSbbLocalObject</sbb-local-interface-name>
+                       </sbb-local-interface>
+               </sbb-classes>
+       </sbb>
+
+       <sbb>
+ <description>Rating Module/SBB for performing rating through HTTP Client.</description>
+
+               <sbb-name>Mobicents Charging Server HTTP Rating SBB</sbb-name>
                <sbb-vendor>org.mobicents</sbb-vendor>
                <sbb-version>1.0</sbb-version>

=======================================
--- /testsuite/seagull/logs/.gitignore  Wed Jan  2 16:36:20 2013 UTC
+++ /testsuite/seagull/logs/.gitignore  Wed Jan 29 00:43:39 2014 UTC
@@ -0,0 +1,3 @@
+*.log
+*.csv
+

--

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