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
c115a448
Commit
c115a448
authored
Nov 24, 2017
by
Ghislain MARY
Browse files
Fix chat messages routing issues because of gruu addresses.
parent
72c9d283
Changes
9
Hide whitespace changes
Inline
Side-by-side
coreapi/linphonecore.c
View file @
c115a448
...
...
@@ -3368,6 +3368,21 @@ const char * linphone_core_get_identity(LinphoneCore *lc){
return
from
;
}
char
*
linphone_core_get_device_identity
(
LinphoneCore
*
lc
)
{
char
*
identity
=
NULL
;
LinphoneProxyConfig
*
proxy
=
linphone_core_get_default_proxy_config
(
lc
);
if
(
proxy
)
{
const
LinphoneAddress
*
contactAddr
=
linphone_proxy_config_get_contact
(
proxy
);
if
(
contactAddr
)
identity
=
linphone_address_as_string
(
contactAddr
);
else
identity
=
bctbx_strdup
(
linphone_proxy_config_get_identity
(
proxy
));
}
else
{
identity
=
bctbx_strdup
(
linphone_core_get_primary_contact
(
lc
));
}
return
identity
;
}
const
char
*
linphone_core_get_route
(
LinphoneCore
*
lc
){
LinphoneProxyConfig
*
proxy
=
linphone_core_get_default_proxy_config
(
lc
);
const
char
*
route
=
NULL
;
...
...
@@ -3548,11 +3563,9 @@ static void linphone_transfer_routes_to_op(bctbx_list_t *routes, SalOp *op){
void
linphone_configure_op_with_proxy
(
LinphoneCore
*
lc
,
SalOp
*
op
,
const
LinphoneAddress
*
dest
,
SalCustomHeader
*
headers
,
bool_t
with_contact
,
LinphoneProxyConfig
*
proxy
){
bctbx_list_t
*
routes
=
NULL
;
const
LinphoneAddress
*
contactAddr
=
nullptr
;
const
char
*
identity
;
if
(
proxy
){
contactAddr
=
linphone_proxy_config_get_contact
(
proxy
);
identity
=
linphone_proxy_config_get_identity
(
proxy
);
if
(
linphone_proxy_config_get_privacy
(
proxy
)
!=
LinphonePrivacyDefault
)
{
op
->
set_privacy
(
linphone_proxy_config_get_privacy
(
proxy
));
...
...
@@ -3565,12 +3578,7 @@ void linphone_configure_op_with_proxy(LinphoneCore *lc, SalOp *op, const Linphon
}
op
->
set_to_address
(
L_GET_PRIVATE_FROM_C_OBJECT
(
dest
)
->
getInternalAddress
());
if
(
op
->
getUseGruuInFrom
()
&&
contactAddr
&&
linphone_address_has_uri_param
(
contactAddr
,
"gr"
))
{
char
*
contactAddrStr
=
linphone_address_as_string_uri_only
(
contactAddr
);
op
->
set_from
(
contactAddrStr
);
bctbx_free
(
contactAddrStr
);
}
else
op
->
set_from
(
identity
);
op
->
set_from
(
identity
);
op
->
set_sent_custom_header
(
headers
);
op
->
set_realm
(
linphone_proxy_config_get_realm
(
proxy
));
...
...
coreapi/private.h
View file @
c115a448
...
...
@@ -452,7 +452,6 @@ void linphone_call_start_media_streams_for_ice_gathering(LinphoneCall *call);
void
linphone_call_stop_media_streams
(
LinphoneCall
*
call
);
void
linphone_call_delete_upnp_session
(
LinphoneCall
*
call
);
int
_linphone_core_apply_transports
(
LinphoneCore
*
lc
);
const
char
*
linphone_core_get_identity
(
LinphoneCore
*
lc
);
void
linphone_core_start_waiting
(
LinphoneCore
*
lc
,
const
char
*
purpose
);
void
linphone_core_update_progress
(
LinphoneCore
*
lc
,
const
char
*
purpose
,
float
progresses
);
...
...
include/linphone/core.h
View file @
c115a448
...
...
@@ -1403,6 +1403,8 @@ LINPHONE_PUBLIC const char *linphone_core_get_primary_contact(LinphoneCore *lc);
**/
LINPHONE_PUBLIC
const
char
*
linphone_core_get_identity
(
LinphoneCore
*
lc
);
LINPHONE_PUBLIC
char
*
linphone_core_get_device_identity
(
LinphoneCore
*
lc
);
/**
* Tells LinphoneCore to guess local hostname automatically in primary contact.
* @ingroup proxies
...
...
src/c-wrapper/api/c-chat-room.cpp
View file @
c115a448
...
...
@@ -351,8 +351,16 @@ LinphoneChatRoom *_linphone_client_group_chat_room_new (LinphoneCore *core, cons
LinphoneProxyConfig
*
proxy
=
linphone_core_lookup_known_proxy
(
core
,
addr
);
linphone_address_unref
(
addr
);
string
from
;
if
(
proxy
)
from
=
L_GET_CPP_PTR_FROM_C_OBJECT
(
linphone_proxy_config_get_identity_address
(
proxy
))
->
asString
();
if
(
proxy
)
{
const
LinphoneAddress
*
contactAddr
=
linphone_proxy_config_get_contact
(
proxy
);
if
(
contactAddr
)
{
char
*
cFrom
=
linphone_address_as_string
(
contactAddr
);
from
=
string
(
cFrom
);
bctbx_free
(
cFrom
);
}
else
{
from
=
L_GET_CPP_PTR_FROM_C_OBJECT
(
linphone_proxy_config_get_identity_address
(
proxy
))
->
asString
();
}
}
if
(
from
.
empty
())
from
=
linphone_core_get_primary_contact
(
core
);
LinphonePrivate
::
IdentityAddress
me
(
from
);
...
...
src/chat/chat-message/chat-message.cpp
View file @
c115a448
...
...
@@ -478,7 +478,6 @@ void ChatMessagePrivate::send () {
LinphoneAddress
*
peer
=
linphone_address_new
(
q
->
getToAddress
().
asString
().
c_str
());
/* Sending out of call */
salOp
=
op
=
new
SalMessageOp
(
core
->
getCCore
()
->
sal
);
op
->
setUseGruuInFrom
(
true
);
linphone_configure_op
(
core
->
getCCore
(),
op
,
peer
,
getSalCustomHeaders
(),
!!
lp_config_get_int
(
core
->
getCCore
()
->
config
,
"sip"
,
"chat_msg_with_contact"
,
0
)
...
...
@@ -486,6 +485,8 @@ void ChatMessagePrivate::send () {
op
->
set_user_pointer
(
L_GET_C_BACK_PTR
(
q
));
/* If out of call, directly store msg */
linphone_address_unref
(
peer
);
}
op
->
set_from
(
q
->
getFromAddress
().
asString
().
c_str
());
op
->
set_to
(
q
->
getToAddress
().
asString
().
c_str
());
// ---------------------------------------
// Start of message modification
...
...
src/chat/chat-room/client-group-chat-room.cpp
View file @
c115a448
...
...
@@ -64,7 +64,9 @@ shared_ptr<CallSession> ClientGroupChatRoomPrivate::createSession () {
shared_ptr
<
Participant
>
focus
=
qConference
->
getPrivate
()
->
focus
;
shared_ptr
<
CallSession
>
session
=
focus
->
getPrivate
()
->
createSession
(
*
q
,
&
csp
,
false
,
q
);
const
Address
&
myAddress
=
q
->
getMe
()
->
getAddress
();
session
->
configure
(
LinphoneCallOutgoing
,
nullptr
,
nullptr
,
myAddress
,
focus
->
getAddress
());
Address
myCleanedAddress
(
myAddress
);
myCleanedAddress
.
setUriParam
(
"gr"
);
// Remove gr parameter for INVITE
session
->
configure
(
LinphoneCallOutgoing
,
nullptr
,
nullptr
,
myCleanedAddress
,
focus
->
getAddress
());
session
->
initiateOutgoing
();
return
session
;
}
...
...
src/conference/conference.cpp
View file @
c115a448
...
...
@@ -234,8 +234,11 @@ shared_ptr<Participant> Conference::findParticipant (const shared_ptr<const Call
bool
Conference
::
isMe
(
const
IdentityAddress
&
addr
)
const
{
L_D
();
IdentityAddress
simpleAddr
(
addr
);
return
d
->
me
->
getAddress
()
==
simpleAddr
;
IdentityAddress
cleanedAddr
(
addr
);
cleanedAddr
.
setGruu
(
""
);
IdentityAddress
cleanedMeAddr
(
d
->
me
->
getAddress
());
cleanedMeAddr
.
setGruu
(
""
);
return
cleanedMeAddr
==
cleanedAddr
;
}
LINPHONE_END_NAMESPACE
src/conference/handlers/remote-conference-event-handler.cpp
View file @
c115a448
...
...
@@ -184,6 +184,7 @@ void RemoteConferenceEventHandler::subscribe (const ChatRoomId &chatRoomId) {
d
->
chatRoomId
=
chatRoomId
;
LinphoneAddress
*
lAddr
=
linphone_address_new
(
d
->
chatRoomId
.
getPeerAddress
().
asString
().
c_str
());
d
->
lev
=
linphone_core_create_subscribe
(
d
->
conf
->
getCore
()
->
getCCore
(),
lAddr
,
"conference"
,
600
);
d
->
lev
->
op
->
set_from
(
d
->
chatRoomId
.
getLocalAddress
().
asString
().
c_str
());
linphone_event_add_custom_header
(
d
->
lev
,
"Last-Notify-Version"
,
Utils
::
toString
(
d
->
lastNotify
).
c_str
());
linphone_address_unref
(
lAddr
);
linphone_event_set_internal
(
d
->
lev
,
TRUE
);
...
...
src/sal/op.h
View file @
c115a448
...
...
@@ -84,9 +84,6 @@ public:
void
set_sent_custom_header
(
SalCustomHeader
*
ch
);
bool
getUseGruuInFrom
()
{
return
useGruuInFrom
;
}
void
setUseGruuInFrom
(
bool
value
)
{
useGruuInFrom
=
value
;
}
void
enable_cnx_ip_to_0000_if_sendonly
(
bool_t
yesno
)
{
this
->
_cnx_ip_to_0000_if_sendonly_enabled
=
yesno
;}
bool_t
cnx_ip_to_0000_if_sendonly_enabled
()
const
{
return
this
->
_cnx_ip_to_0000_if_sendonly_enabled
;}
...
...
@@ -256,7 +253,6 @@ protected:
bool_t
has_auth_pending
=
FALSE
;
bool_t
supports_session_timers
=
FALSE
;
bool_t
op_released
=
FALSE
;
bool
useGruuInFrom
=
false
;
friend
class
Sal
;
};
...
...
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