diff --git a/console/linphonec.c b/console/linphonec.c
index c3eb8ace26d2871c91dfac38fc0ce615e5b7668f..de3ce9e44c740d509d6c8d5b8fb75f8bdcdfff1d 100644
--- a/console/linphonec.c
+++ b/console/linphonec.c
@@ -107,7 +107,7 @@ static int copy_file(const char *from, const char *to);
 #endif /*_WIN32_WCE*/
 static int linphonec_parse_cmdline(int argc, char **argv);
 static int linphonec_init(int argc, char **argv);
-static int linphonec_main_loop (LinphoneCore * opm, char * sipAddr);
+static int linphonec_main_loop (LinphoneCore * opm);
 static int linphonec_idle_call (void);
 #ifdef HAVE_READLINE
 static int linphonec_initialize_readline(void);
@@ -161,7 +161,7 @@ static int trace_level = 0;
 static char *logfile_name = NULL;
 static char configfile_name[PATH_MAX];
 static const char *factory_configfile_name=NULL;
-static char *sipAddr = NULL; /* for autocall */
+static char *sip_addr_to_call = NULL; /* for autocall */
 static int window_id = 0; /* 0=standalone window, or window id for embedding video */
 #if !defined(_WIN32_WCE)
 static ortp_pipe_t client_sock=ORTP_PIPE_INVALID;
@@ -630,7 +630,7 @@ main (int argc, char *argv[]) {
 	
 	if (! linphonec_init(argc, argv) ) exit(EXIT_FAILURE);
 
-	linphonec_main_loop (linphonec, sipAddr);
+	linphonec_main_loop (linphonec);
 
 	linphonec_finish(EXIT_SUCCESS);
 
@@ -985,6 +985,14 @@ linphonec_idle_call ()
 		linphone_core_accept_call(opm,NULL);
 		answer_call=FALSE;
 	}
+	/* auto call handling */
+	if (sip_addr_to_call != NULL )
+	{
+		char buf[512];
+		snprintf (buf, sizeof(buf),"call %s", sip_addr_to_call);
+		sip_addr_to_call=NULL;
+		linphonec_parse_command_line(linphonec, buf);
+	}
 
 	if ( auth_stack.nitems )
 	{
@@ -1073,21 +1081,13 @@ static void print_prompt(LinphoneCore *opm){
 }
 
 static int
-linphonec_main_loop (LinphoneCore * opm, char * sipAddr)
+linphonec_main_loop (LinphoneCore * opm)
 {
-	char buf[LINE_MAX_LEN]; /* auto call handling */
 	char *input;
 
 	print_prompt(opm);
 
 
-	/* auto call handling */
-	if (sipAddr != NULL )
-	{
-		snprintf (buf, sizeof(buf),"call %s", sipAddr);
-		linphonec_parse_command_line(linphonec, buf);
-	}
-
 	while (linphonec_running && (input=linphonec_readline(prompt)))
 	{
 		char *iptr; /* input and input pointer */
@@ -1195,7 +1195,7 @@ linphonec_parse_cmdline(int argc, char **argv)
 		{
 			arg_num++;
 			if (arg_num < argc)
-				sipAddr = argv[arg_num];
+				sip_addr_to_call = argv[arg_num];
 		}
                 else if (strncmp ("-a", argv[arg_num], 2) == 0)
                 {
diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c
index c3264d99bbdb7203ca4b864c701857e55fb39a14..02854fed20ac12f3299af9403fa37b8340235818 100644
--- a/coreapi/linphonecall.c
+++ b/coreapi/linphonecall.c
@@ -649,10 +649,14 @@ void linphone_call_init_media_streams(LinphoneCall *call){
 	audio_stream_enable_gain_control(audiostream,TRUE);
 	if (linphone_core_echo_cancellation_enabled(lc)){
 		int len,delay,framesize;
+		const char *statestr=lp_config_get_string(lc->config,"sound","ec_state",NULL);
 		len=lp_config_get_int(lc->config,"sound","ec_tail_len",0);
 		delay=lp_config_get_int(lc->config,"sound","ec_delay",0);
 		framesize=lp_config_get_int(lc->config,"sound","ec_framesize",0);
 		audio_stream_set_echo_canceller_params(audiostream,len,delay,framesize);
+		if (statestr && audiostream->ec){
+			ms_filter_call_method(audiostream->ec,MS_ECHO_CANCELLER_SET_STATE_STRING,(void*)statestr);
+		}
 	}
 	audio_stream_enable_automatic_gain_control(audiostream,linphone_core_agc_enabled(lc));
 	{
@@ -859,7 +863,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
 	{
 		const SalStreamDescription *stream=sal_media_description_find_stream(call->resultdesc,
 		    					SalProtoRtpAvp,SalAudio);
-		if (stream && stream->dir!=SalStreamInactive){
+		if (stream && stream->dir!=SalStreamInactive && stream->port!=0){
 			MSSndCard *playcard=lc->sound_conf.lsd_card ? 
 				lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard;
 			MSSndCard *captcard=lc->sound_conf.capt_sndcard;
@@ -941,7 +945,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
 			lc->previewstream=NULL;
 		}
 		call->current_params.has_video=FALSE;
-		if (vstream && vstream->dir!=SalStreamInactive) {
+		if (vstream && vstream->dir!=SalStreamInactive && vstream->port!=0) {
 			const char *addr=vstream->addr[0]!='\0' ? vstream->addr : call->resultdesc->addr;
 			call->video_profile=make_profile(call,call->resultdesc,vstream,&used_pt);
 			if (used_pt!=-1){
@@ -1009,6 +1013,14 @@ static void linphone_call_log_fill_stats(LinphoneCallLog *log, AudioStream *st){
 
 void linphone_call_stop_media_streams(LinphoneCall *call){
 	if (call->audiostream!=NULL) {
+		if (call->audiostream->ec){
+			const char *state_str=NULL;
+			ms_filter_call_method(call->audiostream->ec,MS_ECHO_CANCELLER_GET_STATE_STRING,&state_str);
+			if (state_str){
+				ms_message("Writing echo canceller state, %i bytes",strlen(state_str));
+				lp_config_set_string(call->core->config,"sound","ec_state",state_str);
+			}
+		}
 		linphone_call_log_fill_stats (call->log,call->audiostream);
 		audio_stream_stop(call->audiostream);
 		call->audiostream=NULL;
diff --git a/coreapi/lpconfig.c b/coreapi/lpconfig.c
index a7dbac214af4c666aeb08a2814aa4df665b8e111..ce093cbaf6831ef5a11ba8d0ad499c0f03eed96f 100644
--- a/coreapi/lpconfig.c
+++ b/coreapi/lpconfig.c
@@ -22,7 +22,7 @@
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#define MAX_LEN 1024
+#define MAX_LEN 32768
 
 #include "linphonecore.h"
 
diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c
index 82e1fb5091d4d3e219490cc853582749b94b42a0..3993e66f8179514c9b2e2b8b742d4791e9dbd9e4 100644
--- a/coreapi/sal_eXosip2_sdp.c
+++ b/coreapi/sal_eXosip2_sdp.c
@@ -241,8 +241,14 @@ static void add_line(sdp_message_t *msg, int lineno, const SalStreamDescription
 	if (desc->ptime>0) sdp_message_a_attribute_add(msg,lineno,osip_strdup("ptime"),
 	    			int_2char(desc->ptime));
 	strip_well_known_rtpmaps=ms_list_size(desc->payloads)>5;
-	for(elem=desc->payloads;elem!=NULL;elem=elem->next){
-		add_payload(msg, lineno, (PayloadType*)elem->data,strip_well_known_rtpmaps);
+	if (desc->payloads){
+		for(elem=desc->payloads;elem!=NULL;elem=elem->next){
+			add_payload(msg, lineno, (PayloadType*)elem->data,strip_well_known_rtpmaps);
+		}
+	}else{
+		/* to comply with SDP we cannot have an empty payload type number list */
+		/* as it happens only when mline is declined with a zero port, it does not matter to put whatever codec*/
+		sdp_message_m_payload_add (msg,lineno, int_2char (0));
 	}
 	switch(desc->dir){
 		case SalStreamSendRecv:
diff --git a/mediastreamer2 b/mediastreamer2
index 5c2fe943251c5af493d18133251abf91e0ce5e83..39a3f4ddd4a0f60cdd563fdef1d1b7d6e04d140d 160000
--- a/mediastreamer2
+++ b/mediastreamer2
@@ -1 +1 @@
-Subproject commit 5c2fe943251c5af493d18133251abf91e0ce5e83
+Subproject commit 39a3f4ddd4a0f60cdd563fdef1d1b7d6e04d140d