You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openmeetings.apache.org by co...@google.com on 2013/02/18 04:51:00 UTC

[red5phone] r79 committed - System.out/err is replaced with log4j logging

Revision: 79
Author:   solomax666@gmail.com
Date:     Sun Feb 17 19:49:41 2013
Log:      System.out/err is replaced with log4j logging
http://code.google.com/p/red5phone/source/detail?r=79

Modified:
  /branches/red5sip/src/java/org/red5/codecs/SIPCodecFactory.java
  /branches/red5sip/src/java/org/red5/codecs/SIPCodecUtils.java
  /branches/red5sip/src/java/org/red5/codecs/SIPCodeciLBC.java
  /branches/red5sip/src/java/org/red5/codecs/g729/LspGetq.java
  /branches/red5sip/src/java/org/red5/codecs/ilbc/bitstream.java
  /branches/red5sip/src/java/org/red5/codecs/ilbc/ilbc_common.java
  /branches/red5sip/src/java/org/red5/codecs/ilbc/ilbc_decoder.java
  /branches/red5sip/src/java/org/red5/codecs/ilbc/ilbc_encoder.java
  /branches/red5sip/src/java/org/red5/codecs/ilbc/ilbc_ulp.java
  /branches/red5sip/src/java/org/red5/sip/app/BufferUtils.java
  /branches/red5sip/src/java/org/red5/sip/app/PlayNetStream.java
  /branches/red5sip/src/java/org/red5/sip/app/RTPStream.java
  /branches/red5sip/src/java/org/red5/sip/app/RTPStreamForMultiplex.java
   
/branches/red5sip/src/java/org/red5/sip/app/RTPStreamMultiplexingSender.java
  /branches/red5sip/src/java/org/red5/sip/app/RTPStreamReceiver.java
  /branches/red5sip/src/java/org/red5/sip/app/RTPStreamSender.java
  /branches/red5sip/src/java/org/red5/sip/app/SIPAudioLauncher.java
  /branches/red5sip/src/java/org/red5/sip/app/SIPRegisterAgent.java
  /branches/red5sip/src/java/org/red5/sip/app/SIPTransport.java
  /branches/red5sip/src/java/org/red5/sip/app/SIPUserAgent.java
  /branches/red5sip/src/java/org/red5/sip/app/SdpUtils.java
  /branches/red5sip/src/java/org/zoolu/sdp/SdpParser.java
  /branches/red5sip/src/java/org/zoolu/sdp/SessionDescriptor.java
  /branches/red5sip/src/java/org/zoolu/sip/address/NameAddress.java
   
/branches/red5sip/src/java/org/zoolu/sip/authentication/DigestAuthentication.java
  /branches/red5sip/src/java/org/zoolu/sip/header/ParametricHeader.java
  /branches/red5sip/src/java/org/zoolu/sip/message/BaseMessageFactory.java
  /branches/red5sip/src/java/org/zoolu/sip/provider/SipParser.java
  /branches/red5sip/src/java/org/zoolu/sip/provider/SipProvider.java
  /branches/red5sip/src/java/org/zoolu/sip/provider/SipStack.java
  /branches/red5sip/src/java/org/zoolu/sip/provider/SpcHashtable.java
  /branches/red5sip/src/java/org/zoolu/sip/provider/TcpTransport.java
  /branches/red5sip/src/java/org/zoolu/tools/Archive.java
  /branches/red5sip/src/java/org/zoolu/tools/Base64.java
  /branches/red5sip/src/java/org/zoolu/tools/Configure.java
  /branches/red5sip/src/java/org/zoolu/tools/Mangle.java
  /branches/red5sip/src/java/org/zoolu/tools/Parser.java

=======================================
--- /branches/red5sip/src/java/org/red5/codecs/SIPCodecFactory.java	Fri Feb  
10 07:37:46 2012
+++ /branches/red5sip/src/java/org/red5/codecs/SIPCodecFactory.java	Sun Feb  
17 19:49:41 2013
@@ -209,8 +209,6 @@


      private static void printLog( String method, String message ) {
-
          log.debug( "SIPCodecFactory - " + method + " -> " + message );
-        System.out.println( "SIPCodecFactory - " + method + " -> " +  
message );
      }
  }
=======================================
--- /branches/red5sip/src/java/org/red5/codecs/SIPCodecUtils.java	Thu Feb  
14 08:34:08 2013
+++ /branches/red5sip/src/java/org/red5/codecs/SIPCodecUtils.java	Sun Feb  
17 19:49:41 2013
@@ -161,8 +161,6 @@


      private static void printLog( String method, String message ) {
-
          log.debug( "SIPCodecUtils - " + method + " -> " + message );
-        System.out.println( "SIPCodecUtils - " + method + " -> " + message  
);
      }
  }
=======================================
--- /branches/red5sip/src/java/org/red5/codecs/SIPCodeciLBC.java	Thu Feb 14  
08:34:08 2013
+++ /branches/red5sip/src/java/org/red5/codecs/SIPCodeciLBC.java	Sun Feb 17  
19:49:41 2013
@@ -281,8 +281,6 @@


      private static void printLog( String method, String message ) {
-
          log.debug( "SIPCodecUtils - " + method + " -> " + message );
-        System.out.println( "SIPCodecUtils - " + method + " -> " + message  
);
      }
  }
=======================================
--- /branches/red5sip/src/java/org/red5/codecs/g729/LspGetq.java	Fri Feb 10  
07:37:46 2012
+++ /branches/red5sip/src/java/org/red5/codecs/g729/LspGetq.java	Sun Feb 17  
19:49:41 2013
@@ -1,7 +1,11 @@
  package org.red5.codecs.g729;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
  //package org.mobicents.media.server.impl.dsp.audio.g729;

  public class LspGetq {
+    protected static Logger log = LoggerFactory.getLogger(LspGetq.class);

  	 
/*----------------------------------------------------------------------------
  	 * lsp_get_quant - reconstruct quantized LSP parameter and check the  
stabilty
@@ -202,7 +206,7 @@

  	   if( buf[0] < LD8KConstants.L_LIMIT ) {
  	      buf[0] = LD8KConstants.L_LIMIT;
-	      System.out.println("warning LSP Low \n");
+	      log.warn("warning LSP Low \n");
  	   }
  	   for(j=0; j<LD8KConstants.M-1; j++) {
  	      diff = buf[j+1] - buf[j];
@@ -212,7 +216,7 @@
  	   }
  	   if( buf[LD8KConstants.M-1] > LD8KConstants.M_LIMIT ) {
  	      buf[LD8KConstants.M-1] = LD8KConstants.M_LIMIT;
-	      System.out.println("warning LSP High \n");
+	      log.warn("warning LSP High \n");
  	   }
  	   return;
  	}
=======================================
--- /branches/red5sip/src/java/org/red5/codecs/ilbc/bitstream.java	Fri Feb  
10 07:37:46 2012
+++ /branches/red5sip/src/java/org/red5/codecs/ilbc/bitstream.java	Sun Feb  
17 19:49:41 2013
@@ -94,11 +94,8 @@
     ){
         int posLeft;

-       //       System.out.println("packing " + bitno + " bits (" + index  
+ "), total packed : " + (bitcount+bitno) + " bits to date");
         bitcount += bitno;

-			  //       System.out.println("packing tag " + index + " of length " +  
bitno +  "bits from byte " + buffer_pos + "/" + buffer.length + " at " +  
pos + "th bit");
-
         /* Clear the bits before starting in a new byte */

         if (pos == 0) {
=======================================
--- /branches/red5sip/src/java/org/red5/codecs/ilbc/ilbc_common.java	Fri  
Feb 10 07:37:46 2012
+++ /branches/red5sip/src/java/org/red5/codecs/ilbc/ilbc_common.java	Sun  
Feb 17 19:49:41 2013
@@ -24,7 +24,6 @@
                                table */
      {
         int k,n,m, Nit=2, change=0,pos;
-       float tmp;
         float eps=(float)0.039; /* 50 Hz */
         float eps2=(float)0.0195;
         float maxlsf=(float)3.14; /* 4000 Hz */
@@ -40,7 +39,6 @@
                     if ((lsf[pos+1]-lsf[pos])<eps) {

                         if (lsf[pos+1]<lsf[pos]) {
-                           tmp=lsf[pos+1];
                             lsf[pos+1]= lsf[pos]+eps2;
                             lsf[pos]= lsf[pos+1]-eps2;
                         } else {
@@ -93,9 +91,7 @@
         /* decoding of the maximum value */

         maxVal = ilbc_constants.state_frgqTbl[idxForMax];
-       //System.out.println("idxForMax : " + idxForMax + "maxVal : " +  
maxVal);
         maxVal = (float)Math.pow(10,maxVal) / 4.5f;
-       //System.out.println("maxVal : " + maxVal);

         /* initialization of buffers and coefficients */

@@ -108,7 +104,6 @@

         for (k=0; k < ilbc_constants.LPC_FILTERORDER; k++) {
             numerator[k]=syntDenum[syntDenum_idx +  
ilbc_constants.LPC_FILTERORDER - k];
-	   //System.out.println("numerator-" + k + " = " + numerator[k] + " (( "  
+ syntDenum[syntDenum_idx + ilbc_constants.LPC_FILTERORDER - k]);
         }

         numerator[ilbc_constants.LPC_FILTERORDER]=syntDenum[syntDenum_idx];
@@ -119,14 +114,10 @@

         /* decoding of the sample values */

-       //       for (int li = 0; li < idxVec.length; li++)
-	 //System.out.println("idxVec["+li+"] = " + idxVec[li]);
-
         for (k=0; k<len; k++) {
             tmpi = len-1-k;
             /* maxVal = 1/scal */
             tmpbuf[tmp+k] =  
maxVal*ilbc_constants.state_sq3Tbl[idxVec[tmpi]];
-	   //System.out.println("index " + k + ", valeur " + tmpbuf[tmp+k]);
         }

         /* circular convolution with all-pass filter */
@@ -139,8 +130,6 @@
  				  foutbuf, fout);
         for (k=0;k<len;k++) {
             out[out_idx+k] = foutbuf[fout+len-1-k]+foutbuf[fout+2*len-1-k];
-	   //System.out.println("MEM -- index " + out_idx + " + " + k + "  
initialise a " + out[out_idx+k]);
-	   //System.out.println("       calcul : " + foutbuf[fout+len-1-k] + "  
+ " + foutbuf[fout+2*len-1-k]);
         }
     }

@@ -249,8 +238,6 @@
  	float [] b1 = new float[ilbc_constants.LPC_HALFORDER];
  	float [] b2 = new float[ilbc_constants.LPC_HALFORDER];

-	//System.out.println("debut de lsf2a");
-
  	for (i=0; i < ilbc_constants.LPC_FILTERORDER; i++) {
  	    freq[i] = freq[i] * ilbc_constants.PI2;
  	}
@@ -371,8 +358,6 @@
         invcoef = (float)1.0f - coef;
         for (i = 0; i < length; i++) {
             out[i] = coef * in1[i] + invcoef * in2[i + in2_idx];
-	   //	   System.out.println("out["+i+"] devient " + out[i] + ", par " +
-	   //			      coef + " * " + in1[i] + " + " + invcoef + " * " + in2[i +  
in2_idx]);
         }
     }

=======================================
--- /branches/red5sip/src/java/org/red5/codecs/ilbc/ilbc_decoder.java	Fri  
Feb 10 07:37:46 2012
+++ /branches/red5sip/src/java/org/red5/codecs/ilbc/ilbc_decoder.java	Sun  
Feb 17 19:49:41 2013
@@ -7,10 +7,14 @@
  //package net.java.sip.communicator.impl.media.codec.audio.ilbc;
  package org.red5.codecs.ilbc;

+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
  /**
   * @author Jean Lorchat
   */
  public class ilbc_decoder {
+    protected static Logger log =  
LoggerFactory.getLogger(ilbc_decoder.class);

      int consPLICount;
      int prevPLI;
@@ -47,13 +51,6 @@
  	//	float *po, *pi, *pa, *pm;
  	int po, pi, pa, pm;

-// 	System.out.println("out size : " + Out.length);
-// 	System.out.println("out idx : " + Out_idx);
-// 	System.out.println("a size : " + a.length);
-// 	System.out.println("a idx : " + a_idx);
-// 	System.out.println("len : " + len);
-// 	System.out.println("mem size : " + mem.length);
-
  	po = Out_idx;

  	/* Filter first part using memory from past */
@@ -68,18 +65,13 @@

  	    for (j=1; j<=i; j++) {
  		//		*po-=(*pa++)*(*pi--);
-// 		System.out.println("1 Soustraction (" + i + "," + j + ") a " +  
Out[po] + " de " + a[pa] + " * " + Out[pi]);
-// 		System.out.println("index " + (po - Out_idx) + " <> " + (pi -  
Out_idx));
  		Out[po] -= a[pa] * Out[pi];
-// 		System.out.println("Pour un resultat de " + Out[po]);
  		pa++;
  		pi--;
  	    }
             for (j=i+1; j < ilbc_constants.LPC_FILTERORDER+1; j++) {
  	       //               *po-=(*pa++)*(*pm--);
-// 	       System.out.println("2 Soustraction a " + Out[po] + " de " +  
a[pa] + " * " + mem[pm]);
  	       Out[po] -= a[pa] * mem[pm];
-// 	       System.out.println("Pour un resultat de " + Out[po]);
  	       pa++;
  	       pm--;
             }
@@ -96,9 +88,7 @@
  	   pa = a_idx + 1;
             for (j=1; j < ilbc_constants.LPC_FILTERORDER+1; j++) {
  	       //               *po-=(*pa++)*(*pi--);
-// 	       System.out.println("3 Soustraction a " + Out[po] + " de " +  
a[pa] + " * " + Out[pi]);
  	       Out[po] -= a[pa] * Out[pi];
-// 	       System.out.println("Pour un resultat de " + Out[po]);
  	       pa++;
  	       pi--;
             }
@@ -435,13 +425,6 @@
      {
  	int i,j;

-// 	System.out.println("longueur 1 : " + seq1.length);
-// 	System.out.println("distance 1 : " + seq1_idx);
-// 	System.out.println("longueur 2 : " + seq2.length);
-// 	System.out.println("distance 2 : " + seq2_idx);
-
-// 	System.out.println("dimensions : " + dim1 + " et " + dim2);
-
  // BUG in ILBC ???

  	for (i=0; i<=dim1-dim2; i++) {
@@ -595,7 +578,6 @@

  	/* compute upsampled correlation (corr33) and find
  	   location of max */
-// 	System.out.println("appel 1");
  	mycorr1(corrVec, 0, idata, searchSegStartPos,
  		corrdim+ilbc_constants.ENH_BLOCKL-1,
  		idata,centerStartPos,ilbc_constants.ENH_BLOCKL);
@@ -649,14 +631,6 @@

  	/* compute the segment (this is actually a convolution) */

-// 	System.out.println("appel 2");
-// 	System.out.println("longueur 1 : " + vect.length);
-// 	System.out.println("distance 1 : " + 0);
-// 	System.out.println("longueur 2 : " +  
ilbc_constants.polyphaserTbl.length);
-// 	System.out.println("distance 2 : " +  
(2*ilbc_constants.ENH_FL0+1)*fraction);
-// 	System.out.println("dimension 1 : " + ilbc_constants.ENH_VECTL);
-// 	System.out.println("dimension 2 : " + (2 * ilbc_constants.ENH_FL0+1));
-// 	System.out.println("correlations de dimension " + seg.length);
  	mycorr1(seg, seg_idx, vect, 0, ilbc_constants.ENH_VECTL,
  		ilbc_constants.polyphaserTbl,
  		(2*ilbc_constants.ENH_FL0+1)*fraction,
@@ -1368,14 +1342,13 @@
         /* check if mode is valid */

         if ( (mode < 0) || (mode > 1)) {
-           System.out.println("\nERROR - Wrong mode - 0, 1 allowed\n");
+           log.error("\nERROR - Wrong mode - 0, 1 allowed\n");
         }

         /* do actual decoding of block */
         for (k = 0; k < encoded_data.length; k++) {
  	   en_data.buffer[2*k+1] = (char) (encoded_data[k] & 0xff);
  	   en_data.buffer[2*k] = (char) ((encoded_data[k] >> 8) & 0xff);
-// 	   System.out.println("on decode " + (en_data.buffer[2*k]+0) + " et "  
+ (en_data.buffer[2*k+1]+0));
         }

         iLBC_decode(decblock, en_data, mode);
@@ -1383,7 +1356,6 @@
         /* convert to short */
         for (k = 0; k < this.ULP_inst.blockl; k++) {
             dtmp=decblock[k];
-// 	   System.out.println("on a eu : " + dtmp);

             if (dtmp < ilbc_constants.MIN_SAMPLE)
                 dtmp = ilbc_constants.MIN_SAMPLE;
@@ -1693,7 +1665,6 @@
  // 			    this.ULP_inst.lsf_bits[k][ulp], &pos);
  		    lsf_i[k] = bytes.packcombine(lsf_i[k], lastpart,
  						 this.ULP_inst.lsf_bits[k][ulp]);
-		    //		    System.out.println("lsf_i["+k+"] = " + lsf_i[k]);
  // 		    packcombine(&lsf_i[k], lastpart,
  // 				this.ULP_inst.lsf_bits[k][ulp]);
  		}
@@ -1705,7 +1676,6 @@
  // 			this.ULP_inst.start_bits[ulp], &pos);
  		start = bytes.packcombine(start, lastpart,
  				    this.ULP_inst.start_bits[ulp]);
-		//		System.out.println("start = " + start);
  // 		packcombine(&start, lastpart,
  // 			    this.ULP_inst.start_bits[ulp]);

@@ -1714,7 +1684,6 @@
  // 			this.ULP_inst.startfirst_bits[ulp], &pos);
  		state_first = bytes.packcombine(state_first, lastpart,
  						this.ULP_inst.startfirst_bits[ulp]);
-		//		System.out.println("state_first = " + state_first);
  // 		packcombine(&state_first, lastpart,
  // 			    this.ULP_inst.startfirst_bits[ulp]);

@@ -1723,7 +1692,6 @@
  // 			this.ULP_inst.scale_bits[ulp], &pos);
  		idxForMax = bytes.packcombine(idxForMax, lastpart,
  					      this.ULP_inst.scale_bits[ulp]);
-		//		System.out.println("idxForMax = " + idxForMax);
  // 		packcombine(&idxForMax, lastpart,
  // 			    this.ULP_inst.scale_bits[ulp]);

@@ -1733,7 +1701,6 @@
  // 			    this.ULP_inst.state_bits[ulp], &pos);
  		    idxVec[k] = bytes.packcombine(idxVec[k], lastpart,
  						  this.ULP_inst.state_bits[ulp]);
-		    //		    System.out.println("idxVec["+k+"] = " + idxVec[k]);
  // 		    packcombine(idxVec+k, lastpart,
  // 				this.ULP_inst.state_bits[ulp]);
  		}
@@ -1747,7 +1714,6 @@
  // 			    &pos);
  		    extra_cb_index[k] = bytes.packcombine(extra_cb_index[k], lastpart,
  							  this.ULP_inst.extra_cb_index[k][ulp]);
-		    //		    System.out.println("extra_cb_index["+k+"] = " +  
extra_cb_index[k]);
  // 		    packcombine(extra_cb_index+k, lastpart,
  // 				this.ULP_inst.extra_cb_index[k][ulp]);
  		}
@@ -1758,7 +1724,6 @@
  // 			    &pos);
  		    extra_gain_index[k] = bytes.packcombine(extra_gain_index[k],  
lastpart,
  							    this.ULP_inst.extra_cb_gain[k][ulp]);
-		    //		    System.out.println("extra_gain_index["+k+"] = " +  
extra_gain_index[k]);
  // 		    packcombine(extra_gain_index+k, lastpart,
  // 				this.ULP_inst.extra_cb_gain[k][ulp]);
  		}
@@ -1774,7 +1739,6 @@
  			cb_index[i * ilbc_constants.CB_NSTAGES + k] =
  			    bytes.packcombine(cb_index[i*ilbc_constants.CB_NSTAGES+k], lastpart,
  					      this.ULP_inst.cb_index[i][k][ulp]);
-			//			System.out.println("cb_index["+(i*ilbc_constants.CB_NSTAGES+k)+"]  
= " + cb_index[(i*ilbc_constants.CB_NSTAGES+k)]);
  // 			packcombine(cb_index+i*CB_NSTAGES+k, lastpart,
  // 				    this.ULP_inst.cb_index[i][k][ulp]);
  		    }
@@ -1786,14 +1750,12 @@
  			gain_index[i * ilbc_constants.CB_NSTAGES+k] =
  			    bytes.packcombine(gain_index[i*ilbc_constants.CB_NSTAGES+k],  
lastpart,
  					      this.ULP_inst.cb_gain[i][k][ulp]);
-			//			 
System.out.println("gain_index["+(i*ilbc_constants.CB_NSTAGES+k)+"] = " +  
gain_index[(i*ilbc_constants.CB_NSTAGES+k)]);
  		    }
  		}
  	    }
  	    /* Extract last bit. If it is 1 this indicates an
  	       empty/lost frame */
  	    last_bit = bytes.unpack(1);
-	    //	    System.out.println("last_bit = "  + last_bit);

  	    /* Check for bit errors or empty/lost frames */
  	    if (start < 1)
@@ -1811,32 +1773,18 @@
  		/* adjust index */
  		index_conv_dec(cb_index);

-// 		for (int li = 0; li < cb_index.length; li++)
-// 		    System.out.println("cb_index["+li+"] = " + cb_index[li]);
-
  		/* decode the lsf */

  		SimplelsfDEQ(lsfdeq, lsf_i, this.ULP_inst.lpc_n);
-// 		for (int li = 0; li < lsfdeq.length; li++)
-// 		    System.out.println("lsfdeq["+li+"] = " + lsfdeq[li]);
  		check=ilbc_common.LSF_check(lsfdeq, ilbc_constants.LPC_FILTERORDER,
  				this.ULP_inst.lpc_n);
-// 		System.out.println("check returns " + check);
  		DecoderInterpolateLSF(syntdenum, weightdenum,
  				      lsfdeq, ilbc_constants.LPC_FILTERORDER);
-// 		for (int li = 0; li < syntdenum.length; li++)
-// 		    System.out.println("syntdenum[" + li + "] = " + syntdenum[li]);
-// 		for (int li = 0; li < weightdenum.length; li++)
-// 		    System.out.println("weightdenum[" + li + "] = " +  
weightdenum[li]);
-
  		Decode(decresidual, start, idxForMax,
  		       idxVec, syntdenum, cb_index, gain_index,
  		       extra_cb_index, extra_gain_index,
  		       state_first);

-// 		for (int li = 0; li < decresidual.length; li++)
-// 		    System.out.println("decresidual[" + li + "] = " +  
decresidual[li]);
-
  		/* preparing the plc for a future loss! */

  		doThePLC(PLCresidual, PLClpc, 0, decresidual,
@@ -1845,8 +1793,6 @@
  			 last_lag);

  		System.arraycopy(PLCresidual, 0, decresidual, 0, this.ULP_inst.blockl);
-// 		for (int li = 0; li < decresidual.length; li++)
-// 		    System.out.println("decresidual[" + li + "] = " +  
decresidual[li]);
  // 		memcpy(decresidual, PLCresidual,
  // 		       this.ULP_inst.blockl*sizeof(float));
  	    }
@@ -1891,37 +1837,23 @@

  	    this.last_lag = enhancerInterface(data, decresidual);

-// 	    System.out.println("last_lag : " + this.last_lag);
-
-// 	   for (int li = 0; li < data.length; li++)
-// 	     System.out.println("data["+li+"] = " + data[li]);
-
-	    //	    for (li = 0; li <
-
  	    /* synthesis filtering */

  	    if (this.ULP_inst.mode == 20) {
  		/* Enhancer has 40 samples delay */
  		i = 0;
-// 		System.out.println("run 1");
  		syntFilter(data,i * ilbc_constants.SUBL,
  			   this.old_syntdenum,
  			   (i+this.ULP_inst.nsub-1)*(ilbc_constants.LPC_FILTERORDER+1),
  			   ilbc_constants.SUBL, this.syntMem);
-// 		System.out.println("runs 2");
  		for (i=1; i < this.ULP_inst.nsub; i++) {
-// 		    System.out.println("pass " + i);
  		    syntFilter(data, i * ilbc_constants.SUBL,
  			       syntdenum, (i-1)*(ilbc_constants.LPC_FILTERORDER+1),
  			       ilbc_constants.SUBL, this.syntMem);
-// 		    System.out.println("pass " + i + " ends");
  		}
-// 	   for (int li = 0; li < data.length; li++)
-// 	     System.out.println("psdata["+li+"] = " + data[li]);

  	    } else if (this.ULP_inst.mode == 30) {
  		/* Enhancer has 80 samples delay */
-// 		System.out.println("runs 3");
  		for (i = 0; i < 2; i++) {
  		    syntFilter(data, i * ilbc_constants.SUBL,
  			       this.old_syntdenum,
@@ -1929,7 +1861,6 @@
  			       ilbc_constants.SUBL, this.syntMem);
  		}
  		for (i=2; i < this.ULP_inst.nsub; i++) {
-// 		    System.out.println("runs 4");
  		    syntFilter(data,  i * ilbc_constants.SUBL,
  			       syntdenum, (i-2)*(ilbc_constants.LPC_FILTERORDER+1),
  			       ilbc_constants.SUBL, this.syntMem);
@@ -1965,7 +1896,6 @@
  	    System.arraycopy(decresidual, 0, data, 0, this.ULP_inst.blockl);
  // 	    memcpy(data, decresidual,
  // 		   this.ULP_inst.blockl*sizeof(float));
-// 	    System.out.println("runs 5");
  	    for (i=0; i < this.ULP_inst.nsub; i++) {
  		syntFilter(data, i * ilbc_constants.SUBL,
  			   syntdenum, i * (ilbc_constants.LPC_FILTERORDER + 1),
=======================================
--- /branches/red5sip/src/java/org/red5/codecs/ilbc/ilbc_encoder.java	Fri  
Feb 10 07:37:46 2012
+++ /branches/red5sip/src/java/org/red5/codecs/ilbc/ilbc_encoder.java	Sun  
Feb 17 19:49:41 2013
@@ -53,7 +53,7 @@
         int syntOut;
         float [] syntOutBuf = new float[ilbc_constants.LPC_FILTERORDER +
  					 ilbc_constants.STATE_SHORT_LEN_30MS];
-       float toQ, xq;
+       float toQ;
         int n;
         int [] index = new int[1];

@@ -116,7 +116,7 @@

             toQ = in[in_idx+n] - syntOutBuf[syntOut+n];

-           xq = sort_sq(index, 0, toQ, ilbc_constants.state_sq3Tbl, 8);
+           sort_sq(index, 0, toQ, ilbc_constants.state_sq3Tbl, 8);
             out[n]=index[0];
             syntOutBuf[syntOut + n] = ilbc_constants.state_sq3Tbl[out[n]];

@@ -145,7 +145,7 @@
         int state_first)     /* (i) position of start state in the
                                    80 vec */
      {
-	float dtmp, maxVal;
+	float maxVal;
  	float [] tmpbuf = new float[ilbc_constants.LPC_FILTERORDER +
  				      2 * ilbc_constants.STATE_SHORT_LEN_30MS];
  	//	float *tmp,
@@ -211,7 +211,7 @@
         // log10 is since 1.5
         //maxVal = (float)Math.log10(maxVal);
         maxVal = (float)(Math.log(maxVal)/Math.log(10));
-       dtmp = sort_sq(idxForMax, 0, maxVal, ilbc_constants.state_frgqTbl,  
64);
+       sort_sq(idxForMax, 0, maxVal, ilbc_constants.state_frgqTbl, 64);

         /* decoding of the maximum amplitude representation value,
            and corresponding scaling of start state */
@@ -322,10 +322,8 @@
                     if (step_idx == (ilbc_constants.LSF_NUMBER_OF_STEPS -  
1)){

                         if ((float)Math.abs(hlp5) >= Math.abs(olds[old])) {
-			   //System.out.println("acces index " + freq_idx + lsp_index);
                             freq[freq_idx+lsp_index] = omega - step;
                         } else {
-			   //System.out.println("acces index " + freq_idx + lsp_index);
                             freq[freq_idx+lsp_index] = omega;
                         }

@@ -364,7 +362,6 @@
         }

         for (i = 0; i < ilbc_constants.LPC_FILTERORDER; i++) {
-	   //System.out.println("acces index " + freq_idx + i);
             freq[freq_idx+i] = freq[freq_idx+i] * ilbc_constants.TWO_PI;
         }
     }
@@ -384,11 +381,6 @@
         float [] r = new float[ilbc_constants.LPC_FILTERORDER + 1];

          
is=ilbc_constants.LPC_LOOKBACK+ilbc_constants.BLOCKL_MAX-this.ULP_inst.blockl;
-       //       System.out.println("copie 1");
-//        System.out.println("\nInformations de copie : \nbuffer  
source : " + data.length + " octets\n"+
-// 			  "buffer cible : " + this.lpc_buffer.length + "octets\n" +
-// 			  "  offset : " + is + "octets\n" +
-// 			  "longueur de la copie : " + this.ULP_inst.blockl);
         System.arraycopy(data, 0, this.lpc_buffer, is,  
this.ULP_inst.blockl);
  //         
memcpy(iLBCenc_inst->lpc_buffer+is,data,iLBCenc_inst->blockl*sizeof(float));

@@ -416,7 +408,6 @@
             a2lsf(lsf, k * ilbc_constants.LPC_FILTERORDER, lp2);
         }
          
is=ilbc_constants.LPC_LOOKBACK+ilbc_constants.BLOCKL_MAX-this.ULP_inst.blockl;
-//        System.out.println("copie 2");
         System.arraycopy(this.lpc_buffer, ilbc_constants.LPC_LOOKBACK +  
ilbc_constants.BLOCKL_MAX - is,
  			this.lpc_buffer, 0, is);
  //        memmove(iLBCenc_inst->lpc_buffer,
@@ -508,14 +499,10 @@
         else {
             pos = 0;
             for (i = 0; i < this.ULP_inst.nsub; i++) {
-	       //System.out.println("ici ?");
                 LSFinterpolate2a_enc(lp, lsfdeqold, lsfdeq, 0,
  				    ilbc_constants.lsf_weightTbl_20ms[i], length);
-	       //System.out.println("ici !");
  	       System.arraycopy(lp, 0, syntdenum, pos, lp_length);
  	       for (int li = 0; li < lp_length; li++)
-		   //System.out.println("interpolate syntdenum [" + (li+pos) +"] is  
worth " + syntdenum[li+pos]);
-	       //               memcpy(syntdenum+pos,lp,lp_length*sizeof(float));
                 LSFinterpolate2a_enc(lp, lsfold, lsf, 0,
  				    ilbc_constants.lsf_weightTbl_20ms[i], length);
                 ilbc_common.bwexpand(weightdenum, pos, lp,
@@ -585,26 +572,14 @@
     {
         float [] lsf = new float[ilbc_constants.LPC_FILTERORDER *  
ilbc_constants.LPC_N_MAX];
         float [] lsfdeq= new float[ilbc_constants.LPC_FILTERORDER *  
ilbc_constants.LPC_N_MAX];
-       int change = 0;

         SimpleAnalysis(lsf, data);
-       //       for (int li = 0; li < ilbc_constants.LPC_FILTERORDER *  
ilbc_constants.LPC_N_MAX; li++)
-       //	   System.out.println("postSA n-" + li + " is worth " + lsf[li]);
-       //       for (int li = 0; li < ilbc_constants.BLOCKL_MAX; li++)
-       //	   System.out.println("data postSA n-" + li + " is worth " +  
data[li]);
                SimplelsfQ(lsfdeq, lsf_index, lsf, this.ULP_inst.lpc_n);
-	      //       for (int li = 0; li < ilbc_constants.LPC_FILTERORDER *  
ilbc_constants.LPC_N_MAX; li++)
-	      //	   System.out.println("postSlsfQ n-" + li + " is worth " +  
lsfdeq[li]);
-	      //       for (int li = 0; li < lsf_index.length; li++)
-	      //	   System.out.println("index postSlsfQ n-" + li + " is worth " +  
lsf_index[li]);

-       change = ilbc_common.LSF_check(lsfdeq,  
ilbc_constants.LPC_FILTERORDER, this.ULP_inst.lpc_n);
-       //System.out.println("check gives " + change);
+       ilbc_common.LSF_check(lsfdeq, ilbc_constants.LPC_FILTERORDER,  
this.ULP_inst.lpc_n);
         SimpleInterpolateLSF(syntdenum, weightdenum,
  			    lsf, lsfdeq, this.lsfold,
  			    this.lsfdeqold, ilbc_constants.LPC_FILTERORDER);
-       //       for (int li = 0; li < syntdenum.length; li++)
-       //	   System.out.println("syntdenum[" + li +"] is worth " +  
syntdenum[li]);
     }

      public void iCBSearch(
@@ -667,23 +642,6 @@
         System.arraycopy(intarget, intarget_idx, buf,  
ilbc_constants.LPC_FILTERORDER+lMem, lTarget);
  //        memcpy(buf+LPC_FILTERORDER+lMem,intarget,lTarget*sizeof(float));

-       //System.out.println("beginning of mem");
-//        for (int li = 0; li < lMem; li++)
-// 	   System.out.println("mem[" + li + "] = " + mem[li+mem_idx]);
-//       System.out.println("end of mem");
-
-
-//        System.out.println("plages : [0-" +  
ilbc_constants.LPC_FILTERORDER +
-// 			  "], puis [" + ilbc_constants.LPC_FILTERORDER + "-" +  
(ilbc_constants.LPC_FILTERORDER + lMem) +
-// 			  "], puis [" + (ilbc_constants.LPC_FILTERORDER + lMem) +
-// 			  "-" + (ilbc_constants.LPC_FILTERORDER + lMem + lTarget) + "]");
-
-//       System.out.println("beginning of buffer");
-
-//        for (int li = 0; li < buf.length; li++)
-// 	   System.out.println("buffer[" + li + "] = " + buf[li]);
-
-//       System.out.println("end of buffer");
         /* weighting */

         ilbc_common.AllPoleFilter(buf, ilbc_constants.LPC_FILTERORDER,  
weightDenum, weightDenum_idx,
@@ -846,14 +804,11 @@

             /* set search range for following codebook sections */

-	   //	   System.out.println("best index : " + best_index);
-
             base_index = best_index;

             /* unrestricted search */

             if (ilbc_constants.CB_RESRANGE == -1) {
-	       //	       System.out.println("on met a 0");
                 sInd = 0;
                 eInd = range - 1;
                 sIndAug = 20;
@@ -868,7 +823,6 @@
                 sIndAug=0;
                 eIndAug=0;
                 sInd=base_index-ilbc_constants.CB_RESRANGE/2;
-	       //	       System.out.println("on met a " + base_index + " - " +  
ilbc_constants.CB_RESRANGE/2 + " = " + sInd);
                 eInd=sInd+ilbc_constants.CB_RESRANGE;

                 if (lTarget==ilbc_constants.SUBL) {
@@ -877,14 +831,12 @@

                         sIndAug = 40 + sInd;
                         eIndAug = 39;
-		       //		       System.out.println("On met encore a 0");
                         sInd=0;

                     } else if ( base_index < (base_size-20) ) {

                         if (eInd > range) {
                             sInd -= (eInd-range);
-			   //			   System.out.println("on retire " + eInd + " - " + range + "  
pour arriver a " + sInd);
                             eInd = range;
                         }
                     } else { /* base_index >= (base_size-20) */
@@ -892,7 +844,6 @@
                         if (sInd < (base_size-20)) {
                             sIndAug = 20;
                             sInd = 0;
-			   //			   System.out.println("on remet encore a 0");
                             eInd = 0;
                             eIndAug = 19 + ilbc_constants.CB_RESRANGE;

@@ -904,7 +855,6 @@
                             sIndAug = 20 + sInd - (base_size-20);
                             eIndAug = 39;
                             sInd = 0;
-			   //			   System.out.println("on remetz4 a zero");
                             eInd = ilbc_constants.CB_RESRANGE -  
(eIndAug-sIndAug+1);
                         }
                     }
@@ -915,12 +865,10 @@
                         eInd -= sInd;

                         sInd = 0;
-		       //		       System.out.println("on remet x5 a zero");
                     }

                     if(eInd > range) {
                         sInd -= (eInd - range);
-		       //		       System.out.println("on retire " + eInd + " - " + range  
+ " pour arriver a " + sInd);
                         eInd = range;
                     }
                 }
@@ -930,7 +878,6 @@

             /* index search range */
             counter = sInd;
-	   //	   System.out.println("on ajoute " + base_size + " pour arriver a "  
+ sInd);
             sInd += base_size;
             eInd += base_size;

@@ -972,10 +919,6 @@
                 pp=lMem - (counter++) - lTarget;
  //                pp=cbvectors + lMem - (counter++) - lTarget;

-//	       System.out.println("lMem : " + lMem);
-//	       System.out.println("counter : " + counter);
-//	       System.out.println("target : " + lTarget);
-
                 for (j=0;j<lTarget;j++) {

                     crossDot += target[j]*(cbvectors[pp]);
@@ -1167,15 +1110,9 @@
         po = 0;

         for (i=0; i<len; i++) {
-	   //	   System.out.println(Out[po] + " + " +  
ilbc_constants.hpi_zero_coefsTbl[0] + " * " + In[pi] + "((" +  
ilbc_constants.hpi_zero_coefsTbl[0] * In[pi]);
             Out[po] = ilbc_constants.hpi_zero_coefsTbl[0] * (In[pi]);
-	   //	   System.out.println("then *po=" + Out[po]);
-	   //	   System.out.println(Out[po] + " + " +  
ilbc_constants.hpi_zero_coefsTbl[1] +" * "+  mem[0] + "((" +  
ilbc_constants.hpi_zero_coefsTbl[1] * mem[0]);
             Out[po] += ilbc_constants.hpi_zero_coefsTbl[1] * mem[0];
-	   //	   System.out.println("then *po=" + Out[po]);
-	   //	   System.out.println(Out[po] + " + " +  
ilbc_constants.hpi_zero_coefsTbl[2] + " * " +  mem[1] + "((" +  
ilbc_constants.hpi_zero_coefsTbl[2] * mem[1]);
             Out[po] += ilbc_constants.hpi_zero_coefsTbl[2] * mem[1];
-	   //	   System.out.println("then *po=" + Out[po]);

             mem[1] = mem[0];
             mem[0] = In[pi];
@@ -1188,13 +1125,8 @@
         //       po = &Out[0];
         po = 0;
         for (i=0; i<len; i++) {
-	   //	   	   System.out.println("(part 2-"+i+") *po=" + Out[po]);
-	   //	   	   System.out.println(Out[po] + " - " +  
ilbc_constants.hpi_pole_coefsTbl[1] + " * " + mem[2] + " ((" +  
ilbc_constants.hpi_pole_coefsTbl[1] * mem[2]);
             Out[po] -= ilbc_constants.hpi_pole_coefsTbl[1] * mem[2];
-	   //	   	   System.out.println("then *po=" + Out[po]);
-	   //	   	   System.out.println(Out[po] + " - " +  
ilbc_constants.hpi_pole_coefsTbl[2] + " * " + mem[3] + " ((" +  
ilbc_constants.hpi_pole_coefsTbl[2] * mem[3]);
             Out[po] -= ilbc_constants.hpi_pole_coefsTbl[2] * mem[3];
-	   //	   System.out.println("2then *po=" + Out[po]);

             mem[3] = mem[2];
             mem[2] = Out[po];
@@ -1622,9 +1554,6 @@
  	/* Compute the energy for the first (low-5)
  	   noninterpolated samples */

-	//	for (pp = 0; pp < buffer.length; pp++)
-	//	    System.out.println("buffer[" + (pp - buffer_idx) + "] = " +  
buffer[pp]);
-
  	nrjRecursive = (float) 0.0f;
  	//       pp = buffer - low + 1;
  	pp = 1 - low + buffer_idx;
@@ -1634,8 +1563,6 @@
  	}
  	ppe = buffer_idx - low;

-	//	System.out.println("energie recursive " + nrjRecursive);
-
  	for (icount=low; icount<=high; icount++) {

  	    /* Index of the codebook vector used for retrieving
@@ -1701,11 +1628,7 @@
  	    /* check if measure is better */
  	    ftmp = crossDot*invenergy[tmpIndex];

-	    //	    System.out.println("on compare " + measure + " et " +  
max_measure[0]);
-	    //	    System.out.println("ainsi que " + Math.abs(ftmp) + " et " +  
ilbc_constants.CB_MAXGAIN);
-
  	    if ((measure>max_measure[0]) && ((float)Math.abs(ftmp) <  
ilbc_constants.CB_MAXGAIN)) {
-		//		System.out.println("new best index at " + tmpIndex + ", where icount  
= " + icount);
  		best_index[0] = tmpIndex;
  		max_measure[0] = measure;
  		gain[0] = ftmp;
@@ -1834,9 +1757,6 @@
  	for (k=0; k<this.ULP_inst.blockl; k++)
  	    block[k] = (float) data[k];

-	//	for (int li = 0; li < block.length; li++)
-	//	    System.out.println("block " + li + " : " + block[li]);
-
  	/* do the actual encoding */

  	iLBC_encode(en_data, block);
@@ -1854,9 +1774,8 @@
      {
  	int start;
  	int [] idxForMax = new int[1];
-	int n, k, meml_gotten, Nfor, Nback, i, pos;
+	int n, k, meml_gotten, Nfor, Nback, i;
  	//       unsigned char *pbytes;
-	int pbytes;
  	int diff, start_pos, state_first;
  	float en1, en2;
  	int index, ulp;
@@ -1887,20 +1806,7 @@

  	/* high pass filtering of input signal if such is not done
  	   prior to calling this function */
-
-	//	System.out.println("Data prior to hpinput call");
-	//	for (int li = 0; li < data.length; li++)
-	//	    System.out.println("index : " + li + " and value " + data[li]);
-	//	System.out.println("Mem prior to hpinput call");
-	//	for (int li = 0; li < this.hpimem.length; li++)
-	//	    System.out.println("index : " + li + " and value " +  
this.hpimem[li]);
  	hpInput(block, this.ULP_inst.blockl, data, this.hpimem);
-	//	System.out.println("Data after hpinput call");
-	//	for (int li = 0; li < data.length; li++)
-	//	    System.out.println("index : " + li + " and value " + data[li]);
-	//	System.out.println("Mem after hpinput call");
-	//	for (int li = 0; li < this.hpimem.length; li++)
-	//	    System.out.println("index : " + li + " and value " +  
this.hpimem[li]);


  	/* otherwise simply copy */
@@ -1911,18 +1817,12 @@

  	LPCencode(syntdenum, weightdenum, lsf_i, data);

-	//	for (int li = 0; li <  
ilbc_constants.NSUB_MAX*(ilbc_constants.LPC_FILTERORDER+1); li++)
-	//	    System.out.println("postLPC n-" + li + " is worth " +  
syntdenum[li] + ", " + weightdenum[li]);
-
  	/* inverse filter to get residual */

  	for (n = 0; n < this.ULP_inst.nsub; n++) {
  	    anaFilter(data, n*ilbc_constants.SUBL, syntdenum,  
n*(ilbc_constants.LPC_FILTERORDER+1),
  		      ilbc_constants.SUBL, residual, n*ilbc_constants.SUBL, this.anaMem);
  	}
-
-	//	for (int li = 0; li < ilbc_constants.BLOCKL_MAX; li++)
-	//	    System.out.println("block residual n-" + li + " is worth " +  
residual[li]);

  	/* find state location */

@@ -2205,18 +2105,12 @@

  	/* pack bytes */

-	//       pbytes=bytes;
-	pos=0;
-
  	/* loop over the 3 ULP classes */

  	for (ulp=0; ulp<3; ulp++) {

-	    int [] psarray = new int[1];
  	    /* LSF */
-	    //	    System.out.println("ULP Class " + ulp);
  	    for (k=0; k<ilbc_constants.LSF_NSPLIT*this.ULP_inst.lpc_n; k++) {
-		//System.out.println("LSF " + k);
  		pack = bytes.packsplit(lsf_i[k],
  				       this.ULP_inst.lsf_bits[k][ulp],
  				       this.ULP_inst.lsf_bits[k][ulp]+
@@ -2229,8 +2123,6 @@

  	    /* Start block info */

-	    //	    System.out.println("start bits");
-
  	    pack = bytes.packsplit(start,
  				   this.ULP_inst.start_bits[ulp],
  				   this.ULP_inst.start_bits[ulp]+
@@ -2240,8 +2132,6 @@
  	    start = pack.get_rest();
  	    bytes.dopack(firstpart, this.ULP_inst.start_bits[ulp]);

-	    //	    System.out.println("startfirst bits");
-
  	    pack = bytes.packsplit(state_first,
  				   this.ULP_inst.startfirst_bits[ulp],
  				   this.ULP_inst.startfirst_bits[ulp]+
@@ -2251,7 +2141,6 @@
  	    state_first = pack.get_rest();
  	    bytes.dopack(firstpart, this.ULP_inst.startfirst_bits[ulp]);

-	    //	    System.out.println("scale bits");
  	    pack = bytes.packsplit(idxForMax[0],
  				   this.ULP_inst.scale_bits[ulp],
  				   this.ULP_inst.scale_bits[ulp]+
@@ -2261,9 +2150,7 @@
  	    idxForMax[0] = pack.get_rest();
  	    bytes.dopack(firstpart, this.ULP_inst.scale_bits[ulp]);

-	    //	    System.out.println("state bits");
  	    for (k=0; k<this.ULP_inst.state_short_len; k++) {
-		//		System.out.println("state short len #" + k);
  		pack = bytes.packsplit(idxVec[k],
  				       this.ULP_inst.state_bits[ulp],
  				       this.ULP_inst.state_bits[ulp]+
@@ -2276,7 +2163,6 @@

  	    /* 23/22 (20ms/30ms) sample block */

-	    //	    System.out.println("extra_cb_index");
  	    for (k=0;k<ilbc_constants.CB_NSTAGES;k++) {
  		pack = bytes.packsplit(extra_cb_index[k],
  				       this.ULP_inst.extra_cb_index[k][ulp],
@@ -2288,7 +2174,6 @@
  		bytes.dopack(firstpart, this.ULP_inst.extra_cb_index[k][ulp]);
  	    }

-	    //	    System.out.println("extra_cb_gain");
  	    for (k=0;k<ilbc_constants.CB_NSTAGES;k++) {
  		pack = bytes.packsplit(extra_gain_index[k],
  				       this.ULP_inst.extra_cb_gain[k][ulp],
@@ -2303,8 +2188,6 @@

  	    /* The two/four (20ms/30ms) 40 sample sub-blocks */

-	    //	    System.out.println("cb_index");
-
  	    for (i=0; i<this.ULP_inst.nasub; i++) {
  		for (k=0; k<ilbc_constants.CB_NSTAGES; k++) {
  		    pack = bytes.packsplit(cb_index[i*ilbc_constants.CB_NSTAGES+k],
@@ -2318,7 +2201,6 @@
  		}
  	    }

-	    //	    System.out.println("cb_gain");
  	    for (i=0; i<this.ULP_inst.nasub; i++) {
  		for (k=0; k<ilbc_constants.CB_NSTAGES; k++) {
  		    pack = bytes.packsplit(gain_index[i*ilbc_constants.CB_NSTAGES+k],
@@ -2335,7 +2217,6 @@

  	/* set the last bit to zero (otherwise the decoder
  	   will treat it as a lost frame) */
-	//	System.out.println("final bit");
  	bytes.dopack(0, 1);
      }

=======================================
--- /branches/red5sip/src/java/org/red5/codecs/ilbc/ilbc_ulp.java	Fri Feb  
10 07:37:46 2012
+++ /branches/red5sip/src/java/org/red5/codecs/ilbc/ilbc_ulp.java	Sun Feb  
17 19:49:41 2013
@@ -7,10 +7,14 @@
  //package net.java.sip.communicator.impl.media.codec.audio.ilbc;
  package org.red5.codecs.ilbc;

+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
  /**
   * @author Jean Lorchat
   */
  class ilbc_ulp {
+    protected static Logger log = LoggerFactory.getLogger(ilbc_ulp.class);

      /* codec settings for encoder instance */

@@ -40,7 +44,7 @@

  	if ( (mode != 20) && (mode != 30) )
  	    {
-		System.out.println("Unknown mode " + init_mode);
+		log.error("Unknown mode " + init_mode);
  		return;
  	    }

@@ -93,20 +97,9 @@
  		System.arraycopy(ilbc_constants.state_bits_30ms, 0, state_bits, 0,  
ilbc_constants.state_bits_30ms.length);
  		System.arraycopy(ilbc_constants.extra_cb_index_30ms, 0, extra_cb_index,  
0, ilbc_constants.CB_NSTAGES);
  		System.arraycopy(ilbc_constants.extra_cb_gain_30ms, 0, extra_cb_gain, 0,  
ilbc_constants.CB_NSTAGES);
-		//		System.out.println("nsubmax vaut: " + NSUB_MAX + " vs " + NSUB_30MS  
+ ", alors que la taille de la table est: " + cb_index_30ms.length + " vs "  
+ cb_index.length);
  		System.arraycopy(ilbc_constants.cb_index_30ms, 0, cb_index, 0,  
ilbc_constants.NSUB_30MS);
  		System.arraycopy(ilbc_constants.cb_gain_30ms, 0, cb_gain, 0,  
ilbc_constants.NSUB_30MS);
  	    }
-
-	// 	for (int i = 0; i < NSUB_MAX; i++) {
-	// 	    for (int j = 0; j < CB_NSTAGES; j++) {
-	// 		for (int k = 0; k < ULP_CLASSES+2; k++) {
-	// 		    System.out.print(" " + cb_gain[i][j][k]);
-	// 		}
-	// 		System.out.print(" | ");
-	// 	    }
-	// 	    System.out.println("");
-	// 	}
      }
  }

=======================================
--- /branches/red5sip/src/java/org/red5/sip/app/BufferUtils.java	Fri Feb 10  
07:37:46 2012
+++ /branches/red5sip/src/java/org/red5/sip/app/BufferUtils.java	Sun Feb 17  
19:49:41 2013
@@ -89,8 +89,6 @@


      private static void println( String method, String message ) {
-
          //log.debug( "BufferUtils - " + method + " -> " + message );
-        //System.out.println( "BufferUtils - " + method + " -> " + message  
);
      }
  }
=======================================
--- /branches/red5sip/src/java/org/red5/sip/app/PlayNetStream.java	Thu Feb  
14 08:34:08 2013
+++ /branches/red5sip/src/java/org/red5/sip/app/PlayNetStream.java	Sun Feb  
17 19:49:41 2013
@@ -1,7 +1,6 @@
  package org.red5.sip.app;

  import org.apache.mina.core.buffer.IoBuffer;
-import org.red5.logging.Red5LoggerFactory;
  import org.red5.server.api.event.IEvent;
  import org.red5.server.api.event.IEventDispatcher;
  import org.red5.server.net.rtmp.event.AudioData;
@@ -11,10 +10,10 @@
  import org.red5.server.stream.AbstractClientStream;
  import org.red5.server.stream.IStreamData;
  import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;

  public class PlayNetStream extends AbstractClientStream implements  
IEventDispatcher {
-
-    private static Logger logger =  
Red5LoggerFactory.getLogger(PlayNetStream.class, "sip");
+    private static Logger logger =  
LoggerFactory.getLogger(PlayNetStream.class);

      private int audioTs = 0;

@@ -78,7 +77,7 @@
                      mediaStream.send(audioTs, data, 1, data.length - 1);
                  }
              } catch (Exception e) {
-                System.out.println("PlayNetStream dispatchEvent  
exception " + e);
+            	logger.error("PlayNetStream dispatchEvent exception ", e);
              }
          }
      }
=======================================
--- /branches/red5sip/src/java/org/red5/sip/app/RTPStream.java	Thu Feb 14  
09:33:19 2013
+++ /branches/red5sip/src/java/org/red5/sip/app/RTPStream.java	Sun Feb 17  
19:49:41 2013
@@ -3,12 +3,12 @@
  import local.net.RtpPacket;

  import org.red5.codecs.asao.ByteStream;
-import org.red5.logging.Red5LoggerFactory;
  import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;

  public class RTPStream implements IMediaStream {

-    protected static Logger log =  
Red5LoggerFactory.getLogger(RTPStream.class, "sip");
+    protected static Logger log = LoggerFactory.getLogger(RTPStream.class);

      private int streamId;
      private RTPStreamSender sender;
=======================================
--- /branches/red5sip/src/java/org/red5/sip/app/RTPStreamForMultiplex.java	 
Thu Feb 14 08:34:08 2013
+++ /branches/red5sip/src/java/org/red5/sip/app/RTPStreamForMultiplex.java	 
Sun Feb 17 19:49:41 2013
@@ -3,11 +3,11 @@
  import static  
org.red5.sip.app.RTPStreamMultiplexingSender.NELLYMOSER_ENCODED_PACKET_SIZE;

  import org.red5.codecs.asao.DecoderMap;
-import org.red5.logging.Red5LoggerFactory;
  import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;

  public class RTPStreamForMultiplex implements IMediaStream {
-    protected static Logger log =  
Red5LoggerFactory.getLogger(RTPStreamForMultiplex.class, "sip");
+    protected static Logger log =  
LoggerFactory.getLogger(RTPStreamForMultiplex.class);

      private int streamId;
      private boolean ready = false;
@@ -35,7 +35,7 @@
      }

      public void send(long timestamp, byte[] asaoBuffer, int offset, int  
num) {
-        System.out.println("Stream " + streamId + " send");
+    	log.trace("Stream " + streamId + " send");
          for(int i=0;i<num;i+=NELLYMOSER_ENCODED_PACKET_SIZE) {
              synchronized (this) {
                  buffer.push(asaoBuffer, offset+i,  
NELLYMOSER_ENCODED_PACKET_SIZE);
=======================================
---  
/branches/red5sip/src/java/org/red5/sip/app/RTPStreamMultiplexingSender.java	 
Thu Feb 14 09:33:19 2013
+++  
/branches/red5sip/src/java/org/red5/sip/app/RTPStreamMultiplexingSender.java	 
Sun Feb 17 19:49:41 2013
@@ -248,7 +248,7 @@
              if(bufferUsage > .2f) {
                  pause -= 1;
              }
-            System.out.println("Sleep pause: " + pause);
+            log.trace("Sleep pause: " + pause);
              Thread.sleep( pause, 800000 );
          }
          catch ( Exception e ) {
@@ -288,7 +288,7 @@
                          if(stream.ready() && disableStream !=  
stream.getStreamId()) {
                              len = stream.read(asaoBuffer, 0);
                              bufferUsage = Math.max(bufferUsage,  
stream.bufferUsage());
-                            System.out.println(String.format("Stream  
id %d, buffer %f", stream.getStreamId(), stream.bufferUsage()));
+                            log.trace(String.format("Stream id %d,  
buffer %f", stream.getStreamId(), stream.bufferUsage()));
                          } else {
                              continue;
                          }
@@ -313,7 +313,7 @@
                  log.error("Exception", e);
              }
              if(multiplexingCount > 0) {
-                System.out.println("Send: multiplexed: " +  
multiplexingCount + ", total streams: " + streamSet.size());
+            	log.trace("Send: multiplexed: " + multiplexingCount + ",  
total streams: " + streamSet.size());
  //                ResampleUtils.normalize(multiplexedBuffer,  
1.0f/multiplexingCount);
                  ResampleUtils.normalize(multiplexedBuffer,  
multiplexedBuffer.length);
                  try {
@@ -326,7 +326,6 @@
                          if (encodingOffset ==  
sipCodec.getOutgoingDecodedFrameSize()) {
                              rtpSocketSend(rtpPacket);
                              doRtpDelay(bufferUsage);
-                            //System.out.println("rtpSocketSend,  
bufferUsage: " + bufferUsage);
                              encodingOffset = 0;
                          }
                      }
@@ -456,7 +455,6 @@
              rtpPacket.setPayloadType(sipCodec.getCodecId());
              rtpSocket.send(rtpPacket);
              time += sipCodec.getOutgoingPacketization();
-            //System.out.println(String.format("Send RTP: interval %d,  
ts %d", System.currentTimeMillis() - lastMS, time));
          } catch (Exception e) {
              log.error("Error sending RTP packet", e);
          }
@@ -464,6 +462,5 @@

      private static void println(String method, String message) {
          log.debug("RTPStreamSender - " + method + " -> " + message);
-        System.out.println("RTPStreamSender - " + method + " -> " +  
message);
      }
  }
=======================================
--- /branches/red5sip/src/java/org/red5/sip/app/RTPStreamReceiver.java	Thu  
Feb 14 08:34:08 2013
+++ /branches/red5sip/src/java/org/red5/sip/app/RTPStreamReceiver.java	Sun  
Feb 17 19:49:41 2013
@@ -6,15 +6,14 @@
  import local.net.RtpSocket;

  import org.red5.codecs.SIPCodec;
-import org.red5.logging.Red5LoggerFactory;
  import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;


  public class RTPStreamReceiver extends Thread {

-    protected static Logger log = Red5LoggerFactory.getLogger(  
RTPStreamReceiver.class, "sip" );
+    protected static Logger log =  
LoggerFactory.getLogger(RTPStreamReceiver.class);
      public static int RTP_HEADER_SIZE = 12;
-   	private long start = System.currentTimeMillis();
      public static final int SO_TIMEOUT = 200;	// Maximum blocking time,  
spent waiting for reading new bytes [milliseconds]
      private SIPCodec sipCodec = null; // Sip codec to be used on audio  
session
      private IMediaReceiver rtmpUser = null;
@@ -44,8 +43,6 @@
              socketIsLocal = true;

              init( sipCodec, rtmpUser, socket );
-
-            start = System.currentTimeMillis();
          }
          catch ( Exception e ) {
              e.printStackTrace();
@@ -120,7 +117,6 @@
              rtp_socket.getDatagramSocket().setSoTimeout( SO_TIMEOUT );

              float[] decodingBuffer = new float[  
sipCodec.getIncomingDecodedFrameSize() ];
-            int packetCount = 0;

              println( "run",
                      "internalBuffer.length = " + internalBuffer.length
@@ -137,7 +133,6 @@

                          byte[] packetBuffer = rtpPacket.getPacket();
                          int offset = rtpPacket.getHeaderLength();
-                        int length = rtpPacket.getPayloadLength();
                          int payloadType = rtpPacket.getPayloadType();

                          if(payloadType < 20)
@@ -177,9 +172,7 @@

      /** Debug output */
      private static void println( String method, String message ) {
-
          //log.debug( "RtpStreamReceiver - " + method + " -> " + message );
-        //System.out.println( "RtpStreamReceiver - " + method + " -> " +  
message );
      }
  }

=======================================
--- /branches/red5sip/src/java/org/red5/sip/app/RTPStreamSender.java	Thu  
Feb 14 09:33:19 2013
+++ /branches/red5sip/src/java/org/red5/sip/app/RTPStreamSender.java	Sun  
Feb 17 19:49:41 2013
@@ -10,14 +10,14 @@
  import org.red5.codecs.SIPCodec;
  import org.red5.codecs.asao.Decoder;
  import org.red5.codecs.asao.DecoderMap;
-import org.red5.logging.Red5LoggerFactory;
  import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
  import org.zoolu.tools.Random;


  public class RTPStreamSender implements IMediaSender {

-    protected static Logger log = Red5LoggerFactory.getLogger(  
RTPStreamSender.class, "sip" );
+    protected static Logger log =  
LoggerFactory.getLogger(RTPStreamSender.class);

      public static boolean useASAO = true;

@@ -195,7 +195,7 @@
      private synchronized void rtpSocketSend(RtpPacket rtpPacket) {
          try {
           	rtpSocket.send( rtpPacket );
-            System.out.println(rtpPacket.getSscr() + " : " +  
rtpPacket.getTimestamp());
+         	println("rtpSocketSend", rtpPacket.getSscr() + " : " +  
rtpPacket.getTimestamp());
          }
          catch ( Exception e ) {
          }
@@ -203,7 +203,6 @@

      private static void println( String method, String message ) {
          log.debug( "RTPStreamSender - " + method + " -> " + message );
-        System.out.println( "RTPStreamSender - " + method + " -> " +  
message );
      }


=======================================
--- /branches/red5sip/src/java/org/red5/sip/app/SIPAudioLauncher.java	Thu  
Feb 14 08:34:08 2013
+++ /branches/red5sip/src/java/org/red5/sip/app/SIPAudioLauncher.java	Sun  
Feb 17 19:49:41 2013
@@ -102,8 +102,6 @@


      private static void printLog( String method, String message ) {
-
          log.debug( "SipAudioLauncher - " + method + " -> " + message );
-        System.out.println( "SipAudioLauncher - " + method + " -> " +  
message );
      }
  }
=======================================
--- /branches/red5sip/src/java/org/red5/sip/app/SIPRegisterAgent.java	Thu  
Feb 14 09:33:19 2013
+++ /branches/red5sip/src/java/org/red5/sip/app/SIPRegisterAgent.java	Sun  
Feb 17 19:49:41 2013
@@ -5,6 +5,8 @@

  import local.net.KeepAliveSip;

+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
  import org.zoolu.net.SocketAddress;
  import org.zoolu.sip.address.NameAddress;
  import org.zoolu.sip.address.SipURL;
@@ -32,6 +34,7 @@
    */
  public class SIPRegisterAgent implements Runnable,  
TransactionClientListener
  {
+    protected static Logger log =  
LoggerFactory.getLogger(SIPRegisterAgent.class);
     /** The CallerID and CSeq that should be used during REGISTER method */
     	private CallIdHeader	registerCallID;
  	private int				registerCSeq;
@@ -423,13 +426,13 @@
     // ****************************** Logs *****************************


-   void printLog(String str) {
-   	System.out.println("RegisterAgent: "+str);
-   }
+	void printLog(String str) {
+		log.debug("RegisterAgent: "+str);
+	}


-   void printException(Exception e)   {
-		System.out.println("RegisterAgent Exception: "+e);
-   }
+	void printException(Exception e)   {
+		log.error("RegisterAgent Exception: ", e);
+	}

  }
=======================================
--- /branches/red5sip/src/java/org/red5/sip/app/SIPTransport.java	Tue Jan  
29 03:52:07 2013
+++ /branches/red5sip/src/java/org/red5/sip/app/SIPTransport.java	Sun Feb  
17 19:49:41 2013
@@ -1,15 +1,14 @@
  package org.red5.sip.app;

-import org.red5.logging.Red5LoggerFactory;
  import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
  import org.zoolu.net.SocketAddress;
  import org.zoolu.sip.address.NameAddress;
  import org.zoolu.sip.provider.SipProvider;
  import org.zoolu.sip.provider.SipStack;

  public abstract class SIPTransport  implements SIPUserAgentListener,  
SIPRegisterAgentListener, ISipNumberListener {
-
-    protected static Logger log =  
Red5LoggerFactory.getLogger(SIPTransport.class, "sip");
+    protected static Logger log = LoggerFactory.getLogger(  
SIPTransport.class );

      public boolean sipReady = false;

@@ -29,8 +28,6 @@

      private String password;

-    private String realm;
-
      private int sipPort;

      private int rtpPort;
@@ -42,7 +39,6 @@

      private void p( String s ) {
          log.debug( s );
-		System.out.println("[SIPUser] " + s);
      }

      public SIPTransport(RTMPRoomClient roomClient, int sipPort, int  
rtpPort) {
@@ -59,7 +55,6 @@
          this.password = password;
          this.proxy = proxy;
  		this.opt_outbound_proxy = obproxy;
-		this.realm = realm;

          String fromURL = "\"" + phone + "\" <sip:" + phone + "@" + proxy  
+ ">";

=======================================
--- /branches/red5sip/src/java/org/red5/sip/app/SIPUserAgent.java	Thu Feb  
14 08:34:08 2013
+++ /branches/red5sip/src/java/org/red5/sip/app/SIPUserAgent.java	Sun Feb  
17 19:49:41 2013
@@ -989,8 +989,6 @@


      private static void printLog( String method, String message ) {
-
          log.debug( "SipUserAgent - " + method + " -> " + message );
-        System.out.println( "SipUserAgent - " + method + " -> " + message  
);
      }
  }
=======================================
--- /branches/red5sip/src/java/org/red5/sip/app/SdpUtils.java	Thu Feb 14  
08:34:08 2013
+++ /branches/red5sip/src/java/org/red5/sip/app/SdpUtils.java	Sun Feb 17  
19:49:41 2013
@@ -767,8 +767,6 @@


      private static void printLog( String method, String message ) {
-
          log.debug( "SdpUtils - " + method + " -> " + message );
-        System.out.println( "SdpUtils - " + method + " -> " + message );
      }
  }
=======================================
--- /branches/red5sip/src/java/org/zoolu/sdp/SdpParser.java	Thu Feb 14  
09:33:19 2013
+++ /branches/red5sip/src/java/org/zoolu/sdp/SdpParser.java	Sun Feb 17  
19:49:41 2013
@@ -56,7 +56,6 @@
        if (value==null) return null;
        index=par.getPos();
        // for DEBUG
-      //System.out.println("DEBUG: "+type+"="+value);
        return new SdpField(type,value);
     }*/

@@ -79,7 +78,6 @@
        setPos(end);
        goToNextLine();
        // for DEBUG
-      //System.out.println("DEBUG: "+type+"="+value);
        return new SdpField(type,value);
     }

=======================================
--- /branches/red5sip/src/java/org/zoolu/sdp/SessionDescriptor.java	Thu Feb  
14 08:34:08 2013
+++ /branches/red5sip/src/java/org/zoolu/sdp/SessionDescriptor.java	Sun Feb  
17 19:49:41 2013
@@ -179,7 +179,7 @@

     /** Gets the origin 'o' field */
     public OriginField getOrigin()
-   {  //System.out.println("DEBUG: inside SessionDescriptor.getOwner():  
sdp=\n"+toString());
+   {
        return o;
     }

=======================================
--- /branches/red5sip/src/java/org/zoolu/sip/address/NameAddress.java	Fri  
Feb 10 07:37:46 2012
+++ /branches/red5sip/src/java/org/zoolu/sip/address/NameAddress.java	Sun  
Feb 17 19:49:41 2013
@@ -57,11 +57,6 @@
     public NameAddress(String naddr)
     {  SipParser par=new SipParser(naddr);
        NameAddress na=par.getNameAddress();
-      //DEBUG
-      //if (na==null)
-      //{  System.out.println("DEBUG: NameAddress:  
par:\r\n"+par.getWholeString());
-      //   System.exit(0);
-      //}
        name=na.name;
        url=na.url;
     }
=======================================
---  
/branches/red5sip/src/java/org/zoolu/sip/authentication/DigestAuthentication.java	 
Fri Feb 10 07:37:46 2012
+++  
/branches/red5sip/src/java/org/zoolu/sip/authentication/DigestAuthentication.java	 
Sun Feb 17 19:49:41 2013
@@ -1,6 +1,8 @@
  package org.zoolu.sip.authentication;


+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
  import org.zoolu.sip.header.AuthenticationHeader;
  import org.zoolu.sip.header.AuthorizationHeader;
  import org.zoolu.sip.header.ProxyAuthorizationHeader;
@@ -18,6 +20,7 @@
    */
  public class DigestAuthentication
  {
+	protected static Logger log =  
LoggerFactory.getLogger(DigestAuthentication.class);
     protected String method;
     protected String username;
     protected String passwd;
@@ -283,10 +286,10 @@

        String response1=a.getResponse();
        String response2="6629fae49393a05397450978507c4ef1";
-      System.out.println(response1);
-      System.out.println(response2);
+      log.debug(response1);
+      log.debug(response2);

-      System.out.println(" ");
+      log.debug(" ");


        String ah_str="Digest username=\"Mufasa\",  
realm=\"testrealm@host.com\", nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\",  
uri=\"/dir/index.html\", qop=auth, nc=00000001, cnonce=\"0a4f113b\",  
response=\"6629fae49393a05397450978507c4ef1\",  
opaque=\"5ccc069c403ebaf9f0171e9517f40e41\"\n";
@@ -295,10 +298,10 @@
        a=new DigestAuthentication("GET",ah,null,"Circle Of Life");
        response1=a.getResponse();
        response2="6629fae49393a05397450978507c4ef1";
-      System.out.println(response1);
-      System.out.println(response2);
+      log.debug(response1);
+      log.debug(response2);

-      System.out.println(a.checkResponse());
+      log.debug("" + a.checkResponse());

     }
  }
=======================================
--- /branches/red5sip/src/java/org/zoolu/sip/header/ParametricHeader.java	 
Thu Feb 14 09:33:19 2013
+++ /branches/red5sip/src/java/org/zoolu/sip/header/ParametricHeader.java	 
Sun Feb 17 19:49:41 2013
@@ -98,10 +98,8 @@
     public void removeParameters()
     {  if (!hasParameters()) return;
        String header=getValue();
-      //System.out.println(header);
        int i=header.indexOf(';');
        header=header.substring(0,i);
-      //System.out.println(header);
        setValue(header);
     }

=======================================
---  
/branches/red5sip/src/java/org/zoolu/sip/message/BaseMessageFactory.java	 
Thu Feb 14 09:33:19 2013
+++  
/branches/red5sip/src/java/org/zoolu/sip/message/BaseMessageFactory.java	 
Sun Feb 17 19:49:41 2013
@@ -97,7 +97,6 @@
        if (contact!=null)
        {  MultipleHeader contacts=new MultipleHeader(SipHeaders.Contact);
           contacts.addBottom(new ContactHeader(contact));
-         //System.out.println("DEBUG: Contact: "+contact.toString());
           req.setContacts(contacts);
        }
        req.setExpiresHeader(new  
ExpiresHeader(String.valueOf(SipStack.default_expires)));
@@ -105,7 +104,6 @@
        if (SipStack.ua_info!=null) req.setUserAgentHeader(new  
UserAgentHeader(SipStack.ua_info));
        //if (body!=null) req.setBody(body); else req.setBody("");
        req.setBody(body);
-      //System.out.println("DEBUG: MessageFactory: request:\n"+req);
        return req;
     }

@@ -401,7 +399,6 @@
        //if (body!=null) resp.setBody(body); else resp.setBody("");
        if (content_type==null) resp.setBody(body);
        else resp.setBody(content_type,body);
-      //System.out.println("DEBUG: MessageFactory:  
response:\n"+resp.toString());
        return resp;
     }

=======================================
--- /branches/red5sip/src/java/org/zoolu/sip/provider/SipParser.java	Thu  
Feb 14 09:33:19 2013
+++ /branches/red5sip/src/java/org/zoolu/sip/provider/SipParser.java	Sun  
Feb 17 19:49:41 2013
@@ -242,8 +242,6 @@
        SipURL url=null;
        int begin=getPos();
        int begin_url=indexOf("<sip:");
-      //System.out.println("DEBUG: inside parseNameAddress():  
str="+this.getRemainingString());
-      //System.out.println("DEBUG: inside parseNameAddress():  
index="+begin_url);
        if (begin_url<0)
        {  url=getSipURL();
           //if (url==null) return null;
=======================================
--- /branches/red5sip/src/java/org/zoolu/sip/provider/SipProvider.java	Thu  
Feb 14 09:33:19 2013
+++ /branches/red5sip/src/java/org/zoolu/sip/provider/SipProvider.java	Sun  
Feb 17 19:49:41 2013
@@ -41,6 +41,8 @@
  import java.util.Enumeration;
  import java.util.Hashtable;

+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
  import org.zoolu.net.IpAddress;
  import org.zoolu.net.SocketAddress;
  import org.zoolu.net.TcpServer;
@@ -108,7 +110,7 @@
    */
  public class SipProvider implements Configurable, TransportListener,  
TcpServerListener
  {
-
+	protected static Logger log = LoggerFactory.getLogger(SipProvider.class);
     // **************************** Constants ****************************

     /** UDP protocol type */
@@ -441,16 +443,18 @@
        if (attribute.equals("log_all_packets")) {  
log_all_packets=(par.getString().toLowerCase().startsWith("y")); return; }

        // old parameters
-      if (attribute.equals("host_addr")) System.err.println("WARNING:  
parameter 'host_addr' is no more supported; use 'via_addr' instead.");
-      if (attribute.equals("all_interfaces")) System.err.println("WARNING:  
parameter 'all_interfaces' is no more supported; use 'host_iaddr' for  
setting a specific interface or let it undefined.");
-      if (attribute.equals("use_outbound")) System.err.println("WARNING:  
parameter 'use_outbound' is no more supported; use 'outbound_proxy' for  
setting an outbound proxy or let it undefined.");
+      if (attribute.equals("host_addr")) log.warn("WARNING:  
parameter 'host_addr' is no more supported; use 'via_addr' instead.");
+      if (attribute.equals("all_interfaces")) log.warn("WARNING:  
parameter 'all_interfaces' is no more supported; use 'host_iaddr' for  
setting a specific interface or let it undefined.");
+      if (attribute.equals("use_outbound")) log.warn("WARNING:  
parameter 'use_outbound' is no more supported; use 'outbound_proxy' for  
setting an outbound proxy or let it undefined.");
        if (attribute.equals("outbound_addr"))
-      {  System.err.println("WARNING: parameter 'outbound_addr' has been  
deprecated; use 'outbound_proxy=<host_addr>[:<host_port>]' instead.");
+      {
+    	  log.warn("WARNING: parameter 'outbound_addr' has been deprecated;  
use 'outbound_proxy=<host_addr>[:<host_port>]' instead.");
           outbound_addr=par.getString();
           return;
        }
        if (attribute.equals("outbound_port"))
-      {  System.err.println("WARNING: parameter 'outbound_port' has been  
deprecated; use 'outbound_proxy=<host_addr>[:<host_port>]' instead.");
+      {
+    	  log.warn("WARNING: parameter 'outbound_port' has been deprecated;  
use 'outbound_proxy=<host_addr>[:<host_port>]' instead.");
           outbound_port=par.getInt();
           return;
        }
@@ -1152,8 +1156,8 @@
        {  printWarning("Error handling a new incoming  
message",LogLevel.HIGH);
           printException(e,LogLevel.MEDIUM);
           if (exception_listeners==null || exception_listeners.size()==0)
-         {  System.err.println("Error handling a new incoming message");
-            e.printStackTrace();
+         {
+        	 log.error("Error handling a new incoming message", e);
           }
           else
           {  for (Iterator i=exception_listeners.iterator(); i.hasNext(); )
=======================================
--- /branches/red5sip/src/java/org/zoolu/sip/provider/SipStack.java	Thu Feb  
14 08:34:08 2013
+++ /branches/red5sip/src/java/org/zoolu/sip/provider/SipStack.java	Sun Feb  
17 19:49:41 2013
@@ -24,6 +24,8 @@
  package org.zoolu.sip.provider;


+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
  import org.zoolu.tools.Configure;
  import org.zoolu.tools.Parser;
  import org.zoolu.tools.RotatingLog;
@@ -37,6 +39,7 @@
    */
  public class SipStack extends Configure
  {
+	protected static Logger log = LoggerFactory.getLogger(SipStack.class);
     // ********************** private attributes **********************

     /** Whether SipStack configuration has been already loaded */
@@ -249,6 +252,7 @@

     /** Logs a string message. */
     private static void printLog(String str)
-   {  System.out.println("SipStack: "+str);
+   {
+	   log.debug("SipStack: "+str);
     }
  }
=======================================
--- /branches/red5sip/src/java/org/zoolu/sip/provider/SpcHashtable.java	Thu  
Feb 14 08:34:08 2013
+++ /branches/red5sip/src/java/org/zoolu/sip/provider/SpcHashtable.java	Sun  
Feb 17 19:49:41 2013
@@ -26,6 +26,9 @@

  import java.util.Hashtable;

+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
  /*
   * special Hashtable that allows dupelicates of specified keys
   *
@@ -33,6 +36,7 @@

  public class SpcHashtable extends Hashtable<Object,Object>
  {
+    protected static Logger log =  
LoggerFactory.getLogger(SpcHashtable.class);
  	static final long serialVersionUID = 2423442L;

  	Hashtable<? extends Object,? extends Object> dupeKeysList=null;
@@ -198,50 +202,50 @@

  		myHash.put(regKey, new StringBuffer("stuff"));

-		System.out.println(myHash.toString());
+		log.debug(myHash.toString());

-		System.out.println("hashsize="+myHash.size());
+		log.debug("hashsize="+myHash.size());

-		System.out.println("hasdupekey="+myHash.containsKey(dupeKey));
-		System.out.println("hasregkey="+myHash.containsKey(regKey));
-		System.out.println("");
+		log.debug("hasdupekey="+myHash.containsKey(dupeKey));
+		log.debug("hasregkey="+myHash.containsKey(regKey));
+		log.debug("");

  		StringBuffer gtps=(StringBuffer) myHash.get(dupeKey);
-		System.out.println("gtps="+gtps);
+		log.debug("gtps="+gtps);

-		System.out.println("");
-		System.out.println("getPair3="+myHash.get(dupeKey,ps[3]));
+		log.debug("");
+		log.debug("getPair3="+myHash.get(dupeKey,ps[3]));

-		System.out.println("removePair3="+myHash.removePair(dupeKey,ps[3]));
-		System.out.println("getPair3="+myHash.get(dupeKey,ps[3]));
-		System.out.println("");
+		log.debug("removePair3="+myHash.removePair(dupeKey,ps[3]));
+		log.debug("getPair3="+myHash.get(dupeKey,ps[3]));
+		log.debug("");

  		myHash.remove(dupeKey);
-		System.out.println("removedAPair");
+		log.debug("removedAPair");

-		System.out.println(myHash.toString());
+		log.debug(myHash.toString());



  		for (int o=0;o<ps.length;o++)
  		{
-			System.out.println("---------------");
+			log.debug("---------------");
  			StringBuffer tps=(StringBuffer) myHash.get(dupeKey);
-			System.out.println("ps="+tps);
+			log.debug("ps="+tps);


-			System.out.println("removePair"+o+"="+myHash.removePair(dupeKey,ps[o]));
+			log.debug("removePair"+o+"="+myHash.removePair(dupeKey,ps[o]));

-			System.out.println("hasdupekey="+myHash.containsKey(dupeKey));
+			log.debug("hasdupekey="+myHash.containsKey(dupeKey));

  		}

-		System.out.println("");
-		System.out.println(myHash.toString());
-		System.out.println("hashsize="+myHash.size());
+		log.debug("");
+		log.debug(myHash.toString());
+		log.debug("hashsize="+myHash.size());

-		System.out.println("getRegKey="+myHash.get(regKey).toString());
-		System.out.println("hasregkey="+myHash.containsKey(regKey));
+		log.debug("getRegKey="+myHash.get(regKey).toString());
+		log.debug("hasregkey="+myHash.containsKey(regKey));

  	}

=======================================
--- /branches/red5sip/src/java/org/zoolu/sip/provider/TcpTransport.java	Thu  
Feb 14 08:34:08 2013
+++ /branches/red5sip/src/java/org/zoolu/sip/provider/TcpTransport.java	Sun  
Feb 17 19:49:41 2013
@@ -144,7 +144,7 @@
        SipParser par=new SipParser(text);
        Message msg=par.getSipMessage();
        while (msg!=null)
-      {  //System.out.println("DEBUG: message len: "+msg.getLength());
+      {
           msg.setRemoteAddress(tcp_conn.getRemoteAddress().toString());
           msg.setRemotePort(tcp_conn.getRemotePort());
           msg.setTransport(PROTO_TCP);
@@ -152,7 +152,6 @@
           if (listener!=null) listener.onReceivedMessage(this,msg);

           text=par.getRemainingString();
-         //System.out.println("DEBUG: text left: "+text.length());
           par=new SipParser(text);
           msg=par.getSipMessage();
        }
=======================================
--- /branches/red5sip/src/java/org/zoolu/tools/Archive.java	Thu Feb 14  
08:34:08 2013
+++ /branches/red5sip/src/java/org/zoolu/tools/Archive.java	Sun Feb 17  
19:49:41 2013
@@ -33,6 +33,9 @@
  import javax.sound.sampled.AudioInputStream;
  import javax.sound.sampled.AudioSystem;
  import javax.swing.ImageIcon;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
  //import java.net.URI;


@@ -40,6 +43,7 @@
  */
  public class Archive
  {
+	protected static Logger log = LoggerFactory.getLogger(Archive.class);
     /** The base path */
     public static String BASE_PATH=(new File("")).getAbsolutePath();
     //**** PersonalJava ****
@@ -55,7 +59,8 @@
        {  return new URL(url);
        }
        catch (java.net.MalformedURLException e)
-      {  System.err.println("ERROR: malformed url "+url);
+      {
+    	  log.error("ERROR: malformed url "+url);
           return null;
        }
     }
@@ -70,7 +75,8 @@
        {  return new URL("file:"+BASE_PATH+"/"+file_name);
        }
        catch (java.net.MalformedURLException e)
-      {  System.err.println("ERROR: malformed url "+url);
+      {
+    	  log.error("ERROR: malformed url "+url);
           return null;
        }
     }
@@ -105,7 +111,8 @@
           for (int i=0; i<4 && image.getWidth(null)<0; i++) try {  
Thread.sleep(80); } catch (Exception e) {}
        }
        catch (java.io.IOException e)
-      {  System.err.println("ERROR: can't read the file "+url.toString());
+      {
+    	  log.error("ERROR: can't read the file "+url.toString());
        }
        return image;
     }
@@ -128,7 +135,8 @@
           icon=new ImageIcon(url);
        }
        catch (java.io.IOException e)
-      {  System.err.println("ERROR: can't read the file "+url.toString());
+      {
+    	  log.error("ERROR: can't read the file "+url.toString());
        }
        return icon;
     }
@@ -143,7 +151,8 @@
        {  in=(url).openStream();
        }
        catch (java.io.IOException e)
-      {  System.err.println("ERROR: can't read the file "+url.toString());
+      {
+    	  log.error("ERROR: can't read the file "+url.toString());
        }
        return in;
     }
@@ -158,7 +167,8 @@
        {  in=AudioSystem.getAudioInputStream(url);
        }
        catch (java.io.IOException e)
-      {  System.err.println("ERROR: can't read the file "+url.toString());
+      {
+    	  log.error("ERROR: can't read the file "+url.toString());
        }
        return in;
     }
=======================================
--- /branches/red5sip/src/java/org/zoolu/tools/Base64.java	Wed Feb  6  
23:53:23 2013
+++ /branches/red5sip/src/java/org/zoolu/tools/Base64.java	Sun Feb 17  
19:49:41 2013
@@ -23,6 +23,9 @@

  package org.zoolu.tools;

+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+


  /** Class Base64 can be used for base64-encoding a byte array
@@ -32,6 +35,7 @@
    */
  public class Base64
  {
+	protected static Logger log = LoggerFactory.getLogger(Base64.class);
     private static final String base64codes  
="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
     private static int[] aux = new int[4];

@@ -59,7 +63,6 @@
           aux[3] = (bin[2] & 63);

           // uso gli interi memorizzati in aux[] come indice della stringa  
base64codes
-         //System.out.println("aux[0]="+aux[0]+" aux[1]="+aux[1]);
           stringacod = stringacod + base64codes.charAt(aux[0])+  
base64codes.charAt(aux[1])+
                         
base64codes.charAt(aux[2])+base64codes.charAt(aux[3]);
        }
@@ -170,13 +173,13 @@
        String messaggio = args[0];
        byte[] bmess = messaggio.getBytes();
        String mess64 = encode(bmess);
-      System.out.println("messaggio codificato: "+mess64);
+      log.debug("messaggio codificato: "+mess64);
        byte[] decodificato = decode(mess64);
        String strdecodificato = "";
        try {
        strdecodificato = new String (decodificato,"ISO-8859-1");
        }
        catch (Exception e) { e.printStackTrace();}
-      System.out.println("messaggio decodificato e: "+strdecodificato);
+      log.debug("messaggio decodificato e: "+strdecodificato);
     }
  }
=======================================
--- /branches/red5sip/src/java/org/zoolu/tools/Configure.java	Thu Feb 14  
08:34:08 2013
+++ /branches/red5sip/src/java/org/zoolu/tools/Configure.java	Sun Feb 17  
19:49:41 2013
@@ -30,12 +30,15 @@
  import java.io.FileWriter;
  import java.io.IOException;

+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+

  /** Configure helps the loading and saving of configuration data.
    */
  public class Configure
  {
-
+	protected static Logger log = LoggerFactory.getLogger(Configure.class);
     /** String 'NONE' used as undefined value (i.e. null). */
     public static String NONE="NONE";

@@ -68,12 +71,11 @@

     /** Loads Configure attributes from the specified <i>file</i> */
     protected void loadFile(String file)
-   {  //System.out.println("DEBUG: loading Configuration");
+   {
        if (file==null)
-      {  //System.out.println("DEBUG: no Configuration file");
+      {
           return;
        }
-      //else
        BufferedReader in=null;
        try
        {  in=new BufferedReader(new FileReader(file));
@@ -90,11 +92,11 @@
           in.close();
        }
        catch (Exception e)
-      {  System.err.println("WARNING: error reading file \""+file+"\"");
+      {
+    	  log.error("WARNING: error reading file \""+file+"\"");
           //System.exit(0);
           return;
        }
-      //System.out.println("DEBUG: loading Configuration: done.");
     }


@@ -108,7 +110,8 @@
           out.close();
        }
        catch (IOException e)
-      {  System.err.println("ERROR writing on file \""+file+"\"");
+      {
+    	  log.error("ERROR writing on file \""+file+"\"");
        }
     }

=======================================
--- /branches/red5sip/src/java/org/zoolu/tools/Mangle.java	Thu Feb 14  
09:33:19 2013
+++ /branches/red5sip/src/java/org/zoolu/tools/Mangle.java	Sun Feb 17  
19:49:41 2013
@@ -23,6 +23,9 @@

  package org.zoolu.tools;

+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+



@@ -30,6 +33,7 @@
    */
  public class Mangle
  {
+	protected static Logger log = LoggerFactory.getLogger(Mangle.class);

     /** Compares two arrays of bytes */
     public static boolean compare(byte[] a, byte[] b)
@@ -184,7 +188,8 @@


     private static void print(String str)
-   {  System.out.println(str);
+   {
+	   log.debug(str);
     }


=======================================
--- /branches/red5sip/src/java/org/zoolu/tools/Parser.java	Thu Feb 14  
09:33:19 2013
+++ /branches/red5sip/src/java/org/zoolu/tools/Parser.java	Sun Feb 17  
19:49:41 2013
@@ -26,6 +26,9 @@

  import java.util.Vector;

+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+

  /** Class Parser allows the parsing of String objects.
   *  <BR> An object Parser is costructed from a String object and provides  
various methods for parsing the String in a stream oriented manner.
@@ -41,6 +44,7 @@
   */
  public class Parser
  {
+	protected static Logger log = LoggerFactory.getLogger(Parser.class);

     /** The string that is being parsed. */
     protected String str;
@@ -451,8 +455,9 @@
           }
        }
        catch (RuntimeException e)
-      {  System.out.println("len= "+str.length());
-         System.out.println("index= "+index);
+      {
+    	  log.error("len= "+str.length());
+    	  log.error("index= "+index);
           throw e;
        }
        return this;