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
6a395649
Commit
6a395649
authored
Sep 26, 2017
by
Ronan
Browse files
fix(core): coding style
parent
fc75fdef
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
143 additions
and
111 deletions
+143
-111
coreapi/chat.c
coreapi/chat.c
+5
-3
daemon/commands/call-transfer.cc
daemon/commands/call-transfer.cc
+3
-3
daemon/commands/conference.cc
daemon/commands/conference.cc
+2
-2
daemon/commands/register-info.cc
daemon/commands/register-info.cc
+17
-15
daemon/commands/video.cc
daemon/commands/video.cc
+2
-2
daemon/daemon.cc
daemon/daemon.cc
+11
-11
src/c-wrapper/api/c-call.cpp
src/c-wrapper/api/c-call.cpp
+4
-4
src/c-wrapper/api/c-chat-message.cpp
src/c-wrapper/api/c-chat-message.cpp
+2
-2
src/c-wrapper/api/c-chat-room.cpp
src/c-wrapper/api/c-chat-room.cpp
+3
-3
src/call/call-listener.h
src/call/call-listener.h
+1
-1
src/call/call-p.h
src/call/call-p.h
+23
-9
src/call/call.cpp
src/call/call.cpp
+56
-42
src/call/call.h
src/call/call.h
+1
-1
src/chat/chat-message.cpp
src/chat/chat-message.cpp
+4
-4
src/chat/client-group-chat-room.cpp
src/chat/client-group-chat-room.cpp
+1
-1
src/chat/is-composing.cpp
src/chat/is-composing.cpp
+2
-2
src/conference/conference.cpp
src/conference/conference.cpp
+1
-1
src/conference/conference.h
src/conference/conference.h
+3
-3
src/conference/participant-p.h
src/conference/participant-p.h
+1
-1
src/conference/remote-conference.h
src/conference/remote-conference.h
+1
-1
No files found.
coreapi/chat.c
View file @
6a395649
...
...
@@ -42,6 +42,8 @@
#include "chat/real-time-text-chat-room-p.h"
#include "content/content-type.h"
using
namespace
std
;
void
linphone_core_disable_chat
(
LinphoneCore
*
lc
,
LinphoneReason
deny_reason
)
{
lc
->
chat_deny_code
=
deny_reason
;
}
...
...
@@ -236,9 +238,9 @@ int linphone_core_message_received(LinphoneCore *lc, SalOp *op, const SalMessage
void
linphone_core_real_time_text_received
(
LinphoneCore
*
lc
,
LinphoneChatRoom
*
cr
,
uint32_t
character
,
LinphoneCall
*
call
)
{
if
(
linphone_core_realtime_text_enabled
(
lc
))
{
std
::
shared_ptr
<
LinphonePrivate
::
RealTimeTextChatRoom
>
rttcr
=
std
::
static_pointer_cast
<
LinphonePrivate
::
RealTimeTextChatRoom
>
(
L_GET_CPP_PTR_FROM_C_OBJECT
(
cr
));
shared_ptr
<
LinphonePrivate
::
RealTimeTextChatRoom
>
rttcr
=
static_pointer_cast
<
LinphonePrivate
::
RealTimeTextChatRoom
>
(
L_GET_CPP_PTR_FROM_C_OBJECT
(
cr
));
L_GET_PRIVATE
(
rttcr
)
->
realtimeTextReceived
(
character
,
call
);
//L_GET_PRIVATE(
std::
static_pointer_cast<LinphonePrivate::RealTimeTextChatRoom>(L_GET_CPP_PTR_FROM_C_OBJECT(cr)))->realtimeTextReceived(character, call);
//L_GET_PRIVATE(static_pointer_cast<LinphonePrivate::RealTimeTextChatRoom>(L_GET_CPP_PTR_FROM_C_OBJECT(cr)))->realtimeTextReceived(character, call);
}
}
daemon/commands/call-transfer.cc
View file @
6a395649
/*
call-transfer.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
...
...
@@ -85,7 +85,7 @@ void CallTransferCommand::exec(Daemon* app, const string& args)
return
;
}
if
(
linphone_call_transfer_to_another
(
call_to_transfer
,
call_to_transfer_to
)
==
0
)
{
std
::
ostringstream
ostr
;
ostringstream
ostr
;
ostr
<<
"Call ID: "
<<
call_to_transfer_id
<<
"
\n
"
;
ostr
<<
"Transfer to: "
<<
call_to_transfer_to_id
<<
"
\n
"
;
app
->
sendResponse
(
Response
(
ostr
.
str
(),
Response
::
Ok
));
...
...
@@ -93,7 +93,7 @@ void CallTransferCommand::exec(Daemon* app, const string& args)
}
}
else
{
if
(
linphone_call_transfer
(
call_to_transfer
,
sip_uri_to_transfer_to
.
c_str
())
==
0
)
{
std
::
ostringstream
ostr
;
ostringstream
ostr
;
ostr
<<
"Call ID: "
<<
call_to_transfer_id
<<
"
\n
"
;
ostr
<<
"Transfer to: "
<<
sip_uri_to_transfer_to
<<
"
\n
"
;
app
->
sendResponse
(
Response
(
ostr
.
str
(),
Response
::
Ok
));
...
...
daemon/commands/conference.cc
View file @
6a395649
/*
conference.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
...
...
@@ -79,7 +79,7 @@ void ConferenceCommand::exec(Daemon* app, const string& args) {
}
if
(
ret
==
0
)
{
std
::
ostringstream
ostr
;
ostringstream
ostr
;
ostr
<<
"Call ID: "
<<
id
<<
"
\n
"
;
ostr
<<
"Conference: "
<<
subcommand
<<
" OK"
<<
"
\n
"
;
app
->
sendResponse
(
Response
(
ostr
.
str
(),
Response
::
Ok
));
...
...
daemon/commands/register-info.cc
View file @
6a395649
/*
register-info.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
...
...
@@ -21,6 +21,8 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include <string>
#include "register-info.h"
using
namespace
std
;
class
RegisterInfoResponse
:
public
Response
{
public:
RegisterInfoResponse
()
:
Response
()
{}
...
...
@@ -28,19 +30,19 @@ public:
append
(
id
,
cfg
);
}
void
append
(
int
id
,
const
::
LinphoneProxyConfig
*
cfg
)
{
std
::
ostringstream
ost
;
ostringstream
ost
;
ost
<<
getBody
();
if
(
ost
.
tellp
()
>
0
)
ost
<<
std
::
endl
;
ost
<<
"Id: "
<<
id
<<
std
::
endl
;
ost
<<
"Identity: "
<<
linphone_proxy_config_get_identity
(
cfg
)
<<
std
::
endl
;
ost
<<
"Proxy: "
<<
linphone_proxy_config_get_server_addr
(
cfg
)
<<
std
::
endl
;
if
(
ost
.
tellp
()
>
0
)
ost
<<
endl
;
ost
<<
"Id: "
<<
id
<<
endl
;
ost
<<
"Identity: "
<<
linphone_proxy_config_get_identity
(
cfg
)
<<
endl
;
ost
<<
"Proxy: "
<<
linphone_proxy_config_get_server_addr
(
cfg
)
<<
endl
;
const
char
*
route
=
linphone_proxy_config_get_route
(
cfg
);
if
(
route
!=
NULL
)
{
ost
<<
"Route: "
<<
route
<<
std
::
endl
;
ost
<<
"Route: "
<<
route
<<
endl
;
}
ost
<<
"State: "
<<
linphone_registration_state_to_string
(
linphone_proxy_config_get_state
(
cfg
))
<<
std
::
endl
;
ost
<<
"State: "
<<
linphone_registration_state_to_string
(
linphone_proxy_config_get_state
(
cfg
))
<<
endl
;
setBody
(
ost
.
str
());
}
};
...
...
@@ -72,9 +74,9 @@ RegisterInfoCommand::RegisterInfoCommand():
"Reason: No register with such id."
));
}
void
RegisterInfoCommand
::
exec
(
Daemon
*
app
,
const
std
::
string
&
args
)
{
std
::
string
param
;
std
::
istringstream
ist
(
args
);
void
RegisterInfoCommand
::
exec
(
Daemon
*
app
,
const
string
&
args
)
{
string
param
;
istringstream
ist
(
args
);
ist
>>
param
;
if
(
ist
.
fail
())
{
app
->
sendResponse
(
Response
(
"Missing parameter."
,
Response
::
Error
));
...
...
@@ -93,10 +95,10 @@ void RegisterInfoCommand::exec(Daemon *app, const std::string& args) {
int
id
;
try
{
id
=
atoi
(
param
.
c_str
());
}
catch
(
std
::
invalid_argument
)
{
}
catch
(
invalid_argument
)
{
app
->
sendResponse
(
Response
(
"Invalid ID."
,
Response
::
Error
));
return
;
}
catch
(
std
::
out_of_range
)
{
}
catch
(
out_of_range
)
{
app
->
sendResponse
(
Response
(
"Out of range ID."
,
Response
::
Error
));
return
;
}
...
...
daemon/commands/video.cc
View file @
6a395649
/*
video.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
...
...
@@ -162,7 +162,7 @@ AutoVideo::AutoVideo():
"Auto video OFF"
));
}
void
AutoVideo
::
exec
(
Daemon
*
app
,
const
std
::
string
&
args
)
void
AutoVideo
::
exec
(
Daemon
*
app
,
const
string
&
args
)
{
bool
enable
=
(
args
.
compare
(
"on"
)
==
0
);
...
...
daemon/daemon.cc
View file @
6a395649
/*
daemon.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France
Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
...
...
@@ -331,11 +331,11 @@ Daemon::Daemon(const char *config_path, const char *factory_config_path, const c
linphone_core_set_user_data
(
mLc
,
this
);
linphone_core_enable_video_capture
(
mLc
,
capture_video
);
linphone_core_enable_video_display
(
mLc
,
display_video
);
for
(
const
bctbx_list_t
*
proxy
=
linphone_core_get_proxy_config_list
(
mLc
);
proxy
!=
NULL
;
proxy
=
bctbx_list_next
(
proxy
))
{
updateProxyId
((
LinphoneProxyConfig
*
)
bctbx_list_get_data
(
proxy
));
}
initCommands
();
mUseStatsEvents
=
true
;
}
...
...
@@ -403,7 +403,7 @@ LinphoneAuthInfo *Daemon::findAuthInfo(int id) {
}
int
Daemon
::
updateAudioStreamId
(
AudioStream
*
audio_stream
)
{
for
(
std
::
map
<
int
,
AudioStreamAndOther
*>::
iterator
it
=
mAudioStreams
.
begin
();
it
!=
mAudioStreams
.
end
();
++
it
)
{
for
(
map
<
int
,
AudioStreamAndOther
*>::
iterator
it
=
mAudioStreams
.
begin
();
it
!=
mAudioStreams
.
end
();
++
it
)
{
if
(
it
->
second
->
stream
==
audio_stream
)
return
it
->
first
;
}
...
...
@@ -414,21 +414,21 @@ int Daemon::updateAudioStreamId(AudioStream *audio_stream) {
}
AudioStreamAndOther
*
Daemon
::
findAudioStreamAndOther
(
int
id
)
{
std
::
map
<
int
,
AudioStreamAndOther
*>::
iterator
it
=
mAudioStreams
.
find
(
id
);
map
<
int
,
AudioStreamAndOther
*>::
iterator
it
=
mAudioStreams
.
find
(
id
);
if
(
it
!=
mAudioStreams
.
end
())
return
it
->
second
;
return
NULL
;
}
AudioStream
*
Daemon
::
findAudioStream
(
int
id
)
{
std
::
map
<
int
,
AudioStreamAndOther
*>::
iterator
it
=
mAudioStreams
.
find
(
id
);
map
<
int
,
AudioStreamAndOther
*>::
iterator
it
=
mAudioStreams
.
find
(
id
);
if
(
it
!=
mAudioStreams
.
end
())
return
it
->
second
->
stream
;
return
NULL
;
}
void
Daemon
::
removeAudioStream
(
int
id
)
{
std
::
map
<
int
,
AudioStreamAndOther
*>::
iterator
it
=
mAudioStreams
.
find
(
id
);
map
<
int
,
AudioStreamAndOther
*>::
iterator
it
=
mAudioStreams
.
find
(
id
);
if
(
it
!=
mAudioStreams
.
end
())
{
mAudioStreams
.
erase
(
it
);
delete
(
it
->
second
);
...
...
@@ -542,7 +542,7 @@ void Daemon::dtmfReceived(LinphoneCore *lc, LinphoneCall *call, int dtmf) {
}
void
Daemon
::
iterateStreamStats
()
{
for
(
std
::
map
<
int
,
AudioStreamAndOther
*>::
iterator
it
=
mAudioStreams
.
begin
();
it
!=
mAudioStreams
.
end
();
++
it
)
{
for
(
map
<
int
,
AudioStreamAndOther
*>::
iterator
it
=
mAudioStreams
.
begin
();
it
!=
mAudioStreams
.
end
();
++
it
)
{
OrtpEvent
*
ev
;
while
(
it
->
second
->
queue
&&
(
NULL
!=
(
ev
=
ortp_ev_queue_get
(
it
->
second
->
queue
)))){
OrtpEventType
evt
=
ortp_event_get_type
(
ev
);
...
...
@@ -730,7 +730,7 @@ void Daemon::dumpCommandsHelpHtml(){
cout
<<
"<h3>"
<<
"Description"
<<
"</h3>"
<<
endl
;
cout
<<
"<p>"
<<
htmlEscape
((
*
it
)
->
getDescription
())
<<
"</p>"
<<
endl
;
cout
<<
"<h3>"
<<
"Examples"
<<
"</h3>"
<<
endl
;
const
std
::
list
<
const
DaemonCommandExample
*>
&
examples
=
(
*
it
)
->
getExamples
();
const
list
<
const
DaemonCommandExample
*>
&
examples
=
(
*
it
)
->
getExamples
();
cout
<<
"<p><i>"
;
for
(
list
<
const
DaemonCommandExample
*>::
const_iterator
ex_it
=
examples
.
begin
();
ex_it
!=
examples
.
end
();
++
ex_it
){
cout
<<
"<b>"
<<
htmlEscape
(
"Linphone-daemon>"
)
<<
htmlEscape
((
*
ex_it
)
->
getCommand
())
<<
"</b><br>"
<<
endl
;
...
...
@@ -792,7 +792,7 @@ string Daemon::readLine(const string& prompt, bool *eof) {
stringbuf
outbuf
;
cin
.
get
(
outbuf
);
cin
.
clear
();
cin
.
ignore
(
std
::
numeric_limits
<
std
::
streamsize
>::
max
(),
'\n'
);
cin
.
ignore
(
numeric_limits
<
streamsize
>::
max
(),
'\n'
);
return
outbuf
.
str
();
#endif
}
...
...
@@ -851,7 +851,7 @@ void Daemon::enableLSD(bool enabled) {
Daemon
::~
Daemon
()
{
uninitCommands
();
for
(
std
::
map
<
int
,
AudioStreamAndOther
*>::
iterator
it
=
mAudioStreams
.
begin
();
it
!=
mAudioStreams
.
end
();
++
it
)
{
for
(
map
<
int
,
AudioStreamAndOther
*>::
iterator
it
=
mAudioStreams
.
begin
();
it
!=
mAudioStreams
.
end
();
++
it
)
{
audio_stream_stop
(
it
->
second
->
stream
);
}
...
...
src/c-wrapper/api/c-call.cpp
View file @
6a395649
...
...
@@ -735,7 +735,7 @@ const char *linphone_call_get_remote_user_agent (LinphoneCall *call) {
}
const
char
*
linphone_call_get_remote_contact
(
LinphoneCall
*
call
)
{
std
::
string
contact
=
L_GET_CPP_PTR_FROM_C_OBJECT
(
call
)
->
getRemoteContact
();
string
contact
=
L_GET_CPP_PTR_FROM_C_OBJECT
(
call
)
->
getRemoteContact
();
if
(
contact
.
empty
())
return
nullptr
;
if
(
call
->
remoteContactCache
)
...
...
@@ -745,7 +745,7 @@ const char * linphone_call_get_remote_contact (LinphoneCall *call) {
}
const
char
*
linphone_call_get_authentication_token
(
LinphoneCall
*
call
)
{
std
::
string
token
=
L_GET_CPP_PTR_FROM_C_OBJECT
(
call
)
->
getAuthenticationToken
();
string
token
=
L_GET_CPP_PTR_FROM_C_OBJECT
(
call
)
->
getAuthenticationToken
();
return
token
.
empty
()
?
nullptr
:
token
.
c_str
();
}
...
...
@@ -1184,7 +1184,7 @@ void linphone_call_set_user_data (LinphoneCall *call, void *ud) {
LinphoneCall
*
linphone_call_new_outgoing
(
LinphoneCore
*
lc
,
const
LinphoneAddress
*
from
,
const
LinphoneAddress
*
to
,
const
LinphoneCallParams
*
params
,
LinphoneProxyConfig
*
cfg
)
{
LinphoneCall
*
call
=
L_INIT
(
Call
);
L_SET_CPP_PTR_FROM_C_OBJECT
(
call
,
std
::
make_shared
<
LinphonePrivate
::
Call
>
(
call
,
lc
,
LinphoneCallOutgoing
,
L_SET_CPP_PTR_FROM_C_OBJECT
(
call
,
make_shared
<
LinphonePrivate
::
Call
>
(
call
,
lc
,
LinphoneCallOutgoing
,
*
L_GET_CPP_PTR_FROM_C_OBJECT
(
from
),
*
L_GET_CPP_PTR_FROM_C_OBJECT
(
to
),
cfg
,
nullptr
,
L_GET_CPP_PTR_FROM_C_OBJECT
(
params
)));
call
->
currentParamsCache
=
linphone_call_params_new_for_wrapper
();
...
...
@@ -1196,7 +1196,7 @@ LinphoneCall *linphone_call_new_outgoing (LinphoneCore *lc, const LinphoneAddres
LinphoneCall
*
linphone_call_new_incoming
(
LinphoneCore
*
lc
,
const
LinphoneAddress
*
from
,
const
LinphoneAddress
*
to
,
SalOp
*
op
)
{
LinphoneCall
*
call
=
L_INIT
(
Call
);
L_SET_CPP_PTR_FROM_C_OBJECT
(
call
,
std
::
make_shared
<
LinphonePrivate
::
Call
>
(
call
,
lc
,
LinphoneCallIncoming
,
L_SET_CPP_PTR_FROM_C_OBJECT
(
call
,
make_shared
<
LinphonePrivate
::
Call
>
(
call
,
lc
,
LinphoneCallIncoming
,
*
L_GET_CPP_PTR_FROM_C_OBJECT
(
from
),
*
L_GET_CPP_PTR_FROM_C_OBJECT
(
to
),
nullptr
,
op
,
nullptr
));
call
->
currentParamsCache
=
linphone_call_params_new_for_wrapper
();
...
...
src/c-wrapper/api/c-chat-message.cpp
View file @
6a395649
...
...
@@ -498,8 +498,8 @@ void linphone_chat_message_send_display_notification(LinphoneChatMessage *cm) {
}
LinphoneStatus
linphone_chat_message_put_char
(
LinphoneChatMessage
*
msg
,
uint32_t
character
)
{
LinphoneChatRoom
*
cr
=
linphone_chat_message_get_chat_room
(
msg
);
if
(
linphone_core_realtime_text_enabled
(
linphone_chat_room_get_core
(
cr
)))
{
std
::
shared_ptr
<
LinphonePrivate
::
RealTimeTextChatRoom
>
rttcr
=
std
::
static_pointer_cast
<
LinphonePrivate
::
RealTimeTextChatRoom
>
(
L_GET_CPP_PTR_FROM_C_OBJECT
(
cr
));
shared_ptr
<
LinphonePrivate
::
RealTimeTextChatRoom
>
rttcr
=
static_pointer_cast
<
LinphonePrivate
::
RealTimeTextChatRoom
>
(
L_GET_CPP_PTR_FROM_C_OBJECT
(
cr
));
LinphoneCall
*
call
=
rttcr
->
getCall
();
LinphoneCore
*
lc
=
rttcr
->
getCore
();
const
uint32_t
new_line
=
0x2028
;
...
...
src/c-wrapper/api/c-chat-room.cpp
View file @
6a395649
...
...
@@ -269,9 +269,9 @@ void linphone_chat_room_set_user_data (LinphoneChatRoom *cr, void *ud) {
LinphoneChatRoom
*
linphone_chat_room_new
(
LinphoneCore
*
core
,
const
LinphoneAddress
*
addr
)
{
LinphoneChatRoom
*
cr
=
L_INIT
(
ChatRoom
);
if
(
linphone_core_realtime_text_enabled
(
core
))
L_SET_CPP_PTR_FROM_C_OBJECT
(
cr
,
std
::
make_shared
<
LinphonePrivate
::
RealTimeTextChatRoom
>
(
core
,
*
L_GET_CPP_PTR_FROM_C_OBJECT
(
addr
)));
L_SET_CPP_PTR_FROM_C_OBJECT
(
cr
,
make_shared
<
LinphonePrivate
::
RealTimeTextChatRoom
>
(
core
,
*
L_GET_CPP_PTR_FROM_C_OBJECT
(
addr
)));
else
L_SET_CPP_PTR_FROM_C_OBJECT
(
cr
,
std
::
make_shared
<
LinphonePrivate
::
BasicChatRoom
>
(
core
,
*
L_GET_CPP_PTR_FROM_C_OBJECT
(
addr
)));
L_SET_CPP_PTR_FROM_C_OBJECT
(
cr
,
make_shared
<
LinphonePrivate
::
BasicChatRoom
>
(
core
,
*
L_GET_CPP_PTR_FROM_C_OBJECT
(
addr
)));
L_GET_PRIVATE_FROM_C_OBJECT
(
cr
)
->
setState
(
LinphonePrivate
::
ChatRoom
::
State
::
Instantiated
);
L_GET_PRIVATE_FROM_C_OBJECT
(
cr
)
->
setState
(
LinphonePrivate
::
ChatRoom
::
State
::
Created
);
return
cr
;
...
...
@@ -284,7 +284,7 @@ LinphoneChatRoom *_linphone_client_group_chat_room_new (LinphoneCore *core) {
LinphoneAddress
*
factoryAddr
=
linphone_address_new
(
factoryUri
);
LinphoneProxyConfig
*
proxy
=
linphone_core_lookup_known_proxy
(
core
,
factoryAddr
);
linphone_address_unref
(
factoryAddr
);
std
::
string
from
;
string
from
;
if
(
proxy
)
from
=
L_GET_CPP_PTR_FROM_C_OBJECT
(
linphone_proxy_config_get_identity_address
(
proxy
))
->
asString
();
if
(
from
.
empty
())
...
...
src/call/call-listener.h
View file @
6a395649
...
...
@@ -27,7 +27,7 @@ LINPHONE_BEGIN_NAMESPACE
class
CallListener
{
public:
virtual
~
CallListener
()
=
default
;
virtual
~
CallListener
()
=
default
;
virtual
void
onAckBeingSent
(
LinphoneHeaders
*
headers
)
=
0
;
virtual
void
onAckReceived
(
LinphoneHeaders
*
headers
)
=
0
;
...
...
src/call/call-p.h
View file @
6a395649
...
...
@@ -29,25 +29,39 @@
LINPHONE_BEGIN_NAMESPACE
class
CallPrivate
:
public
ObjectPrivate
,
CallListener
{
class
CallPrivate
:
public
ObjectPrivate
,
CallListener
{
public:
CallPrivate
(
LinphoneCall
*
call
,
LinphoneCore
*
core
,
LinphoneCallDir
direction
,
const
Address
&
from
,
const
Address
&
to
,
LinphoneProxyConfig
*
cfg
,
SalOp
*
op
,
const
MediaSessionParams
*
msp
);
CallPrivate
(
LinphoneCall
*
call
,
LinphoneCore
*
core
,
LinphoneCallDir
direction
,
const
Address
&
from
,
const
Address
&
to
,
LinphoneProxyConfig
*
cfg
,
SalOp
*
op
,
const
MediaSessionParams
*
msp
);
virtual
~
CallPrivate
();
void
initiateIncoming
();
bool
initiateOutgoing
();
void
iterate
(
time_t
currentRealTime
,
bool
oneSecondElapsed
);
void
startIncomingNotification
();
int
startInvite
(
const
Address
*
destination
);
/* If destination is nullptr, it is taken from the call log */
int
startInvite
(
const
Address
*
destination
);
std
::
shared_ptr
<
CallSession
>
getActiveSession
()
const
;
bool
getAudioMuted
()
const
;
Conference
*
getConference
()
const
{
return
conference
;
}
LinphoneProxyConfig
*
getDestProxy
()
const
;
IceSession
*
getIceSession
()
const
;
MediaStream
*
getMediaStream
(
LinphoneStreamType
type
)
const
;
SalOp
*
getOp
()
const
;
Conference
*
getConference
()
const
{
return
conference
;
}
LinphoneProxyConfig
*
getDestProxy
()
const
;
IceSession
*
getIceSession
()
const
;
MediaStream
*
getMediaStream
(
LinphoneStreamType
type
)
const
;
SalOp
*
getOp
()
const
;
void
setAudioMuted
(
bool
value
);
private:
...
...
src/call/call.cpp
View file @
6a395649
...
...
@@ -23,16 +23,22 @@
#include "conference/session/media-session-p.h"
#include "logger/logger.h"
#include "call.h"
// =============================================================================
using
namespace
std
;
LINPHONE_BEGIN_NAMESPACE
CallPrivate
::
CallPrivate
(
LinphoneCall
*
call
,
LinphoneCore
*
core
,
LinphoneCallDir
direction
,
const
Address
&
from
,
const
Address
&
to
,
LinphoneProxyConfig
*
cfg
,
SalOp
*
op
,
const
MediaSessionParams
*
msp
)
:
lcall
(
call
),
core
(
core
)
{
CallPrivate
::
CallPrivate
(
LinphoneCall
*
call
,
LinphoneCore
*
core
,
LinphoneCallDir
direction
,
const
Address
&
from
,
const
Address
&
to
,
LinphoneProxyConfig
*
cfg
,
SalOp
*
op
,
const
MediaSessionParams
*
msp
)
:
lcall
(
call
),
core
(
core
)
{
nextVideoFrameDecoded
.
_func
=
nullptr
;
nextVideoFrameDecoded
.
_user_data
=
nullptr
;
}
...
...
@@ -52,19 +58,19 @@ bool CallPrivate::getAudioMuted () const {
return
static_cast
<
MediaSession
*>
(
getActiveSession
().
get
())
->
getPrivate
()
->
getAudioMuted
();
}
LinphoneProxyConfig
*
CallPrivate
::
getDestProxy
()
const
{
LinphoneProxyConfig
*
CallPrivate
::
getDestProxy
()
const
{
return
getActiveSession
()
->
getPrivate
()
->
getDestProxy
();
}
IceSession
*
CallPrivate
::
getIceSession
()
const
{
IceSession
*
CallPrivate
::
getIceSession
()
const
{
return
static_cast
<
MediaSession
*>
(
getActiveSession
().
get
())
->
getPrivate
()
->
getIceSession
();
}
MediaStream
*
CallPrivate
::
getMediaStream
(
LinphoneStreamType
type
)
const
{
MediaStream
*
CallPrivate
::
getMediaStream
(
LinphoneStreamType
type
)
const
{
return
static_cast
<
MediaSession
*>
(
getActiveSession
().
get
())
->
getPrivate
()
->
getMediaStream
(
type
);
}
SalOp
*
CallPrivate
::
getOp
()
const
{
SalOp
*
CallPrivate
::
getOp
()
const
{
return
getActiveSession
()
->
getPrivate
()
->
getOp
();
}
...
...
@@ -119,16 +125,16 @@ void CallPrivate::onCallSetTerminated () {
}
if
(
linphone_core_del_call
(
core
,
lcall
)
!=
0
)
lError
()
<<
"Could not remove the call from the list!!!"
;
#if 0
if (core->conf_ctx)
linphone_conference_on_call_terminating(core->conf_ctx, lcall);
if (lcall->ringing_beep){
linphone_core_stop_dtmf(core);
lcall->ringing_beep = false;
}
if (lcall->chat_room)
linphone_chat_room_set_call(lcall->chat_room, nullptr);
#endif
#if 0
if (core->conf_ctx)
linphone_conference_on_call_terminating(core->conf_ctx, lcall);
if (lcall->ringing_beep)
{
linphone_core_stop_dtmf(core);
lcall->ringing_beep = false;
}
if (lcall->chat_room)
linphone_chat_room_set_call(lcall->chat_room, nullptr);
#endif
// if 0
if
(
!
core
->
calls
)
ms_bandwidth_controller_reset_state
(
core
->
bw_controller
);
}
...
...
@@ -149,8 +155,8 @@ void CallPrivate::onCheckForAcceptation () {
case
LinphoneCallOutgoingProgress
:
case
LinphoneCallOutgoingRinging
:
case
LinphoneCallOutgoingEarlyMedia
:
lInfo
()
<<
"Already existing call ["
<<
call
<<
"] in state ["
<<
linphone_call_state_to_string
(
linphone_call_get_state
(
call
))
<<
"], canceling it before accepting new call ["
<<
lcall
<<
"]"
;
lInfo
()
<<
"Already existing call ["
<<
call
<<
"] in state ["
<<
linphone_call_state_to_string
(
linphone_call_get_state
(
call
))
<<
"], canceling it before accepting new call ["
<<
lcall
<<
"]"
;
linphone_call_terminate
(
call
);
break
;
default:
...
...
@@ -198,16 +204,24 @@ void CallPrivate::onFirstVideoFrameDecoded () {
}
void
CallPrivate
::
onResetFirstVideoFrameDecoded
()
{
#ifdef VIDEO_ENABLED
if
(
lcall
&&
nextVideoFrameDecoded
.
_func
)
static_cast
<
MediaSession
*>
(
getActiveSession
().
get
())
->
resetFirstVideoFrameDecoded
();
#endif
#ifdef VIDEO_ENABLED
if
(
lcall
&&
nextVideoFrameDecoded
.
_func
)
static_cast
<
MediaSession
*>
(
getActiveSession
().
get
())
->
resetFirstVideoFrameDecoded
();
#endif
// ifdef VIDEO_ENABLED
}
// =============================================================================
Call
::
Call
(
LinphoneCall
*
call
,
LinphoneCore
*
core
,
LinphoneCallDir
direction
,
const
Address
&
from
,
const
Address
&
to
,
LinphoneProxyConfig
*
cfg
,
SalOp
*
op
,
const
MediaSessionParams
*
msp
)
:
Object
(
*
new
CallPrivate
(
call
,
core
,
direction
,
from
,
to
,
cfg
,
op
,
msp
))
{
Call
::
Call
(
LinphoneCall
*
call
,
LinphoneCore
*
core
,
LinphoneCallDir
direction
,
const
Address
&
from
,
const
Address
&
to
,
LinphoneProxyConfig
*
cfg
,
SalOp
*
op
,
const
MediaSessionParams
*
msp
)
:
Object
(
*
new
CallPrivate
(
call
,
core
,
direction
,
from
,
to
,
cfg
,
op
,
msp
))
{
L_D
(
Call
);
const
Address
*
myAddress
=
(
direction
==
LinphoneCallIncoming
)
?
&
to
:
&
from
;
string
confType
=
lp_config_get_string
(
linphone_core_get_config
(
core
),
"misc"
,
"conference_type"
,
"local"
);
...
...
@@ -273,12 +287,12 @@ void Call::stopRecording () {
static_cast
<
MediaSession
*>
(
d
->
getActiveSession
().
get
())
->
stopRecording
();
}
LinphoneStatus
Call
::
takePreviewSnapshot
(
const
string
&
file
)
{
LinphoneStatus
Call
::
takePreviewSnapshot
(
const
string
&
file
)
{
L_D
(
Call
);
return
static_cast
<
MediaSession
*>
(
d
->
getActiveSession
().
get
())
->
takePreviewSnapshot
(
file
);
}
LinphoneStatus
Call
::
takeVideoSnapshot
(
const
string
&
file
)
{
LinphoneStatus
Call
::
takeVideoSnapshot
(
const
string
&
file
)
{
L_D
(
Call
);
return
static_cast
<
MediaSession
*>
(
d
->
getActiveSession
().
get
())
->
takeVideoSnapshot
(
file
);
}
...
...
@@ -335,7 +349,7 @@ bool Call::getAllMuted () const {
return
static_cast
<
const
MediaSession
*>
(
d
->
getActiveSession
().
get
())
->
getAllMuted
();
}
LinphoneCallStats
*
Call
::
getAudioStats
()
const
{
LinphoneCallStats
*
Call
::
getAudioStats
()
const
{
L_D
(
const
Call
);
return
static_cast
<
const
MediaSession
*>
(
d
->
getActiveSession
().
get
())
->
getAudioStats
();
}
...
...
@@ -355,12 +369,12 @@ float Call::getAverageQuality () const {
return
static_cast
<
const
MediaSession
*>
(
d
->
getActiveSession
().
get
())
->
getAverageQuality
();
}
LinphoneCore
*
Call
::
getCore
()
const
{
LinphoneCore
*
Call
::
getCore
()
const
{
L_D
(
const
Call
);
return
d
->
core
;
}
const
MediaSessionParams
*
Call
::
getCurrentParams
()
const
{
const
MediaSessionParams
*
Call
::
getCurrentParams
()
const
{
L_D
(
const
Call
);
return
static_cast
<
MediaSession
*>
(
d
->
getActiveSession
().
get
())
->
getCurrentParams
();
}
...
...
@@ -380,22 +394,22 @@ int Call::getDuration () const {
return
d
->
getActiveSession
()
->
getDuration
();
}
const
LinphoneErrorInfo
*
Call
::
getErrorInfo
()
const
{
const
LinphoneErrorInfo
*
Call
::
getErrorInfo
()
const
{
L_D
(
const
Call
);
return
d
->
getActiveSession
()
->
getErrorInfo
();
}
LinphoneCallLog
*
Call
::
getLog
()
const
{
LinphoneCallLog
*
Call
::
getLog
()
const
{
L_D
(
const
Call
);
return
d
->
getActiveSession
()
->
getLog
();
}
RtpTransport
*
Call
::
getMetaRtcpTransport
(
int
streamIndex
)
const
{
RtpTransport
*
Call
::
getMetaRtcpTransport
(
int
streamIndex
)
const
{
L_D
(
const
Call
);
return
static_cast
<
MediaSession
*>
(
d
->
getActiveSession
().
get
())
->
getMetaRtcpTransport
(
streamIndex
);
}
RtpTransport
*
Call
::
getMetaRtpTransport
(
int
streamIndex
)
const
{
RtpTransport
*
Call
::
getMetaRtpTransport
(
int
streamIndex
)
const
{
L_D
(
const
Call
);
return
static_cast
<
MediaSession
*>
(
d
->
getActiveSession
().
get
())
->
getMetaRtpTransport
(
streamIndex
);
}
...
...
@@ -405,12 +419,12 @@ float Call::getMicrophoneVolumeGain () const {
return
static_cast
<
const
MediaSession
*>
(
d
->
getActiveSession
().
get
())
->
getMicrophoneVolumeGain
();
}
void
*
Call
::
getNativeVideoWindowId
()
const
{
void
*
Call
::
getNativeVideoWindowId
()
const
{
L_D
(
const
Call
);
return
static_cast
<
const
MediaSession
*>
(
d
->
getActiveSession
().
get
())
->
getNativeVideoWindowId
();
}
const
MediaSessionParams
*
Call
::
getParams
()
const
{
const
MediaSessionParams
*
Call
::
getParams
()
const
{
L_D
(
const
Call
);
return
static_cast
<
const
MediaSession
*>
(
d
->
getActiveSession
().
get
())
->
getMediaParams
();
}
...
...
@@ -430,7 +444,7 @@ float Call::getRecordVolume () const {
return
static_cast
<
const
MediaSession
*>
(
d
->
getActiveSession
().
get
())
->
getRecordVolume
();
}
const
Address
&
Call
::
getRemoteAddress
()
const
{
const
Address
&
Call
::
getRemoteAddress
()
const
{
L_D
(
const
Call
);
return
d
->
getActiveSession
()
->
getRemoteAddress
();
}
...
...
@@ -445,7 +459,7 @@ string Call::getRemoteContact () const {
return
d
->
getActiveSession
()
->
getRemoteContact
();
}
const
MediaSessionParams
*
Call
::
getRemoteParams
()
const
{
const
MediaSessionParams
*
Call
::
getRemoteParams
()
const
{
L_D
(
const
Call
);
return
static_cast
<
MediaSession
*>
(
d
->
getActiveSession
().
get
())
->
getRemoteParams
();
}
...
...
@@ -460,7 +474,7 @@ LinphoneCallState Call::getState () const {
return
d
->
getActiveSession
()
->
getState
();
}
LinphoneCallStats
*
Call
::
getStats
(
LinphoneStreamType
type
)
const
{
LinphoneCallStats
*
Call
::
getStats
(
LinphoneStreamType
type
)
const
{
L_D
(
const
Call
);
return
static_cast
<
const
MediaSession
*>
(
d
->
getActiveSession
().
get
())
->
getStats
(
type
);
}
...
...
@@ -475,12 +489,12 @@ MSFormatType Call::getStreamType (int streamIndex) const {
return
static_cast
<
const
MediaSession
*>
(
d
->
getActiveSession
().
get
())
->
getStreamType
(
streamIndex
);
}