Merge branch 'master' of git.linphone.org:linphone

This commit is contained in:
Ghislain MARY 2012-08-31 11:54:25 +02:00
commit ce40f7241e
5 changed files with 57 additions and 19 deletions

View file

@ -938,8 +938,11 @@ void linphone_call_init_audio_stream(LinphoneCall *call){
LinphoneCore *lc=call->core;
SalMediaDescription *md=call->localdesc;
AudioStream *audiostream;
int dscp=lp_config_get_int(lc->config,"rtp","audio_dscp",-1);
call->audiostream=audiostream=audio_stream_new(md->streams[0].rtp_port,md->streams[0].rtcp_port,linphone_core_ipv6_enabled(lc));
if (dscp!=-1)
audio_stream_set_dscp(audiostream,dscp);
if (linphone_core_echo_limiter_enabled(lc)){
const char *type=lp_config_get_string(lc->config,"sound","el_type","mic");
if (strcasecmp(type,"mic")==0)
@ -990,7 +993,11 @@ void linphone_call_init_video_stream(LinphoneCall *call){
if ((lc->video_conf.display || lc->video_conf.capture) && md->streams[1].rtp_port>0){
int video_recv_buf_size=lp_config_get_int(lc->config,"video","recv_buf_size",0);
int dscp=lp_config_get_int(lc->config,"rtp","video_dscp",-1);
call->videostream=video_stream_new(md->streams[1].rtp_port,md->streams[1].rtcp_port,linphone_core_ipv6_enabled(lc));
if (dscp!=-1)
video_stream_set_dscp(call->videostream,dscp);
video_stream_enable_display_filter_auto_rotate(call->videostream, lp_config_get_int(lc->config,"video","display_filter_auto_rotate",0));
if (video_recv_buf_size>0) rtp_session_set_recv_buf_size(call->videostream->session,video_recv_buf_size);

View file

@ -956,6 +956,14 @@ const char *linphone_core_get_payload_type_description(LinphoneCore *lc, Payload
bool_t linphone_core_check_payload_type_usability(LinphoneCore *lc, PayloadType *pt);
/**
* @ingroup proxy
*Create a proxy config with default value from Linphone core.
*@param lc #LinphoneCore object
*@return #LinphoneProxyConfig with defualt value set
*/
LinphoneProxyConfig * linphone_core_create_proxy_config(LinphoneCore *lc);
int linphone_core_add_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *config);
void linphone_core_clear_proxy_config(LinphoneCore *lc);

View file

@ -408,19 +408,29 @@ static int sendStunRequest(int sock, const struct sockaddr *server, socklen_t ad
int parse_hostname_to_addr(const char *server, struct sockaddr_storage *ss, socklen_t *socklen){
struct addrinfo hints,*res=NULL;
int family = PF_INET;
int port_int = 3478;
int ret;
const char *port;
char port[6];
char host[NI_MAXHOST];
char *p;
host[NI_MAXHOST-1]='\0';
strncpy(host,server,sizeof(host)-1);
p=strchr(host,':');
if (p) {
*p='\0';
port=p+1;
}else port="3478";
char *p1, *p2;
if ((sscanf(server, "[%64[^]]]:%d", host, &port_int) == 2) || (sscanf(server, "[%64[^]]]", host) == 1)) {
family = PF_INET6;
} else {
p1 = strchr(server, ':');
p2 = strrchr(server, ':');
if (p1 && p2 && (p1 != p2)) {
family = PF_INET6;
host[NI_MAXHOST-1]='\0';
strncpy(host, server, sizeof(host) - 1);
} else if (sscanf(server, "%[^:]:%d", host, &port_int) != 2) {
host[NI_MAXHOST-1]='\0';
strncpy(host, server, sizeof(host) - 1);
}
}
snprintf(port, sizeof(port), "%d", port_int);
memset(&hints,0,sizeof(hints));
hints.ai_family=PF_INET;
hints.ai_family=family;
hints.ai_socktype=SOCK_DGRAM;
hints.ai_protocol=IPPROTO_UDP;
ret=getaddrinfo(host,port,&hints,&res);

View file

@ -42,10 +42,17 @@ void linphone_proxy_config_write_all_to_config_file(LinphoneCore *lc){
lp_config_set_int(lc->config,"sip","default_proxy",linphone_core_get_default_proxy(lc,NULL));
}
void linphone_proxy_config_init(LinphoneProxyConfig *obj){
#define DEFAULT_INT(config,name,default) \
config?lp_config_get_int(config,"default_values",#name,default):default
#define DEFAULT_STRING(config,name,default) \
config?lp_config_get_string(config,"default_values",#name,default):default
static void linphone_proxy_config_init(LinphoneCore* lc,LinphoneProxyConfig *obj){
memset(obj,0,sizeof(LinphoneProxyConfig));
obj->magic=linphone_proxy_config_magic;
obj->expires=3600;
obj->expires=DEFAULT_INT((lc?lc->config:NULL),reg_expires,3600);
obj->dial_prefix=ms_strdup(DEFAULT_STRING((lc?lc->config:NULL),dial_prefix,'\0'));
obj->dial_escape_plus=DEFAULT_INT((lc?lc->config:NULL),dial_escape_plus,0);
}
/**
@ -54,15 +61,21 @@ void linphone_proxy_config_init(LinphoneProxyConfig *obj){
**/
/**
* Creates an empty proxy config.
* @deprecated, use #linphone_core_create_proxy_config instead
*Creates an empty proxy config.
**/
LinphoneProxyConfig *linphone_proxy_config_new(){
LinphoneProxyConfig *linphone_proxy_config_new() {
return linphone_core_create_proxy_config(NULL);
}
LinphoneProxyConfig * linphone_core_create_proxy_config(LinphoneCore *lc) {
LinphoneProxyConfig *obj=NULL;
obj=ms_new(LinphoneProxyConfig,1);
linphone_proxy_config_init(obj);
linphone_proxy_config_init(lc,obj);
return obj;
}
/**
* Destroys a proxy config.
*
@ -701,13 +714,13 @@ LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LpConfig *config
tmp=lp_config_get_string(config,key,"reg_route",NULL);
if (tmp!=NULL) linphone_proxy_config_set_route(cfg,tmp);
linphone_proxy_config_expires(cfg,lp_config_get_int(config,key,"reg_expires",600));
linphone_proxy_config_expires(cfg,lp_config_get_int(config,key,"reg_expires",DEFAULT_INT(config,reg_expires,600)));
linphone_proxy_config_enableregister(cfg,lp_config_get_int(config,key,"reg_sendregister",0));
linphone_proxy_config_enable_publish(cfg,lp_config_get_int(config,key,"publish",0));
linphone_proxy_config_set_dial_escape_plus(cfg,lp_config_get_int(config,key,"dial_escape_plus",0));
linphone_proxy_config_set_dial_prefix(cfg,lp_config_get_string(config,key,"dial_prefix",NULL));
linphone_proxy_config_set_dial_escape_plus(cfg,lp_config_get_int(config,key,"dial_escape_plus",DEFAULT_INT(config,dial_escape_plus,0)));
linphone_proxy_config_set_dial_prefix(cfg,lp_config_get_string(config,key,"dial_prefix",DEFAULT_STRING(config,dial_prefix,NULL)));
tmp=lp_config_get_string(config,key,"type",NULL);
if (tmp!=NULL && strlen(tmp)>0)

@ -1 +1 @@
Subproject commit 1a267bd2fb946b51b877a8cbc78f3445c11ab361
Subproject commit beb4318d1e5eb282adc82967a9c80e89cd406045