Index: /pjproject/trunk/pjlib/include/pj/config.h
===================================================================
--- /pjproject/trunk/pjlib/include/pj/config.h	(revision 642)
+++ /pjproject/trunk/pjlib/include/pj/config.h	(revision 643)
@@ -173,8 +173,8 @@
 
 
-#elif defined(PJ_M_MIPS) || defined(__mips__) || defined(__mips) || \\
+#elif defined(PJ_M_MIPS) || defined(__mips__) || defined(__mips) || \
 	defined(__MIPS__) || defined(MIPS) || defined(_MIPS_)
     /*
-     * MIPS, little endian
+     * MIPS, default to little endian
      */
 #   undef PJ_M_MIPS
@@ -182,6 +182,8 @@
 #   define PJ_M_NAME		"mips"
 #   define PJ_HAS_PENTIUM	0
-#   define PJ_IS_LITTLE_ENDIAN	1
-#   define PJ_IS_BIG_ENDIAN	0
+#   if !defined(PJ_IS_LITTLE_ENDIAN) && !defined(PJ_IS_BIG_ENDIAN)
+#   	define PJ_IS_LITTLE_ENDIAN	1
+#   	define PJ_IS_BIG_ENDIAN		0
+#   endif
 
 
@@ -221,6 +223,6 @@
 #   define PJ_M_NAME		"powerpc"
 #   define PJ_HAS_PENTIUM	0
-#   define PJ_IS_LITTLE_ENDIAN	1
-#   define PJ_IS_BIG_ENDIAN	0
+#   define PJ_IS_LITTLE_ENDIAN	0
+#   define PJ_IS_BIG_ENDIAN	1
 
 #else
Index: /pjproject/trunk/pjmedia/build/Makefile
===================================================================
--- /pjproject/trunk/pjmedia/build/Makefile	(revision 642)
+++ /pjproject/trunk/pjmedia/build/Makefile	(revision 643)
@@ -51,5 +51,6 @@
 		   $(CFLAGS) $(CC_INC)../include $(CC_INC)../../pjlib/include \
 		   $(CC_INC)../../pjlib-util/include \
-		   $(CC_INC)../src/pjmedia/portaudio
+		   $(CC_INC)../src/pjmedia/portaudio \
+		   $(CC_INC)../src/pjmedia-codec
 export _CXXFLAGS:= $(_CFLAGS) $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \
 		   $(HOST_CXXFLAGS) $(CXXFLAGS)
@@ -65,5 +66,5 @@
 export PJMEDIA_SRCDIR = ../src/pjmedia
 export PJMEDIA_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
-			alaw_ulaw.o \
+			aec_port.o alaw_ulaw.o \
 			clock_thread.o codec.o conference.o endpoint.o errno.o \
 			g711.o jbuf.o master_port.o mem_capture.o mem_player.o \
Index: /pjproject/trunk/pjmedia/src/pjmedia-codec/speex/misc.h
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia-codec/speex/misc.h	(revision 642)
+++ /pjproject/trunk/pjmedia/src/pjmedia-codec/speex/misc.h	(revision 643)
@@ -63,5 +63,5 @@
 #endif
 #ifdef FIXED_POINT_DEBUG
-#error Don't you think enabling fixed-point is a good thing to do if you want to debug that?
+#error Dont you think enabling fixed-point is a good thing to do if you want to debug that?
 #endif
 
Index: /pjproject/trunk/pjmedia/src/pjmedia/aec_port.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/aec_port.c	(revision 642)
+++ /pjproject/trunk/pjmedia/src/pjmedia/aec_port.c	(revision 643)
@@ -94,7 +94,11 @@
     *p_port = &aec_port->base;
 
-    PJ_LOG(4,(THIS_FILE, "AEC created for port %.*s", 
+    PJ_LOG(4,(THIS_FILE, "AEC created for port %.*s, clock_rate=%d, "
+			 "samples per frame=%d, tail length=%d ms", 
 			 (int)dn_port->info.name.slen,
-			 dn_port->info.name.ptr));
+			 dn_port->info.name.ptr,
+			 dn_port->info.clock_rate,
+			 dn_port->info.samples_per_frame,
+			 tail_length * 1000 / dn_port->info.clock_rate));
     return PJ_SUCCESS;
 }
Index: /pjproject/trunk/pjsip-apps/build/Makefile
===================================================================
--- /pjproject/trunk/pjsip-apps/build/Makefile	(revision 642)
+++ /pjproject/trunk/pjsip-apps/build/Makefile	(revision 643)
@@ -27,4 +27,5 @@
 		   $(subst /,$(HOST_PSEP),$(PJMEDIA_CODEC_LIB)) \
 		   $(subst /,$(HOST_PSEP),$(PJMEDIA_LIB)) \
+		   $(subst /,$(HOST_PSEP),$(PJMEDIA_CODEC_LIB)) \
 		   $(subst /,$(HOST_PSEP),$(PJLIB_UTIL_LIB)) \
 		   $(subst /,$(HOST_PSEP),$(PJLIB_LIB)) \
Index: /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c	(revision 642)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c	(revision 643)
@@ -127,4 +127,5 @@
     puts  ("  --ptime=MSEC        Override codec ptime to MSEC (default=specific)");
     puts  ("  --no-vad            Disable VAD/silence detector (default=vad enabled)");
+    puts  ("  --ec-tail=MSEC      Set echo canceller tail length (default=256)");
     puts  ("  --ilbc-mode=MODE    Set iLBC codec mode (20 or 30, default is 20)");
     puts  ("  --rx-drop-pct=PCT   Drop PCT percent of RX RTP (for pkt lost sim, default: 0)");
@@ -262,5 +263,5 @@
 	   OPT_PLAY_FILE, OPT_RTP_PORT, OPT_ADD_CODEC, OPT_ILBC_MODE,
 	   OPT_COMPLEXITY, OPT_QUALITY, OPT_PTIME, OPT_NO_VAD,
-	   OPT_RX_DROP_PCT, OPT_TX_DROP_PCT,
+	   OPT_RX_DROP_PCT, OPT_TX_DROP_PCT, OPT_EC_TAIL,
 	   OPT_NEXT_ACCOUNT, OPT_NEXT_CRED, OPT_MAX_CALLS, 
 	   OPT_DURATION, OPT_NO_TCP, OPT_NO_UDP,
@@ -304,4 +305,5 @@
 	{ "ptime",      1, 0, OPT_PTIME},
 	{ "no-vad",     0, 0, OPT_NO_VAD},
+	{ "ec-tail",    1, 0, OPT_EC_TAIL},
 	{ "ilbc-mode",	1, 0, OPT_ILBC_MODE},
 	{ "rx-drop-pct",1, 0, OPT_RX_DROP_PCT},
@@ -622,4 +624,13 @@
 	case OPT_NO_VAD:
 	    cfg->media_cfg.no_vad = PJ_TRUE;
+	    break;
+
+	case OPT_EC_TAIL:
+	    cfg->media_cfg.ec_tail_len = my_atoi(pj_optarg);
+	    if (cfg->media_cfg.ec_tail_len > 1000) {
+		PJ_LOG(1,(THIS_FILE, "I think the ec-tail length setting "
+			  "is too big"));
+		return -1;
+	    }
 	    break;
 
Index: /pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h	(revision 642)
+++ /pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h	(revision 643)
@@ -2132,5 +2132,5 @@
      * Echo canceller tail length, in miliseconds.
      *
-     * Default: 256
+     * Default: 0 (disabled, for now)
      */
     unsigned		ec_tail_len;
@@ -2153,5 +2153,5 @@
     cfg->quality = 6;
     cfg->ilbc_mode = 20;
-    cfg->ec_tail_len = 256;
+    cfg->ec_tail_len = 0;
 }
 
Index: /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c	(revision 642)
+++ /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c	(revision 643)
@@ -970,5 +970,5 @@
 
     /* Create AEC if it's not created */
-    if (pjsua_var.aec_port == NULL) {
+    if (pjsua_var.aec_port == NULL && pjsua_var.media_cfg.ec_tail_len) {
 	status = pjmedia_aec_port_create(pjsua_var.pool, conf_port,
 					 conf_port->info.clock_rate * 
@@ -985,5 +985,7 @@
 
     /* Connect to the AEC port */
-    status = pjmedia_snd_port_connect(pjsua_var.snd_port, pjsua_var.aec_port);
+    status = pjmedia_snd_port_connect(pjsua_var.snd_port, 
+				      pjsua_var.media_cfg.ec_tail_len ? 
+					pjsua_var.aec_port : conf_port );
     if (status != PJ_SUCCESS) {
 	pjsua_perror(THIS_FILE, "Unable to connect conference port to "
