Index: /pjproject/branches/1.x/pjmedia/include/pjmedia/sound_port.h
===================================================================
--- /pjproject/branches/1.x/pjmedia/include/pjmedia/sound_port.h	(revision 4064)
+++ /pjproject/branches/1.x/pjmedia/include/pjmedia/sound_port.h	(revision 4065)
@@ -76,4 +76,6 @@
 /**
  * This structure specifies the parameters to create the sound port.
+ * Use pjmedia_snd_port_param_default() to initialize this structure with
+ * default values (mostly zeroes)
  */
 typedef struct pjmedia_snd_port_param
@@ -88,5 +90,18 @@
      */
     unsigned options;
+
+    /**
+     * Echo cancellation options/flags.
+     */
+    unsigned ec_options;
+
 } pjmedia_snd_port_param;
+
+/**
+ * Initialize pjmedia_snd_port_param with default values.
+ *
+ * @param prm		    The parameter.
+ */
+PJ_DECL(void) pjmedia_snd_port_param_default(pjmedia_snd_port_param *prm);
 
 /**
Index: /pjproject/branches/1.x/pjmedia/src/pjmedia/sound_port.c
===================================================================
--- /pjproject/branches/1.x/pjmedia/src/pjmedia/sound_port.c	(revision 4064)
+++ /pjproject/branches/1.x/pjmedia/src/pjmedia/sound_port.c	(revision 4065)
@@ -50,4 +50,5 @@
     unsigned		 bits_per_sample;
     unsigned		 options;
+    unsigned		 prm_ec_options;
 
     /* software ec */
@@ -178,4 +179,10 @@
 
     return PJ_SUCCESS;
+}
+
+/* Initialize with default values (zero) */
+PJ_DEF(void) pjmedia_snd_port_param_default(pjmedia_snd_port_param *prm)
+{
+    pj_bzero(prm, sizeof(*prm));
 }
 
@@ -270,5 +277,6 @@
 	    
 	status = pjmedia_snd_port_set_ec(snd_port, pool, 
-					 snd_port->aud_param.ec_tail_ms, 0);
+					 snd_port->aud_param.ec_tail_ms,
+					 snd_port->prm_ec_options);
 	if (status != PJ_SUCCESS) {
 	    pjmedia_aud_stream_destroy(snd_port->aud_stream);
@@ -331,5 +339,5 @@
     pj_status_t status;
 
-    PJ_UNUSED_ARG(options);
+    pjmedia_snd_port_param_default(&param);
 
     status = pjmedia_aud_dev_default_param(rec_id, &param.base);
@@ -345,4 +353,5 @@
     param.base.bits_per_sample = bits_per_sample;
     param.options = options;
+    param.ec_options = 0;
 
     return pjmedia_snd_port_create2(pool, &param, p_port);
@@ -364,5 +373,5 @@
     pj_status_t status;
 
-    PJ_UNUSED_ARG(options);
+    pjmedia_snd_port_param_default(&param);
 
     status = pjmedia_aud_dev_default_param(dev_id, &param.base);
@@ -377,4 +386,5 @@
     param.base.bits_per_sample = bits_per_sample;
     param.options = options;
+    param.ec_options = 0;
 
     return pjmedia_snd_port_create2(pool, &param, p_port);
@@ -397,5 +407,5 @@
     pj_status_t status;
 
-    PJ_UNUSED_ARG(options);
+    pjmedia_snd_port_param_default(&param);
 
     status = pjmedia_aud_dev_default_param(dev_id, &param.base);
@@ -410,4 +420,5 @@
     param.base.bits_per_sample = bits_per_sample;
     param.options = options;
+    param.ec_options = 0;
 
     return pjmedia_snd_port_create2(pool, &param, p_port);
@@ -437,6 +448,7 @@
     snd_port->samples_per_frame = prm->base.samples_per_frame;
     snd_port->bits_per_sample = prm->base.bits_per_sample;
-    pj_memcpy(&snd_port->aud_param, prm, sizeof(snd_port->aud_param));
+    pj_memcpy(&snd_port->aud_param, &prm->base, sizeof(snd_port->aud_param));
     snd_port->options = prm->options;
+    snd_port->prm_ec_options = prm->ec_options;
     
     /* Start sound device immediately.
Index: /pjproject/branches/1.x/pjsip/src/pjsua-lib/pjsua_media.c
===================================================================
--- /pjproject/branches/1.x/pjsip/src/pjsua-lib/pjsua_media.c	(revision 4064)
+++ /pjproject/branches/1.x/pjsip/src/pjsua-lib/pjsua_media.c	(revision 4065)
@@ -2029,4 +2029,7 @@
 		pjmedia_snd_port_param param;
 
+		pjmedia_snd_port_param_default(&param);
+		param.ec_options = pjsua_var.media_cfg.ec_options;
+
 		/* Create parameter based on peer info */
 		status = create_aud_param(&param.base, pjsua_var.cap_dev, 
@@ -2953,4 +2956,6 @@
 			    pjsua_var.media_cfg.audio_frame_ptime *
 			    pjsua_var.media_cfg.channel_count / 1000;
+	pjmedia_snd_port_param_default(&param);
+	param.ec_options = pjsua_var.media_cfg.ec_options;
 	status = create_aud_param(&param.base, capture_dev, playback_dev, 
 				  alt_cr[i], pjsua_var.media_cfg.channel_count,
@@ -3081,4 +3086,5 @@
 
     pjsua_var.media_cfg.ec_tail_len = tail_ms;
+    pjsua_var.media_cfg.ec_options = options;
 
     if (pjsua_var.snd_port)
