Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
fe0fcb40
Unverified
Commit
fe0fcb40
authored
Oct 1, 2020
by
Sébastien Blin
Browse files
Options
Downloads
Patches
Plain Diff
jamiaccount: onConnectedOutgoingCall use a shared_ptr instead a ref
Change-Id: I03f590752eb907288bb93a3ed3419c079197461a
parent
53477661
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/jamidht/jamiaccount.cpp
+18
-14
18 additions, 14 deletions
src/jamidht/jamiaccount.cpp
src/jamidht/jamiaccount.h
+3
-1
3 additions, 1 deletion
src/jamidht/jamiaccount.h
with
21 additions
and
15 deletions
src/jamidht/jamiaccount.cpp
+
18
−
14
View file @
fe0fcb40
...
@@ -598,7 +598,7 @@ JamiAccount::startOutgoingCall(const std::shared_ptr<SIPCall>& call, const std::
...
@@ -598,7 +598,7 @@ JamiAccount::startOutgoingCall(const std::shared_ptr<SIPCall>& call, const std::
auto
remoted_address
=
it
.
channel
->
underlyingICE
()
->
getRemoteAddress
(
ICE_COMP_SIP_TRANSPORT
);
auto
remoted_address
=
it
.
channel
->
underlyingICE
()
->
getRemoteAddress
(
ICE_COMP_SIP_TRANSPORT
);
try
{
try
{
onConnectedOutgoingCall
(
*
dev_call
,
toUri
,
remoted_address
);
onConnectedOutgoingCall
(
dev_call
,
toUri
,
remoted_address
);
}
catch
(
const
VoipLinkException
&
)
{
}
catch
(
const
VoipLinkException
&
)
{
// In this case, the main scenario is that SIPStartCall failed because
// In this case, the main scenario is that SIPStartCall failed because
// the ICE is dead and the TLS session didn't send any packet on that dead
// the ICE is dead and the TLS session didn't send any packet on that dead
...
@@ -633,18 +633,22 @@ JamiAccount::startOutgoingCall(const std::shared_ptr<SIPCall>& call, const std::
...
@@ -633,18 +633,22 @@ JamiAccount::startOutgoingCall(const std::shared_ptr<SIPCall>& call, const std::
}
}
void
void
JamiAccount
::
onConnectedOutgoingCall
(
SIPCall
&
call
,
const
std
::
string
&
to_id
,
IpAddr
target
)
JamiAccount
::
onConnectedOutgoingCall
(
const
std
::
shared_ptr
<
SIPCall
>&
call
,
const
std
::
string
&
to_id
,
IpAddr
target
)
{
{
JAMI_DBG
(
"[call:%s] outgoing call connected to %s"
,
call
.
getCallId
().
c_str
(),
to_id
.
c_str
());
if
(
!
call
)
return
;
JAMI_DBG
(
"[call:%s] outgoing call connected to %s"
,
call
->
getCallId
().
c_str
(),
to_id
.
c_str
());
auto
opts
=
getIceOptions
();
auto
opts
=
getIceOptions
();
opts
.
onInitDone
=
[
w
=
weak
(),
target
=
std
::
move
(
target
),
&
call
](
bool
ok
)
{
opts
.
onInitDone
=
[
w
=
weak
(),
target
=
std
::
move
(
target
),
call
](
bool
ok
)
{
if
(
!
ok
)
{
if
(
!
ok
)
{
JAMI_ERR
(
"ICE medias are not initialized"
);
JAMI_ERR
(
"ICE medias are not initialized"
);
return
;
return
;
}
}
auto
shared
=
w
.
lock
();
auto
shared
=
w
.
lock
();
if
(
!
shared
)
if
(
!
shared
or
!
call
)
return
;
return
;
const
auto
localAddress
=
ip_utils
::
getInterfaceAddr
(
shared
->
getLocalInterface
(),
const
auto
localAddress
=
ip_utils
::
getInterfaceAddr
(
shared
->
getLocalInterface
(),
...
@@ -672,12 +676,12 @@ JamiAccount::onConnectedOutgoingCall(SIPCall& call, const std::string& to_id, Ip
...
@@ -672,12 +676,12 @@ JamiAccount::onConnectedOutgoingCall(SIPCall& call, const std::string& to_id, Ip
JAMI_WARN
(
"Could not instantiate codec for early media"
);
JAMI_WARN
(
"Could not instantiate codec for early media"
);
// Building the local SDP offer
// Building the local SDP offer
auto
&
sdp
=
call
.
getSDP
();
auto
&
sdp
=
call
->
getSDP
();
sdp
.
setPublishedIP
(
addrSdp
);
sdp
.
setPublishedIP
(
addrSdp
);
const
bool
created
=
sdp
.
createOffer
(
shared
->
getActiveAccountCodecInfoList
(
MEDIA_AUDIO
),
const
bool
created
=
sdp
.
createOffer
(
shared
->
getActiveAccountCodecInfoList
(
MEDIA_AUDIO
),
shared
->
getActiveAccountCodecInfoList
(
shared
->
getActiveAccountCodecInfoList
(
shared
->
videoEnabled_
and
not
call
.
isAudioOnly
()
shared
->
videoEnabled_
and
not
call
->
isAudioOnly
()
?
MEDIA_VIDEO
?
MEDIA_VIDEO
:
MEDIA_NONE
),
:
MEDIA_NONE
),
shared
->
getSrtpKeyExchange
());
shared
->
getSrtpKeyExchange
());
...
@@ -690,19 +694,19 @@ JamiAccount::onConnectedOutgoingCall(SIPCall& call, const std::string& to_id, Ip
...
@@ -690,19 +694,19 @@ JamiAccount::onConnectedOutgoingCall(SIPCall& call, const std::string& to_id, Ip
// So, we need to run the call creation in the main thread
// So, we need to run the call creation in the main thread
// Also, we do not directly call SIPStartCall before receiving onInitDone, because
// Also, we do not directly call SIPStartCall before receiving onInitDone, because
// there is an inside waitForInitialization that can block the thread.
// there is an inside waitForInitialization that can block the thread.
runOnMainThread
([
w
=
std
::
move
(
w
),
target
=
std
::
move
(
target
),
&
call
]
{
runOnMainThread
([
w
=
std
::
move
(
w
),
target
=
std
::
move
(
target
),
call
=
std
::
move
(
call
)
]
{
auto
shared
=
w
.
lock
();
auto
shared
=
w
.
lock
();
if
(
!
shared
)
if
(
!
shared
)
return
;
return
;
if
(
not
shared
->
SIPStartCall
(
call
,
target
))
{
if
(
not
shared
->
SIPStartCall
(
*
call
,
target
))
{
JAMI_ERR
(
"Could not send outgoing INVITE request for new call"
);
JAMI_ERR
(
"Could not send outgoing INVITE request for new call"
);
}
}
});
});
};
};
call
.
setIPToIP
(
true
);
call
->
setIPToIP
(
true
);
call
.
setPeerNumber
(
to_id
);
call
->
setPeerNumber
(
to_id
);
call
.
initIceMediaTransport
(
true
,
std
::
move
(
opts
));
call
->
initIceMediaTransport
(
true
,
std
::
move
(
opts
));
}
}
std
::
shared_ptr
<
Call
>
std
::
shared_ptr
<
Call
>
...
@@ -1724,7 +1728,7 @@ JamiAccount::handlePendingCall(PendingCall& pc, bool incoming)
...
@@ -1724,7 +1728,7 @@ JamiAccount::handlePendingCall(PendingCall& pc, bool incoming)
if
(
auto
call
=
wcall
.
lock
())
{
if
(
auto
call
=
wcall
.
lock
())
{
if
(
auto
account
=
waccount
.
lock
())
{
if
(
auto
account
=
waccount
.
lock
())
{
// Start SIP layer when TLS negotiation is successful
// Start SIP layer when TLS negotiation is successful
account
->
onConnectedOutgoingCall
(
*
call
,
account
->
onConnectedOutgoingCall
(
call
,
remote_id
,
remote_id
,
remote_addr
);
remote_addr
);
return
;
return
;
...
@@ -3726,7 +3730,7 @@ JamiAccount::cacheSIPConnection(std::shared_ptr<ChannelSocket>&& socket,
...
@@ -3726,7 +3730,7 @@ JamiAccount::cacheSIPConnection(std::shared_ptr<ChannelSocket>&& socket,
if
(
auto
ice
=
socket
->
underlyingICE
())
{
if
(
auto
ice
=
socket
->
underlyingICE
())
{
auto
remoted_address
=
ice
->
getRemoteAddress
(
ICE_COMP_SIP_TRANSPORT
);
auto
remoted_address
=
ice
->
getRemoteAddress
(
ICE_COMP_SIP_TRANSPORT
);
try
{
try
{
onConnectedOutgoingCall
(
*
pendingCall
,
peerId
,
remoted_address
);
onConnectedOutgoingCall
(
pendingCall
,
peerId
,
remoted_address
);
}
catch
(
const
VoipLinkException
&
)
{
}
catch
(
const
VoipLinkException
&
)
{
// In this case, the main scenario is that SIPStartCall failed because
// In this case, the main scenario is that SIPStartCall failed because
// the ICE is dead and the TLS session didn't send any packet on that dead
// the ICE is dead and the TLS session didn't send any packet on that dead
...
...
This diff is collapsed.
Click to expand it.
src/jamidht/jamiaccount.h
+
3
−
1
View file @
fe0fcb40
...
@@ -481,7 +481,9 @@ private:
...
@@ -481,7 +481,9 @@ private:
void
startOutgoingCall
(
const
std
::
shared_ptr
<
SIPCall
>&
call
,
const
std
::
string
&
toUri
);
void
startOutgoingCall
(
const
std
::
shared_ptr
<
SIPCall
>&
call
,
const
std
::
string
&
toUri
);
void
onConnectedOutgoingCall
(
SIPCall
&
call
,
const
std
::
string
&
to_id
,
IpAddr
target
);
void
onConnectedOutgoingCall
(
const
std
::
shared_ptr
<
SIPCall
>&
call
,
const
std
::
string
&
to_id
,
IpAddr
target
);
/**
/**
* Set the internal state for this account, mainly used to manage account details from the
* Set the internal state for this account, mainly used to manage account details from the
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment