Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-client-android
Commits
6f283ef3
Commit
6f283ef3
authored
May 17, 2021
by
Adrien Béraud
Browse files
call service: synchronize state change
Change-Id: I50426174a6441aa53cb042890ae42233bdc73d8a
parent
17d34dc8
Changes
1
Hide whitespace changes
Inline
Side-by-side
ring-android/libringclient/src/main/java/cx/ring/services/CallService.java
View file @
6f283ef3
...
...
@@ -453,23 +453,27 @@ public class CallService {
}
public
void
removeCallForId
(
String
callId
)
{
currentCalls
.
remove
(
callId
);
currentConferences
.
remove
(
callId
);
synchronized
(
currentCalls
)
{
currentCalls
.
remove
(
callId
);
currentConferences
.
remove
(
callId
);
}
}
private
SipCall
addCall
(
String
accountId
,
String
callId
,
String
from
,
SipCall
.
Direction
direction
)
{
SipCall
call
=
currentCalls
.
get
(
callId
);
if
(
call
==
null
)
{
Account
account
=
mAccountService
.
getAccount
(
accountId
);
Uri
fromUri
=
new
Uri
(
from
);
Conversation
conversation
=
account
.
getByUri
(
fromUri
);
CallContact
contact
=
mContactService
.
findContact
(
account
,
fromUri
);
call
=
new
SipCall
(
callId
,
new
Uri
(
from
).
getUri
(),
accountId
,
conversation
,
contact
,
direction
);
currentCalls
.
put
(
callId
,
call
);
}
else
{
Log
.
w
(
TAG
,
"Call already existed ! "
+
callId
+
" "
+
from
);
synchronized
(
currentCalls
)
{
SipCall
call
=
currentCalls
.
get
(
callId
);
if
(
call
==
null
)
{
Account
account
=
mAccountService
.
getAccount
(
accountId
);
Uri
fromUri
=
new
Uri
(
from
);
Conversation
conversation
=
account
.
getByUri
(
fromUri
);
CallContact
contact
=
mContactService
.
findContact
(
account
,
fromUri
);
call
=
new
SipCall
(
callId
,
new
Uri
(
from
).
getUri
(),
accountId
,
conversation
,
contact
,
direction
);
currentCalls
.
put
(
callId
,
call
);
}
else
{
Log
.
w
(
TAG
,
"Call already existed ! "
+
callId
+
" "
+
from
);
}
return
call
;
}
return
call
;
}
private
Conference
addConference
(
SipCall
call
)
{
...
...
@@ -537,13 +541,15 @@ public class CallService {
void
callStateChanged
(
String
callId
,
String
newState
,
int
detailCode
)
{
Log
.
d
(
TAG
,
"call state changed: "
+
callId
+
", "
+
newState
+
", "
+
detailCode
);
try
{
SipCall
call
=
parseCallState
(
callId
,
newState
);
if
(
call
!=
null
)
{
callSubject
.
onNext
(
call
);
if
(
call
.
getCallStatus
()
==
SipCall
.
CallStatus
.
OVER
)
{
currentCalls
.
remove
(
call
.
getDaemonIdString
());
currentConferences
.
remove
(
call
.
getDaemonIdString
());
updateConnectionCount
();
synchronized
(
currentCalls
)
{
SipCall
call
=
parseCallState
(
callId
,
newState
);
if
(
call
!=
null
)
{
callSubject
.
onNext
(
call
);
if
(
call
.
getCallStatus
()
==
SipCall
.
CallStatus
.
OVER
)
{
currentCalls
.
remove
(
call
.
getDaemonIdString
());
currentConferences
.
remove
(
call
.
getDaemonIdString
());
updateConnectionCount
();
}
}
}
}
catch
(
Exception
e
)
{
...
...
Write
Preview
Supports
Markdown
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