Rename some API
This commit is contained in:
parent
2581a3433e
commit
24a9931abd
|
@ -25,14 +25,17 @@ interface CallService {
|
||||||
fun getTurnServer(callback: MatrixCallback<TurnServer?>)
|
fun getTurnServer(callback: MatrixCallback<TurnServer?>)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Start a call
|
||||||
* Send offer SDP to the other participant.
|
* Send offer SDP to the other participant.
|
||||||
|
* @param callId a callId that the caller can create, it will be used to identify the call for other methods
|
||||||
*/
|
*/
|
||||||
fun sendOfferSdp(callId: String, roomId: String, sdp: SessionDescription, callback: MatrixCallback<String>)
|
fun startCall(callId: String, roomId: String, sdp: SessionDescription, callback: MatrixCallback<String>)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Accept an incoming call
|
||||||
* Send answer SDP to the other participant.
|
* Send answer SDP to the other participant.
|
||||||
*/
|
*/
|
||||||
fun sendAnswerSdp(callId: String, roomId: String, sdp: SessionDescription, callback: MatrixCallback<String>)
|
fun pickUp(callId: String, roomId: String, sdp: SessionDescription, callback: MatrixCallback<String>)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send Ice candidate to the other participant.
|
* Send Ice candidate to the other participant.
|
||||||
|
@ -47,7 +50,7 @@ interface CallService {
|
||||||
/**
|
/**
|
||||||
* Send a hangup event
|
* Send a hangup event
|
||||||
*/
|
*/
|
||||||
fun sendHangup(callId: String, roomId: String)
|
fun hangup(callId: String, roomId: String)
|
||||||
|
|
||||||
fun addCallListener(listener: CallsListener)
|
fun addCallListener(listener: CallsListener)
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ internal class DefaultCallService @Inject constructor(
|
||||||
TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
|
TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun sendOfferSdp(callId: String, roomId: String, sdp: SessionDescription, callback: MatrixCallback<String>) {
|
override fun startCall(callId: String, roomId: String, sdp: SessionDescription, callback: MatrixCallback<String>) {
|
||||||
val eventContent = CallInviteContent(
|
val eventContent = CallInviteContent(
|
||||||
callId = callId,
|
callId = callId,
|
||||||
lifetime = CALL_TIMEOUT_MS,
|
lifetime = CALL_TIMEOUT_MS,
|
||||||
|
@ -72,7 +72,7 @@ internal class DefaultCallService @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun sendAnswerSdp(callId: String, roomId: String, sdp: SessionDescription, callback: MatrixCallback<String>) {
|
override fun pickUp(callId: String, roomId: String, sdp: SessionDescription, callback: MatrixCallback<String>) {
|
||||||
val eventContent = CallAnswerContent(
|
val eventContent = CallAnswerContent(
|
||||||
callId = callId,
|
callId = callId,
|
||||||
answer = CallAnswerContent.Answer(sdp = sdp.description)
|
answer = CallAnswerContent.Answer(sdp = sdp.description)
|
||||||
|
@ -114,7 +114,7 @@ internal class DefaultCallService @Inject constructor(
|
||||||
override fun sendLocalIceCandidateRemovals(callId: String, roomId: String, candidates: List<IceCandidate>) {
|
override fun sendLocalIceCandidateRemovals(callId: String, roomId: String, candidates: List<IceCandidate>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun sendHangup(callId: String, roomId: String) {
|
override fun hangup(callId: String, roomId: String) {
|
||||||
val eventContent = CallHangupContent(callId = callId)
|
val eventContent = CallHangupContent(callId = callId)
|
||||||
createEventAndLocalEcho(type = EventType.CALL_HANGUP, roomId = roomId, content = eventContent.toContent()).let { event ->
|
createEventAndLocalEcho(type = EventType.CALL_HANGUP, roomId = roomId, content = eventContent.toContent()).let { event ->
|
||||||
roomEventSender.sendEvent(event)
|
roomEventSender.sendEvent(event)
|
||||||
|
|
|
@ -304,9 +304,10 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
||||||
peerConnection?.setLocalDescription(object : SdpObserverAdapter() {
|
peerConnection?.setLocalDescription(object : SdpObserverAdapter() {
|
||||||
override fun onSetSuccess() {
|
override fun onSetSuccess() {
|
||||||
Timber.v("## setLocalDescription success")
|
Timber.v("## setLocalDescription success")
|
||||||
callId = UUID.randomUUID().toString()
|
val id = UUID.randomUUID().toString()
|
||||||
Timber.v("## sending offer to callId: $callId roomId: $signalingRoomId")
|
callId = id
|
||||||
sessionHolder.getActiveSession().callService().sendOfferSdp(callId ?: "", signalingRoomId
|
Timber.v("## sending offer to callId: $id roomId: $signalingRoomId")
|
||||||
|
sessionHolder.getActiveSession().callService().startCall(id, signalingRoomId
|
||||||
?: "", sessionDescription, object : MatrixCallback<String> {})
|
?: "", sessionDescription, object : MatrixCallback<String> {})
|
||||||
}
|
}
|
||||||
}, sessionDescription)
|
}, sessionDescription)
|
||||||
|
@ -449,7 +450,7 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
||||||
|
|
||||||
fun endCall() {
|
fun endCall() {
|
||||||
if (callId != null && signalingRoomId != null) {
|
if (callId != null && signalingRoomId != null) {
|
||||||
sessionHolder.getActiveSession().callService().sendHangup(callId!!, signalingRoomId!!)
|
sessionHolder.getActiveSession().callService().hangup(callId!!, signalingRoomId!!)
|
||||||
}
|
}
|
||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue