Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
3d512a01
Commit
3d512a01
authored
Aug 22, 2014
by
Ghislain MARY
Browse files
Fix update of primary contact.
parent
aa5f676d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
21 deletions
+24
-21
coreapi/linphonecall.c
coreapi/linphonecall.c
+1
-19
coreapi/linphonecore.c
coreapi/linphonecore.c
+2
-2
coreapi/misc.c
coreapi/misc.c
+20
-0
coreapi/private.h
coreapi/private.h
+1
-0
No files found.
coreapi/linphonecall.c
View file @
3d512a01
...
...
@@ -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
);
...
...
coreapi/linphonecore.c
View file @
3d512a01
...
...
@@ -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*/
...
...
coreapi/misc.c
View file @
3d512a01
...
...
@@ -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
:
...
...
coreapi/private.h
View file @
3d512a01
...
...
@@ -360,6 +360,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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment