From 8bc6a6620841c6571ff31bdec162ef89c82dc50b Mon Sep 17 00:00:00 2001
From: smorlat <smorlat@3f6dc0c8-ddfe-455d-9043-3cd528dc4637>
Date: Thu, 29 Jan 2009 09:29:46 +0000
Subject: [PATCH] merge patch fixing a portaudio plugin bug tcp access to
 linphonec shell is enabled.

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@239 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
---
 linphone/NEWS                        |  10 ++
 linphone/console/Makefile.am         |  21 ++--
 linphone/console/commands.c          | 170 ++++++++++++++-------------
 linphone/console/linphonec.c         | 147 +++++++++++++++++++++--
 linphone/gtk-glade/main.c            |  22 ++--
 linphone/mediastreamer2/NEWS         |   9 ++
 linphone/mediastreamer2/configure.ac |   4 +-
 linphone/mediastreamer2/src/pasnd.c  |   3 +-
 linphone/oRTP/include/ortp/port.h    |   1 +
 linphone/oRTP/src/ortp.c             |  10 +-
 10 files changed, 277 insertions(+), 120 deletions(-)

diff --git a/linphone/NEWS b/linphone/NEWS
index 4ef33607fe..036cf1134b 100644
--- a/linphone/NEWS
+++ b/linphone/NEWS
@@ -1,3 +1,13 @@
+linphone-3.1.0 -- January 19, 2009
+	* linphone can now send large video pictures: up to SVGA, configurable via the user interface
+	* automatic rescaling of the video windows to the video size of incoming stream
+	* improved webcam support on windows
+	* plenty of user interface cosmetic improvements
+	* set a user friendly gtk theme by default on windows
+	* linphonec can compile and work without libreadline
+	* enable translations on windows
+	* bugfixing as usual
+
 linphone-3.0.0  -- October 13, 2008
 	* new graphical interface based on Glade/Gtk
 	* systray icon
diff --git a/linphone/console/Makefile.am b/linphone/console/Makefile.am
index d4a481f9e3..2c5caab815 100644
--- a/linphone/console/Makefile.am
+++ b/linphone/console/Makefile.am
@@ -11,27 +11,32 @@ INCLUDES = \
 
 
 
-bin_PROGRAMS =  linphonec sipomatic
+bin_PROGRAMS =  linphonec sipomatic linphonecsh
 
 linphonec_SOURCES = linphonec.c linphonec.h commands.c
 
-linphonec_LDADD = $(top_builddir)/coreapi/liblinphone.la $(READLINE_LIBS) $(OSIP_LIBS)
+linphonec_LDADD = $(top_builddir)/coreapi/liblinphone.la $(READLINE_LIBS)  \
+		$(top_builddir)/mediastreamer2/src/libmediastreamer.la \
+		$(ORTP_LIBS) \
+		$(SPEEX_LIBS) \
+		$(OSIP_LIBS)
 
 sipomatic_SOURCES=\
 	sipomatic.c sipomatic.h
 
 sipomatic_LDADD= 	$(INTLLIBS)  \
-					$(top_builddir)/coreapi/liblinphone.la \
+			$(top_builddir)/coreapi/liblinphone.la \
+			$(top_builddir)/mediastreamer2/src/libmediastreamer.la \
+			$(ORTP_LIBS) \
+			$(SPEEX_LIBS) \
 			$(OSIP_LIBS)
 
+linphonecsh_SOURCES = shell.c
+linphonecsh_LDADD = $(ORTP_LIBS)
+
 endif
 
 AM_CFLAGS=$(STRICT_OPTIONS)  -DENABLE_TRACE -D_ORTP_SOURCE $(VIDEO_CFLAGS) $(READLINE_CFLAGS) $(OSIP_CFLAGS)
 
 
 
-AM_LDFLAGS= 	$(top_builddir)/mediastreamer2/src/libmediastreamer.la \
-		$(ORTP_LIBS) \
-		$(SPEEX_LIBS) \
-		$(OSIP_LIBS)
-
diff --git a/linphone/console/commands.c b/linphone/console/commands.c
index 5191b260d2..6d03d59567 100644
--- a/linphone/console/commands.c
+++ b/linphone/console/commands.c
@@ -5,21 +5,21 @@
  *  Copyright (C) 2006  Sandro Santilli <strk@keybit.net>
  *  Copyright (C) 2004  Simon MORLAT <simon.morlat@linphone.org>
  *
- ****************************************************************************
+****************************************************************************
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Library General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
  ****************************************************************************/
 
@@ -74,6 +74,10 @@ static int linphonec_friend_delete(LinphoneCore *lc, int num);
 /* Command table management */
 static LPC_COMMAND *lpc_find_command(const char *name);
 
+void linphonec_out(const char *fmt,...);
+
+
+
 /***************************************************************************
  *
  *  Global variables
@@ -199,13 +203,13 @@ linphonec_parse_command_line(LinphoneCore *lc, char *cl)
 	cmd=lpc_find_command(cl);
 	if ( !cmd )
 	{
-		printf("'%s': Cannot understand this.\n", cl);
+		linphonec_out("'%s': Cannot understand this.\n", cl);
 		return 1;
 	}
 
 	if ( ! cmd->func(lc, args) )
 	{
-		printf("Syntax error.\n");
+		linphonec_out("Syntax error.\n");
 		linphonec_display_command_help(cmd);
 	}
 
@@ -262,18 +266,18 @@ lpc_cmd_help(LinphoneCore *lc, char *arg)
 
 	if (!arg || !*arg)
 	{
-		printf("Commands are:\n");
-		printf("---------------------------\n");
+		linphonec_out("Commands are:\n");
+		linphonec_out("---------------------------\n");
 
 		while (commands[i].help)
 		{
-			printf("%10.10s\t%s\n", commands[i].name,
+			linphonec_out("%10.10s\t%s\n", commands[i].name,
 				commands[i].help);
 			i++;
 		}
 		
-		printf("---------------------------\n");
-		printf("Type 'help <command>' for more details.\n");
+		linphonec_out("---------------------------\n");
+		linphonec_out("Type 'help <command>' for more details.\n");
 
 		return 1;
 	}
@@ -281,7 +285,7 @@ lpc_cmd_help(LinphoneCore *lc, char *arg)
 	cmd=lpc_find_command(arg);
 	if ( !cmd )
 	{
-		printf("No such command.\n");
+		linphonec_out("No such command.\n");
 		return 1;
 	}
 
@@ -300,13 +304,13 @@ lpc_cmd_call(LinphoneCore *lc, char *args)
 
 	if ( lc->call != NULL )
 	{
-		printf("Terminate current call first.\n");
+		linphonec_out("Terminate current call first.\n");
 	}
 	else
 	{
 		if ( -1 == linphone_core_invite(lc, args) )
 		{
-			printf("Error from linphone_core_invite.\n");
+			linphonec_out("Error from linphone_core_invite.\n");
 		}
 		else
 		{
@@ -322,7 +326,7 @@ lpc_cmd_refer(LinphoneCore *lc, char *args)
 	if (args)
 		linphone_core_refer(lc, args);
 	else{
-		printf("refer needs an argument\n");
+		linphonec_out("refer needs an argument\n");
 	}
 	return 1;
 }
@@ -332,7 +336,7 @@ lpc_cmd_terminate(LinphoneCore *lc, char *args)
 {
 	if ( -1 == linphone_core_terminate_call(lc, NULL) )
 	{
-		printf("No active call.\n");
+		linphonec_out("No active call.\n");
 	}
 	return 1;
 }
@@ -342,7 +346,7 @@ lpc_cmd_answer(LinphoneCore *lc, char *args)
 {
 	if ( -1 == linphone_core_accept_call(lc, NULL) )
 	{
-		printf("No incoming call.\n");
+		linphonec_out("No incoming call.\n");
 	}
 	return 1;
 }
@@ -370,7 +374,7 @@ lpc_cmd_nat(LinphoneCore *lc, char *args)
 
 	nat = linphone_core_get_nat_address(lc);
 	use = linphone_core_get_firewall_policy(lc)==LINPHONE_POLICY_USE_NAT_ADDRESS;
-	printf("Nat address: %s%s\n", nat ? nat : "unspecified" , use ? "" : " (disabled - use 'firewall nat' to enable)");
+	linphonec_out("Nat address: %s%s\n", nat ? nat : "unspecified" , use ? "" : " (disabled - use 'firewall nat' to enable)");
 
 	return 1;
 }
@@ -391,7 +395,7 @@ lpc_cmd_stun(LinphoneCore *lc, char *args)
 
 	stun = linphone_core_get_stun_server(lc);
 	use = linphone_core_get_firewall_policy(lc)==LINPHONE_POLICY_USE_STUN;
-	printf("Stun server: %s%s\n", stun ? stun : "unspecified" , use? "" : " (disabled - use 'firewall stun' to enable)");
+	linphonec_out("Stun server: %s%s\n", stun ? stun : "unspecified" , use? "" : " (disabled - use 'firewall stun' to enable)");
 
 	return 1;
 }
@@ -414,7 +418,7 @@ lpc_cmd_firewall(LinphoneCore *lc, char *args)
 			setting = linphone_core_get_stun_server(lc);
 			if ( ! setting )
 			{
-				printf("No stun server address is defined, use 'stun <address>' first");
+				linphonec_out("No stun server address is defined, use 'stun <address>' first");
 				return 1;
 			}
 			linphone_core_set_firewall_policy(lc,LINPHONE_POLICY_USE_STUN);
@@ -424,7 +428,7 @@ lpc_cmd_firewall(LinphoneCore *lc, char *args)
 			setting = linphone_core_get_nat_address(lc);
 			if ( ! setting )
 			{
-				printf("No nat address is defined, use 'nat <address>' first");
+				linphonec_out("No nat address is defined, use 'nat <address>' first");
 				return 1;
 			}
 			linphone_core_set_firewall_policy(lc,LINPHONE_POLICY_USE_NAT_ADDRESS);
@@ -434,13 +438,13 @@ lpc_cmd_firewall(LinphoneCore *lc, char *args)
 	switch(linphone_core_get_firewall_policy(lc))
 	{
 		case LINPHONE_POLICY_NO_FIREWALL:
-			printf("No firewall\n");
+			linphonec_out("No firewall\n");
 			break;
 		case LINPHONE_POLICY_USE_STUN:
-			printf("Using stun server %s to discover firewall address\n", setting ? setting : linphone_core_get_stun_server(lc));
+			linphonec_out("Using stun server %s to discover firewall address\n", setting ? setting : linphone_core_get_stun_server(lc));
 			break;
 		case LINPHONE_POLICY_USE_NAT_ADDRESS:
-			printf("Using supplied nat address %s.\n", setting ? setting : linphone_core_get_nat_address(lc));
+			linphonec_out("Using supplied nat address %s.\n", setting ? setting : linphone_core_get_nat_address(lc));
 			break;
 	}
 	return 1;
@@ -496,7 +500,7 @@ lpc_cmd_friend(LinphoneCore *lc, char *args)
 		if ( ! *args ) return 0;
 		friend_num = strtol(args, NULL, 10);
 		if ( errno == ERANGE ) {
-			printf("Invalid friend number\n");
+			linphonec_out("Invalid friend number\n");
 			return 0;
 		}
 		linphonec_friend_call(lc, friend_num);
@@ -516,7 +520,7 @@ lpc_cmd_friend(LinphoneCore *lc, char *args)
 		{
 			friend_num = strtol(args, NULL, 10);
 			if ( errno == ERANGE ) {
-				printf("Invalid friend number\n");
+				linphonec_out("Invalid friend number\n");
 				return 0;
 			}
 		}
@@ -614,23 +618,23 @@ lpc_cmd_proxy(LinphoneCore *lc, char *args)
 		{
 			proxynum=atoi(arg2);
 			if ( linphonec_proxy_use(lc, proxynum) )
-				printf("Default proxy set to %d.\n", proxynum);
+				linphonec_out("Default proxy set to %d.\n", proxynum);
 		}
 		else
 		{
 			proxynum=linphone_core_get_default_proxy(lc, NULL);
-			if ( proxynum == -1 ) printf("No default proxy.\n");
-			else printf("Current default proxy is %d.\n", proxynum);
+			if ( proxynum == -1 ) linphonec_out("No default proxy.\n");
+			else linphonec_out("Current default proxy is %d.\n", proxynum);
 		}
 	}
 	else if (strcmp(arg1, "unuse")==0)
 	{
 		linphone_core_set_default_proxy(lc, NULL);
-		printf("Use no proxy.\n");
+		linphonec_out("Use no proxy.\n");
 	}
 	else
 	{
-		printf("Syntax error - see 'help proxy'\n");
+		linphonec_out("Syntax error - see 'help proxy'\n");
 	}
 
 	return 1;
@@ -644,7 +648,7 @@ lpc_cmd_call_logs(LinphoneCore *lc, char *args)
 	{
 		LinphoneCallLog *cl=(LinphoneCallLog*)elem->data;
 		char *str=linphone_call_log_to_str(cl);
-		printf("%s\n",str);
+		linphonec_out("%s\n",str);
 		ms_free(str);
 	}
 	return 1;
@@ -655,27 +659,27 @@ lpc_cmd_ipv6(LinphoneCore *lc, char *arg1)
 {
 	if ( ! arg1 )
 	{
-		printf("Syntax error - see 'help ipv6'\n");
+		linphonec_out("Syntax error - see 'help ipv6'\n");
 		return 1;
 	}
 
 	if (strcmp(arg1,"status")==0)
 	{
-		printf("ipv6 use enabled: %s\n",linphone_core_ipv6_enabled(lc) ? "true":"false");
+		linphonec_out("ipv6 use enabled: %s\n",linphone_core_ipv6_enabled(lc) ? "true":"false");
 	}
 	else if (strcmp(arg1,"enable")==0)
 	{
 		linphone_core_enable_ipv6(lc,TRUE);
-		printf("ipv6 use enabled.\n");
+		linphonec_out("ipv6 use enabled.\n");
 	}
 	else if (strcmp(arg1,"disable")==0)
 	{
 		linphone_core_enable_ipv6(lc,FALSE);
-		printf("ipv6 use disabled.\n");
+		linphonec_out("ipv6 use disabled.\n");
 	}
 	else
 	{
-		printf("Syntax error - see 'help ipv6'\n");
+		linphonec_out("Syntax error - see 'help ipv6'\n");
 	}
 	return 1;
 }
@@ -683,13 +687,13 @@ lpc_cmd_ipv6(LinphoneCore *lc, char *arg1)
 static int lpc_cmd_soundcard(LinphoneCore *lc, char *cmd){
 	int i;
 	if (cmd==NULL){
-		printf("Syntax error - see 'help soundcard'\n");
+		linphonec_out("Syntax error - see 'help soundcard'\n");
 		return 1;
 	}
 	if (strcmp(cmd,"list")==0){
 		const char **dev=linphone_core_get_sound_devices(lc);
 		for(i=0;dev[i]!=NULL;i++){
-			printf("%i: %s\n",i,dev[i]);
+			linphonec_out("%i: %s\n",i,dev[i]);
 		}
 		return 1;
 	}else{
@@ -699,7 +703,7 @@ static int lpc_cmd_soundcard(LinphoneCore *lc, char *cmd){
 		int n=sscanf(cmd,"%s %s",tmp,card);
 		if (n==2 && strcmp(tmp,"use")==0){
 			if (strcmp(card,"files")==0) {
-				printf("Using wav files instead of soundcard.\n");
+				linphonec_out("Using wav files instead of soundcard.\n");
 				linphone_core_use_files(lc,TRUE);
 				return 1;
 			}else{
@@ -710,15 +714,15 @@ static int lpc_cmd_soundcard(LinphoneCore *lc, char *cmd){
 						linphone_core_set_ringer_device(lc,dev[i]);
 						linphone_core_set_playback_device(lc,dev[i]);
 						linphone_core_set_capture_device(lc,dev[i]);
-						printf("Using sound device %s\n",dev[i]);
+						linphonec_out("Using sound device %s\n",dev[i]);
 						return 1;
 					}
 				}
-				printf("no such sound device\n");
+				linphonec_out("no such sound device\n");
 				return 1;
 			}
 		}
-		printf("Syntax error - see 'help soundcard'\n");
+		linphonec_out("Syntax error - see 'help soundcard'\n");
 	}
 	return 1;
 }
@@ -736,7 +740,7 @@ linphonec_proxy_add(LinphoneCore *lc)
 	bool_t enable_register=FALSE;
 	LinphoneProxyConfig *cfg;
 
-	printf("Adding new proxy setup. Hit ^D to abort.\n");
+	linphonec_out("Adding new proxy setup. Hit ^D to abort.\n");
 
 	/*
 	 * SIP Proxy address
@@ -747,7 +751,7 @@ linphonec_proxy_add(LinphoneCore *lc)
 		char *clean;
 
 		if ( ! input ) {
-			printf("Aborted.\n");
+			linphonec_out("Aborted.\n");
 			return;
 		}
 
@@ -761,7 +765,7 @@ linphonec_proxy_add(LinphoneCore *lc)
 		cfg=linphone_proxy_config_new();
 		if (linphone_proxy_config_set_server_addr(cfg,clean)<0)
 		{
-			printf("Invalid sip address (sip:sip.domain.tld).\n");
+			linphonec_out("Invalid sip address (sip:sip.domain.tld).\n");
 			free(input);
 			linphone_proxy_config_destroy(cfg);
 			continue;
@@ -779,7 +783,7 @@ linphonec_proxy_add(LinphoneCore *lc)
 		char *clean;
 
 		if ( ! input ) {
-			printf("Aborted.\n");
+			linphonec_out("Aborted.\n");
 			linphone_proxy_config_destroy(cfg);
 			return;
 		}
@@ -794,7 +798,7 @@ linphonec_proxy_add(LinphoneCore *lc)
 		linphone_proxy_config_set_identity(cfg, clean);
 		if ( ! cfg->reg_identity )
 		{
-			printf("Invalid identity (sip:name@sip.domain.tld).\n");
+			linphonec_out("Invalid identity (sip:name@sip.domain.tld).\n");
 			free(input);
 			continue;
 		}
@@ -811,7 +815,7 @@ linphonec_proxy_add(LinphoneCore *lc)
 		char *clean;
 
 		if ( ! input ) {
-			printf("Aborted.\n");
+			linphonec_out("Aborted.\n");
 			linphone_proxy_config_destroy(cfg);
 			return;
 		}
@@ -826,7 +830,7 @@ linphonec_proxy_add(LinphoneCore *lc)
 		if ( ! strcmp(clean, "yes") ) enable_register=TRUE;
 		else if ( ! strcmp(clean, "no") ) enable_register=FALSE;
 		else {
-			printf("Please answer with 'yes' or 'no'\n");
+			linphonec_out("Please answer with 'yes' or 'no'\n");
 			free(input);
 			continue;
 		}
@@ -847,7 +851,7 @@ linphonec_proxy_add(LinphoneCore *lc)
 				" in seconds (default is 600): ");
 
 			if ( ! input ) {
-				printf("Aborted.\n");
+				linphonec_out("Aborted.\n");
 				linphone_proxy_config_destroy(cfg);
 				return;
 			}
@@ -855,13 +859,13 @@ linphonec_proxy_add(LinphoneCore *lc)
 			expires=strtol(input, (char **)NULL, 10);
 			if ( expires == LONG_MIN || expires == LONG_MAX )
 			{
-				printf("Invalid value: %s\n", strerror(errno));
+				linphonec_out("Invalid value: %s\n", strerror(errno));
 				free(input);
 				continue;
 			}
 
 			linphone_proxy_config_expires(cfg, expires);
-			printf("Expiration: %d seconds\n", cfg->expires);
+			linphonec_out("Expiration: %d seconds\n", cfg->expires);
 
 			free(input);
 			break;
@@ -877,7 +881,7 @@ linphonec_proxy_add(LinphoneCore *lc)
 		char *clean;
 
 		if ( ! input ) {
-			printf("Aborted.\n");
+			linphonec_out("Aborted.\n");
 			linphone_proxy_config_destroy(cfg);
 			return;
 		}
@@ -886,14 +890,14 @@ linphonec_proxy_add(LinphoneCore *lc)
 		clean=lpc_strip_blanks(input);
 		if ( ! *clean ) {
 			free(input);
-			printf("No route specified.\n");
+			linphonec_out("No route specified.\n");
 			break;
 		}
 
 		linphone_proxy_config_set_route(cfg, clean);
 		if ( ! cfg->reg_route )
 		{
-			printf("Invalid route.\n");
+			linphonec_out("Invalid route.\n");
 			free(input);
 			continue;
 		}
@@ -910,14 +914,14 @@ linphonec_proxy_add(LinphoneCore *lc)
 		char *input;
 		char *clean;
 
-		printf("--------------------------------------------\n");
+		linphonec_out("--------------------------------------------\n");
 		linphonec_proxy_display(cfg);
-		printf("--------------------------------------------\n");
+		linphonec_out("--------------------------------------------\n");
 		input=linphonec_readline("Accept the above proxy configuration (yes/no) ?: ");
 
 
 		if ( ! input ) {
-			printf("Aborted.\n");
+			linphonec_out("Aborted.\n");
 			linphone_proxy_config_destroy(cfg);
 			return;
 		}
@@ -932,13 +936,13 @@ linphonec_proxy_add(LinphoneCore *lc)
 		if ( ! strcmp(clean, "yes") ) break;
 		else if ( ! strcmp(clean, "no") )
 		{
-			printf("Declined.\n");
+			linphonec_out("Declined.\n");
 			linphone_proxy_config_destroy(cfg);
 			free(input);
 			return;
 		}
 
-		printf("Please answer with 'yes' or 'no'\n");
+		linphonec_out("Please answer with 'yes' or 'no'\n");
 		free(input);
 		continue;
 	}
@@ -949,13 +953,13 @@ linphonec_proxy_add(LinphoneCore *lc)
 	/* automatically set the last entered proxy as the default one */
 	linphone_core_set_default_proxy(lc,cfg);
 
-	printf("Proxy added.\n");
+	linphonec_out("Proxy added.\n");
 }
 
 static void
 linphonec_proxy_display(LinphoneProxyConfig *cfg)
 {
-	printf("sip address: %s\nroute: %s\nidentity: %s\nregister: %s\nexpires: %i\n",
+	linphonec_out("sip address: %s\nroute: %s\nidentity: %s\nregister: %s\nexpires: %i\n",
 			cfg->reg_proxy,
 			(cfg->reg_route!=NULL)?cfg->reg_route:"",
 			(cfg->reg_identity!=NULL)?cfg->reg_identity:"",
@@ -973,9 +977,9 @@ linphonec_proxy_list(LinphoneCore *lc)
 	proxies=linphone_core_get_proxy_config_list(lc);
 	for(n=0;proxies!=NULL;proxies=ms_list_next(proxies),n++){
 		if (n==def)
-			printf("****** Proxy %i - this is the default one - *******\n",n);
+			linphonec_out("****** Proxy %i - this is the default one - *******\n",n);
 		else 
-			printf("****** Proxy %i *******\n",n);
+			linphonec_out("****** Proxy %i *******\n",n);
 		linphonec_proxy_display((LinphoneProxyConfig*)proxies->data);
 	}
 }
@@ -988,11 +992,11 @@ linphonec_proxy_remove(LinphoneCore *lc, int index)
 	proxies=linphone_core_get_proxy_config_list(lc);
 	cfg=(LinphoneProxyConfig*)ms_list_nth_data(proxies,index);
 	if (cfg==NULL){
-		printf("No such proxy.\n");
+		linphonec_out("No such proxy.\n");
 		return;
 	}
 	linphone_core_remove_proxy_config(lc,cfg);
-	printf("Proxy %s removed.\n", cfg->reg_proxy);
+	linphonec_out("Proxy %s removed.\n", cfg->reg_proxy);
 	linphone_proxy_config_destroy(cfg);
 }
 
@@ -1004,7 +1008,7 @@ linphonec_proxy_use(LinphoneCore *lc, int index)
 	proxies=linphone_core_get_proxy_config_list(lc);
 	cfg=(LinphoneProxyConfig*)ms_list_nth_data(proxies,index);
 	if (cfg==NULL){
-		printf("No such proxy (try 'proxy list').");
+		linphonec_out("No such proxy (try 'proxy list').");
 		return 0;
 	}
 	linphone_core_set_default_proxy(lc,cfg);
@@ -1018,8 +1022,8 @@ linphonec_friend_display(LinphoneFriend *fr)
 	char *addr = linphone_friend_get_addr(fr);
 	//char *url = linphone_friend_get_url(fr);
 
-	printf("name: %s\n", name);
-	printf("address: %s\n", addr);
+	linphonec_out("name: %s\n", name);
+	linphonec_out("address: %s\n", addr);
 }
 
 static int
@@ -1040,7 +1044,7 @@ linphonec_friend_list(LinphoneCore *lc, char *pat)
 			char *name = linphone_friend_get_name(friend->data);
 			if ( ! strstr(name, pat) ) continue;
 		}
-		printf("****** Friend %i *******\n",n);
+		linphonec_out("****** Friend %i *******\n",n);
 		linphonec_friend_display((LinphoneFriend*)friend->data);
 	}
 
@@ -1062,7 +1066,7 @@ linphonec_friend_call(LinphoneCore *lc, unsigned int num)
 			return lpc_cmd_call(lc, addr);
 		}
 	}
-	printf("No such friend %u\n", num);
+	linphonec_out("No such friend %u\n", num);
 	return 1;
 }
 
@@ -1102,15 +1106,15 @@ linphonec_friend_delete(LinphoneCore *lc, int num)
 		return 0;
 	}
 
-	printf("No such friend %u\n", num);
+	linphonec_out("No such friend %u\n", num);
 	return 1;
 }
 
 static void
 linphonec_display_command_help(LPC_COMMAND *cmd)
 {
-	if ( cmd->doc ) printf ("%s\n", cmd->doc);
-	else printf("%s\n", cmd->help);
+	if ( cmd->doc ) linphonec_out ("%s\n", cmd->doc);
+	else linphonec_out("%s\n", cmd->help);
 }
 
 /***************************************************************************
diff --git a/linphone/console/linphonec.c b/linphone/console/linphonec.c
index a3987d4dab..258bc1eb89 100644
--- a/linphone/console/linphonec.c
+++ b/linphone/console/linphonec.c
@@ -6,21 +6,21 @@
  *  Copyright (C) 2002  Florian Winterstein <flox@gmx.net>
  *  Copyright (C) 2000  Simon MORLAT <simon.morlat@free.fr>
  *
- ****************************************************************************
+****************************************************************************
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Library General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
  ****************************************************************************/
 
@@ -32,6 +32,7 @@
 #include <signal.h>
 #include <limits.h>
 #include <ctype.h>
+
 #include <linphonecore.h>
 #include "linphonec.h"
 
@@ -39,6 +40,16 @@
 #include "config.h"
 #endif
 
+#ifdef WIN32
+#include <ws2tcpip.h>
+#include <ctype.h>
+#include <conio.h>
+#else
+#include <sys/socket.h>
+#include <netdb.h>
+#endif
+
+
 #ifdef HAVE_GETTEXT
 #include <libintl.h>
 #ifndef _
@@ -48,6 +59,8 @@
 #define _(something)	(something)
 #endif
 
+#define DEFAULT_TCP_PORT 32333
+
 /***************************************************************************
  *
  *  Types
@@ -117,11 +130,13 @@ static bool_t vcap_enabled=FALSE;
 static bool_t display_enabled=FALSE;
 static bool_t preview_enabled=FALSE;
 static bool_t show_general_state=FALSE;
+static int tcp_port=0; /* see --tcp: tcp port to listen for commands */
 LPC_AUTH_STACK auth_stack;
 static int trace_level = 0;
 static char *logfile_name = NULL;
 static char configfile_name[PATH_MAX];
 static char *sipAddr = NULL; /* for autocall */
+static ortp_socket_t client_sock=-1;
 char prompt[PROMPT_MAX_LEN];
 
 LinphoneCoreVTable linphonec_vtable = {
@@ -350,6 +365,76 @@ static void start_prompt_reader(void){
 	ortp_thread_create(&th,NULL,prompt_reader_thread,NULL);
 }
 
+static ortp_socket_t create_server_socket(int port){
+	ortp_socket_t server_sock;
+	char service[12];
+	/*setup the server socket */
+	struct addrinfo *ai=NULL;
+	struct addrinfo hints;
+	memset(&hints,0,sizeof(hints));
+	hints.ai_family=AF_INET;
+	snprintf(service,sizeof(service),"%i",port);
+
+	getaddrinfo("127.0.0.1",service,&hints,&ai);
+	if (ai==NULL){
+		fprintf(stderr,"getaddrinfo failed on port %s",service);
+		exit(-1);
+	}
+	server_sock=socket(PF_INET,SOCK_STREAM,IPPROTO_TCP);
+	if (bind(server_sock,ai->ai_addr,ai->ai_addrlen)!=0){
+		fprintf(stderr,"Failed to bind command socket.");
+		exit(-1);
+	}
+	listen(server_sock,1);
+	return server_sock;
+}
+
+static void *tcp_thread(void*p){
+	char tmp[250];
+	ortp_socket_t server_sock;
+	struct sockaddr_storage ss;
+	socklen_t ssize;
+	bool_t run=TRUE;
+	
+	server_sock=create_server_socket(tcp_port);
+	if (server_sock==-1) return NULL;
+	while(run){
+		while(client_sock!=-1){ /*sleep until the last command is finished*/
+#ifndef WIN32
+			usleep(20000);
+#else
+			Sleep(20);
+#endif
+		}
+		ssize=sizeof(ss);
+		if ((client_sock=accept(server_sock,(struct sockaddr*)&ss,&ssize))!=-1){
+			int len;
+			/*now read from the client */
+			if ((len=recv(client_sock,tmp,sizeof(tmp)-1,0))>0){
+				ortp_mutex_lock(&prompt_mutex);
+				tmp[len]='\0';
+				strcpy(received_prompt,tmp);
+				if (strcmp(received_prompt,"quit")==0) run=FALSE;
+				printf("Receiving command '%s'\n",received_prompt);fflush(stdout);
+				have_prompt=TRUE;
+				ortp_mutex_unlock(&prompt_mutex);
+			}else{
+				printf("read nothing\n");fflush(stdout);
+				close_socket(client_sock);
+				client_sock=-1;
+			}
+			
+		}
+	}
+	return NULL;
+}
+
+static void start_tcp_reader(void){
+	ortp_thread_t th;
+	ms_mutex_init(&prompt_mutex,NULL);
+	ortp_thread_create(&th,NULL,tcp_thread,NULL);
+}
+
 #endif
 
 char *linphonec_readline(char *prompt){
@@ -357,10 +442,15 @@ char *linphonec_readline(char *prompt){
 	return readline(prompt);
 #else
 	static bool_t prompt_reader_started=FALSE;
+	static bool_t tcp_reader_started=FALSE;
 	if (!prompt_reader_started){
 		start_prompt_reader();
 		prompt_reader_started=TRUE;
 	}
+	if (tcp_port>0 && !tcp_reader_started){
+		start_tcp_reader();
+		tcp_reader_started=TRUE;
+	}
 	fprintf(stdout,"%s",prompt);
 	fflush(stdout);
 	while(1){
@@ -382,6 +472,30 @@ char *linphonec_readline(char *prompt){
 #endif
 }
 
+void linphonec_out(const char *fmt,...){
+	char *res;
+	va_list args;
+	va_start (args, fmt);
+	res=ortp_strdup_vprintf(fmt,args);
+	va_end (args);
+	printf("%s",res);fflush(stdout);
+	if (client_sock!=-1){
+		if (write(client_sock,res,strlen(res))==-1){
+			fprintf(stderr,"Fail to send output via socket: %s",getSocketError());
+		}
+	}
+	ortp_free(res);
+}
+
+void linphonec_command_finished(void){
+	if (client_sock!=-1){
+		close_socket(client_sock);
+		client_sock=-1;
+	}
+}
+
+
+
 /***************************************************************************/
 /*
  * Main
@@ -785,6 +899,7 @@ linphonec_main_loop (LinphoneCore * opm, char * sipAddr)
 #endif
 
 		linphonec_parse_command_line(&linphonec, iptr);
+		linphonec_command_finished();
 		free(input);
 	}
 
@@ -873,6 +988,14 @@ linphonec_parse_cmdline(int argc, char **argv)
 		{
 			show_general_state = TRUE;
 		}
+		else if (strncmp ("--tcp", argv[arg_num], 5) == 0)
+		{
+			if (arg_num+1 < argc){
+				tcp_port = atoi(argv[arg_num+1]);
+				if (tcp_port!=0) arg_num++;
+			}
+			if (tcp_port==0) tcp_port=DEFAULT_TCP_PORT;
+		}
 		else if (old_arg_num == arg_num)
 		{
 			fprintf (stderr, "ERROR: bad arguments\n");
diff --git a/linphone/gtk-glade/main.c b/linphone/gtk-glade/main.c
index 0a1a11a484..37f65bd71c 100644
--- a/linphone/gtk-glade/main.c
+++ b/linphone/gtk-glade/main.c
@@ -168,12 +168,23 @@ static void parse_hiddens(const char *hiddens, const char *window_name, GtkWidge
 }
 
 static void linphone_gtk_configure_window(GtkWidget *w, const char *window_name){
-	const char *hiddens;
+	static const char *icon_path=0;
+	static const char *hiddens=0;
+	static bool_t config_loaded=FALSE;
 	if (linphone_gtk_get_core()==NULL) return;
-	hiddens=linphone_gtk_get_ui_config("hidden_widgets",NULL);
+	if (config_loaded==FALSE){
+		hiddens=linphone_gtk_get_ui_config("hidden_widgets",NULL);
+		icon_path=linphone_gtk_get_ui_config("icon",NULL);
+		config_loaded=TRUE;
+	}
 	if (hiddens){
 		parse_hiddens(hiddens,window_name,w);
 	}
+	if (icon_path) {
+		GdkPixbuf *pbuf=create_pixbuf(icon_path);
+		gtk_window_set_icon(GTK_WINDOW(w),pbuf);
+		g_object_unref(G_OBJECT(pbuf));
+	}
 }
 
 #ifdef USE_LIBGLADE
@@ -776,25 +787,18 @@ static void linphone_gtk_configure_main_window(){
 	static gboolean config_loaded=FALSE;
 	static const char *title;
 	static const char *home;
-	static const char *icon_path;
 	static const char *start_call_icon;
 	static const char *stop_call_icon;
 	GtkWidget *w=linphone_gtk_get_main_window();
 	if (!config_loaded){
 		title=linphone_gtk_get_ui_config("title",NULL);
 		home=linphone_gtk_get_ui_config("home","http://www.linphone.org");
-		icon_path=linphone_gtk_get_ui_config("icon",NULL);
 		start_call_icon=linphone_gtk_get_ui_config("start_call_icon",NULL);
 		stop_call_icon=linphone_gtk_get_ui_config("stop_call_icon",NULL);
 		config_loaded=TRUE;
 	}
 	linphone_gtk_configure_window(w,"main_window");
 	if (title) gtk_window_set_title(GTK_WINDOW(w),title);
-	if (icon_path) {
-		GdkPixbuf *pbuf=create_pixbuf(icon_path);
-		gtk_window_set_icon(GTK_WINDOW(w),pbuf);
-		g_object_unref(G_OBJECT(pbuf));
-	}
 	if (start_call_icon){
 		GdkPixbuf *pbuf=create_pixbuf(start_call_icon);
 		gtk_image_set_from_pixbuf(GTK_IMAGE(linphone_gtk_get_widget(w,"start_call_icon")),pbuf);
diff --git a/linphone/mediastreamer2/NEWS b/linphone/mediastreamer2/NEWS
index 6ca9cd90cd..70c027945a 100644
--- a/linphone/mediastreamer2/NEWS
+++ b/linphone/mediastreamer2/NEWS
@@ -1,3 +1,12 @@
+mediastreamer-2.2.3: 21, January 2009
+	* rfc3984 support improved 
+	* webcam support on windows largely improved (vfw mode)
+	* support for configuring video size up to svga
+	* video output can automatically resize to the size of received video stream
+	* fix crash when resizing video window
+	* new MSWebcam object to provide Webcam management and MSFilter instantiation
+	* alsa bugfixes
+
 mediastreamer-2.2.2: 6, october 2008
 	* new winsnd3.c file for support of soundcard under windows (seems to work a bit better)
 	* bugfixes
diff --git a/linphone/mediastreamer2/configure.ac b/linphone/mediastreamer2/configure.ac
index 4050586381..188b985913 100644
--- a/linphone/mediastreamer2/configure.ac
+++ b/linphone/mediastreamer2/configure.ac
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT([mediastreamer],[2.2.2])
+AC_INIT([mediastreamer],[2.2.3])
 
 AC_MSG_NOTICE([$PACKAGE_NAME-$PACKAGE_VERSION		A mediastreaming library for telephony application.])
 AC_MSG_NOTICE([licensed under the terms of the General Public License (GPL)])
@@ -314,7 +314,7 @@ PKG_CHECK_MODULES(SPEEX, speex >= 1.1.12,
 	[ AC_DEFINE(HAVE_SPEEX_NOISE,1,[tells whether the noise arg of speex_echo_cancel can be used]) ],
 	[try_other_speex=yes]
 )
-PKG_CHECK_MODULES(SPEEX, speex >= 1.1.6, build_speex=yes)
+PKG_CHECK_MODULES(SPEEX, speex >= 1.2beta3, build_speex=yes)
 build_resample=false
 PKG_CHECK_MODULES(SPEEXDSP, speexdsp >= 1.2beta3,
     [SPEEX_LIBS="$SPEEX_LIBS $SPEEXDSP_LIBS"
diff --git a/linphone/mediastreamer2/src/pasnd.c b/linphone/mediastreamer2/src/pasnd.c
index c4b411faaa..fcf5f41e73 100644
--- a/linphone/mediastreamer2/src/pasnd.c
+++ b/linphone/mediastreamer2/src/pasnd.c
@@ -58,6 +58,7 @@ int SpeakerCallback(  const void *inputBuffer, void *outputBuffer,
   PASndData *device = (PASndData*)userData;
   uint8_t *wtmpbuff=NULL;
   int err;
+  int ovfl = (device->rate/8000)*320*6;
 
   memset(outputBuffer,0, framesPerBuffer*2);
   if (!device->read_started && !device->write_started)
@@ -73,7 +74,7 @@ int SpeakerCallback(  const void *inputBuffer, void *outputBuffer,
 
   /* remove extra buffer when latency is increasing:
      this often happen with USB device */
-  if (device->bufferizer->size>=320*6){
+  if (device->bufferizer->size>=ovfl){
     ms_warning("Extra data for sound card (total:%i %ims)",
 	       device->bufferizer->size, (device->bufferizer->size*20)/320);
     err=ms_bufferizer_read(device->bufferizer,wtmpbuff, framesPerBuffer*2);
diff --git a/linphone/oRTP/include/ortp/port.h b/linphone/oRTP/include/ortp/port.h
index c50fb2de0f..6b28d33ca2 100644
--- a/linphone/oRTP/include/ortp/port.h
+++ b/linphone/oRTP/include/ortp/port.h
@@ -228,6 +228,7 @@ int set_non_blocking_socket(ortp_socket_t sock);
 
 char *ortp_strndup(const char *str,int n);
 char *ortp_strdup_printf(const char *fmt,...);
+char *ortp_strdup_vprintf(const char *fmt, va_list ap);
 
 #ifdef __cplusplus
 }
diff --git a/linphone/oRTP/src/ortp.c b/linphone/oRTP/src/ortp.c
index 6e5c9f09b5..099c224cf4 100644
--- a/linphone/oRTP/src/ortp.c
+++ b/linphone/oRTP/src/ortp.c
@@ -164,7 +164,7 @@ void ortp_set_log_level_mask(int levelmask){
 	__ortp_log_mask=levelmask;
 }
 
-static char * _strdup_vprintf(const char *fmt, va_list ap)
+char * ortp_strdup_vprintf(const char *fmt, va_list ap)
 {
 	/* Guess we need no more than 100 bytes. */
 	int n, size = 200;
@@ -210,7 +210,7 @@ char *ortp_strdup_printf(const char *fmt,...){
 	char *ret;
 	va_list args;
 	va_start (args, fmt);
-	ret=_strdup_vprintf(fmt, args);
+	ret=ortp_strdup_vprintf(fmt, args);
  	va_end (args);
 	return ret;
 }
@@ -255,10 +255,10 @@ static void __ortp_logv_out(OrtpLogLevel lev, const char *fmt, va_list args){
 		default:
 			ortp_fatal("Bad level !");
 	}
-	msg=_strdup_vprintf(fmt,args);
+	msg=ortp_strdup_vprintf(fmt,args);
 #ifdef _MSC_VER
-  OutputDebugString(msg);
-  OutputDebugString("\r\n");
+ 	OutputDebugString(msg);
+  	OutputDebugString("\r\n");
 #else
 	fprintf(__log_file,"ortp-%s-%s" ENDLINE,lname,msg);
 #endif
-- 
GitLab