Commit 0a8d30ce authored by Simon Morlat's avatar Simon Morlat
Browse files

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

parents 9df45abe ec118640
......@@ -679,25 +679,7 @@ static void linphone_call_get_local_ip(LinphoneCall *call, const LinphoneAddress
return;
}
#endif //BUILD_UPNP
if (af==AF_UNSPEC){
if (linphone_core_ipv6_enabled(call->core)){
bool_t has_ipv6;
has_ipv6=linphone_core_get_local_ip_for(AF_INET6,dest,call->localip)==0;
if (strcmp(call->localip,"::1")!=0)
return; /*this machine has real ipv6 connectivity*/
if (linphone_core_get_local_ip_for(AF_INET,dest,call->localip)==0 && strcmp(call->localip,"127.0.0.1")!=0)
return; /*this machine has only ipv4 connectivity*/
if (has_ipv6){
/*this machine has only local loopback for both ipv4 and ipv6, so prefer ipv6*/
strncpy(call->localip,"::1",LINPHONE_IPADDR_SIZE);
return;
}
}
/*in all other cases use IPv4*/
af=AF_INET;
}
if (linphone_core_get_local_ip_for(af,dest,call->localip)==0)
return;
linphone_core_get_local_ip(call->core, af, dest, call->localip);
}
static void linphone_call_destroy(LinphoneCall *obj);
......@@ -1197,27 +1179,26 @@ const LinphoneErrorInfo *linphone_call_get_error_info(const LinphoneCall *call){
}
/**
* Get the user_pointer in the LinphoneCall
* Get the user pointer associated with the LinphoneCall
*
* @ingroup call_control
*
* return user_pointer an opaque user pointer that can be retrieved at any time
* @return an opaque user pointer that can be retrieved at any time
**/
void *linphone_call_get_user_data(const LinphoneCall *call)
{
return call->user_pointer;
return call->user_data;
}
/**
* Set the user_pointer in the LinphoneCall
* Set the user pointer associated with the LinphoneCall
*
* @ingroup call_control
*
* the user_pointer is an opaque user pointer that can be retrieved at any time in the LinphoneCall
* the user pointer is an opaque user pointer that can be retrieved at any time in the LinphoneCall
**/
void linphone_call_set_user_data(LinphoneCall *call, void *user_pointer)
{
call->user_pointer = user_pointer;
call->user_data = user_pointer;
}
/**
......
......@@ -1536,7 +1536,7 @@ static void update_primary_contact(LinphoneCore *lc){
ms_error("Could not parse identity contact !");
url=linphone_address_new("sip:unknown@unkwownhost");
}
linphone_core_get_local_ip_for(AF_UNSPEC, NULL, tmp);
linphone_core_get_local_ip(lc, AF_UNSPEC, NULL, tmp);
if (strcmp(tmp,"127.0.0.1")==0 || strcmp(tmp,"::1")==0 ){
ms_warning("Local loopback network only !");
lc->sip_conf.loopback_only=TRUE;
......@@ -2132,7 +2132,7 @@ static void monitor_network_state(LinphoneCore *lc, time_t curtime){
/* only do the network up checking every five seconds */
if (lc->network_last_check==0 || (curtime-lc->network_last_check)>=5){
linphone_core_get_local_ip_for(AF_UNSPEC,NULL,newip);
linphone_core_get_local_ip(lc,AF_UNSPEC,NULL,newip);
if (strcmp(newip,"::1")!=0 && strcmp(newip,"127.0.0.1")!=0){
new_status=TRUE;
}else new_status=FALSE; /*no network*/
......
......@@ -1125,6 +1125,26 @@ int linphone_core_get_local_ip_for(int type, const char *dest, char *result){
return 0;
}
void linphone_core_get_local_ip(LinphoneCore *lc, int af, const char *dest, char *result) {
if (af == AF_UNSPEC) {
if (linphone_core_ipv6_enabled(lc)) {
bool_t has_ipv6 = linphone_core_get_local_ip_for(AF_INET6, dest, result) == 0;
if (strcmp(result, "::1") != 0)
return; /*this machine has real ipv6 connectivity*/
if ((linphone_core_get_local_ip_for(AF_INET, dest, result) == 0) && (strcmp(result, "127.0.0.1") != 0))
return; /*this machine has only ipv4 connectivity*/
if (has_ipv6) {
/*this machine has only local loopback for both ipv4 and ipv6, so prefer ipv6*/
strncpy(result, "::1", LINPHONE_IPADDR_SIZE);
return;
}
}
/*in all other cases use IPv4*/
af = AF_INET;
}
linphone_core_get_local_ip_for(af, dest, result);
}
SalReason linphone_reason_to_sal(LinphoneReason reason){
switch(reason){
case LinphoneReasonNone:
......
......@@ -201,7 +201,6 @@ struct _LinphoneCall
LinphoneCallState prevstate;
LinphoneCallState transfer_state; /*idle if no transfer*/
LinphoneProxyConfig *dest_proxy;
void * user_pointer;
PortConfig media_ports[2];
MSMediaStreamSessions sessions[2]; /*the rtp, srtp, zrtp contexts for each stream*/
StunCandidate ac,vc; /*audio video ip/port discovered by STUN*/
......@@ -360,6 +359,7 @@ void linphone_proxy_config_get_contact(LinphoneProxyConfig *cfg, const char **ip
LinphoneProxyConfig * linphone_core_lookup_known_proxy(LinphoneCore *lc, const LinphoneAddress *uri);
const char *linphone_core_find_best_identity(LinphoneCore *lc, const LinphoneAddress *to);
int linphone_core_get_local_ip_for(int type, const char *dest, char *result);
void linphone_core_get_local_ip(LinphoneCore *lc, int af, const char *dest, char *result);
LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LinphoneCore *lc, int index);
void linphone_proxy_config_write_to_config_file(struct _LpConfig* config,LinphoneProxyConfig *obj, int index);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment