src/com/shrewdify/diaroser/impl/PeerImpl.java
@Override
		public byte[] processBillingRequest(byte[] b) throws IOException, NoSpaceException,SQLException,ArithmeticException {
			byte temp[] = Arrays.copyOfRange(b, Constants.ZERO, Constants.TWENTY);
			//HashSet<Avp> avpset = new HashSet<Avp>();
			Hashtable<Integer, Avp> hs = null;
			hs = par.decodeAvpSet(b, Constants.TWENTY);
			int state = Constants.ZERO;
			state = par.bytesToInt(hs.get(Dictionary.CC_REQUEST_TYPE).rawData);
			boolean existSession, loadedSession = true;
			String sessionId = null;
			switch (state) {
			case 1:
				log.debug("Got CCRI Request");
				sessionId = ("" + par.bytesToOctetString(hs.get(Dictionary.SESSION_ID).rawData))+ uri;


				synchronized (sessions) {

					existSession = sessions.containsKey(sessionId);
					if(!existSession){
						sessions.put(sessionId, new Hashtable<String, String>());	
					}
				}
				if (existSession) {
					return handleError(-4,hs,temp);
				}

				return processCCRI(b);
			case 2:
				log.debug("Got CCRU Request");
				sessionId = ("" + par.bytesToOctetString(hs.get(Dictionary.SESSION_ID).rawData))
						+ uri;
				existSession = sessions.containsKey(sessionId);

				if (!existSession)
					loadedSession = handleFault(sessionId, null);
				if (loadedSession || existSession)
					return processCCRU(b);
				return handleError(-5,hs,temp);
			case 3:
				log.debug("Got CCRT Request");
				sessionId = ("" + par.bytesToOctetString(hs.get(Dictionary.SESSION_ID).rawData))
						+ uri;
				existSession = sessions.containsKey(sessionId);
				if (!existSession)
					loadedSession = handleFault(sessionId, null);
				if (loadedSession || existSession)
					return processCCRT(b);
				return handleError(-5,hs,temp);
			case 4:
				log.debug("Got CCRE Request");
				return processCCRE(b);

			}
			return null;
		}
/**
		 * 
		 * 
		 * It Returns responses for billing requests, It Handles four types of requests CCRI(Credit Control Request Initial),
		 * 	CCRU(Credit Control Request Update), CCRT(Credit Control Request Terminate), CCRE(Credit Control Request Event).
		 * For all the above requests it checks for valid session and process the respone Correspondingly.
		 * 
		 */
It Returns responses for billing requests, It Handles four types of requests CCRI(Credit Control Request Initial),
CCRU(Credit Control Request Update), CCRT(Credit Control Request Terminate), CCRE(Credit Control Request Event).
For all the above requests it checks for valid session and process the respone Correspondingly.
It Returns responses for billing requests It Handles four types of requests CCRI ( Credit Control Request Initial ) CCRU ( Credit Control Request Update ) CCRT ( Credit Control Request Terminate ) CCRE ( Credit Control Request Event ) . For all the above requests it checks for valid session and process the respone Correspondingly .
@Override
		public byte[] processBillingRequest(byte[] b) throws IOException, NoSpaceException,SQLException,ArithmeticException {
			byte temp[] = Arrays.copyOfRange(b, Constants.ZERO, Constants.TWENTY);
			Hashtable<Integer, Avp> hs = null;
			hs = par.decodeAvpSet(b, Constants.TWENTY);
			int state = Constants.ZERO;
			state = par.bytesToInt(hs.get(Dictionary.CC_REQUEST_TYPE).rawData);
			boolean existSession, loadedSession = true;
			String sessionId = null;
			switch (state) {
			case 1:
				log.debug("Got CCRI Request");
				sessionId = ("" + par.bytesToOctetString(hs.get(Dictionary.SESSION_ID).rawData))+ uri;
				synchronized (sessions) {
					existSession = sessions.containsKey(sessionId);
					if(!existSession){
						sessions.put(sessionId, new Hashtable<String, String>());	
					}
				}
				if (existSession) {
					return handleError(-4,hs,temp);
				}
				return processCCRI(b);
			case 2:
				log.debug("Got CCRU Request");
				sessionId = ("" + par.bytesToOctetString(hs.get(Dictionary.SESSION_ID).rawData))
						+ uri;
				existSession = sessions.containsKey(sessionId);
				if (!existSession)
					loadedSession = handleFault(sessionId, null);
				if (loadedSession || existSession)
					return processCCRU(b);
				return handleError(-5,hs,temp);
			case 3:
				log.debug("Got CCRT Request");
				sessionId = ("" + par.bytesToOctetString(hs.get(Dictionary.SESSION_ID).rawData))
						+ uri;
				existSession = sessions.containsKey(sessionId);
				if (!existSession)
					loadedSession = handleFault(sessionId, null);
				if (loadedSession || existSession)
					return processCCRT(b);
				return handleError(-5,hs,temp);
			case 4:
				log.debug("Got CCRE Request");
				return processCCRE(b);
			}
			return null;
		}
@ Override public byte [ ] processBillingRequest ( byte [ ] b ) throws IOException , NoSpaceException , SQLException , ArithmeticException { byte temp [ ] = Arrays . copyOfRange ( b , Constants . ZERO , Constants . TWENTY ) ; Hashtable < Integer , Avp > hs = null ; hs = par . decodeAvpSet ( b , Constants . TWENTY ) ; int state = Constants . ZERO ; state = par . bytesToInt ( hs . get ( Dictionary . CC_REQUEST_TYPE ) . rawData ) ; boolean existSession , loadedSession = true ; String sessionId = null ; switch ( state ) { case 1 : log . debug ( "Got CCRI Request" ) ; sessionId = ( "" + par . bytesToOctetString ( hs . get ( Dictionary . SESSION_ID ) . rawData ) ) + uri ; synchronized ( sessions ) { existSession = sessions . containsKey ( sessionId ) ; if ( ! existSession ) { sessions . put ( sessionId , new Hashtable < String , String > ( ) ) ; } } if ( existSession ) { return handleError ( - 4 , hs , temp ) ; } return processCCRI ( b ) ; case 2 : log . debug ( "Got CCRU Request" ) ; sessionId = ( "" + par . bytesToOctetString ( hs . get ( Dictionary . SESSION_ID ) . rawData ) ) + uri ; existSession = sessions . containsKey ( sessionId ) ; if ( ! existSession ) loadedSession = handleFault ( sessionId , null ) ; if ( loadedSession || existSession ) return processCCRU ( b ) ; return handleError ( - 5 , hs , temp ) ; case 3 : log . debug ( "Got CCRT Request" ) ; sessionId = ( "" + par . bytesToOctetString ( hs . get ( Dictionary . SESSION_ID ) . rawData ) ) + uri ; existSession = sessions . containsKey ( sessionId ) ; if ( ! existSession ) loadedSession = handleFault ( sessionId , null ) ; if ( loadedSession || existSession ) return processCCRT ( b ) ; return handleError ( - 5 , hs , temp ) ; case 4 : log . debug ( "Got CCRE Request" ) ; return processCCRE ( b ) ; } return null ; }
//HashSet<Avp> avpset = new HashSet<Avp>();