Rename some API
This commit is contained in:
parent
2581a3433e
commit
24a9931abd
|
@ -25,14 +25,17 @@ interface CallService {
|
|||
fun getTurnServer(callback: MatrixCallback<TurnServer?>)
|
||||
|
||||
/**
|
||||
* Start a call
|
||||
* 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.
|
||||
*/
|
||||
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.
|
||||
|
@ -47,7 +50,7 @@ interface CallService {
|
|||
/**
|
||||
* Send a hangup event
|
||||
*/
|
||||
fun sendHangup(callId: String, roomId: String)
|
||||
fun hangup(callId: String, roomId: String)
|
||||
|
||||
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.
|
||||
}
|
||||
|
||||
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(
|
||||
callId = callId,
|
||||
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(
|
||||
callId = callId,
|
||||
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 sendHangup(callId: String, roomId: String) {
|
||||
override fun hangup(callId: String, roomId: String) {
|
||||
val eventContent = CallHangupContent(callId = callId)
|
||||
createEventAndLocalEcho(type = EventType.CALL_HANGUP, roomId = roomId, content = eventContent.toContent()).let { event ->
|
||||
roomEventSender.sendEvent(event)
|
||||
|
|
|
@ -304,9 +304,10 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
|||
peerConnection?.setLocalDescription(object : SdpObserverAdapter() {
|
||||
override fun onSetSuccess() {
|
||||
Timber.v("## setLocalDescription success")
|
||||
callId = UUID.randomUUID().toString()
|
||||
Timber.v("## sending offer to callId: $callId roomId: $signalingRoomId")
|
||||
sessionHolder.getActiveSession().callService().sendOfferSdp(callId ?: "", signalingRoomId
|
||||
val id = UUID.randomUUID().toString()
|
||||
callId = id
|
||||
Timber.v("## sending offer to callId: $id roomId: $signalingRoomId")
|
||||
sessionHolder.getActiveSession().callService().startCall(id, signalingRoomId
|
||||
?: "", sessionDescription, object : MatrixCallback<String> {})
|
||||
}
|
||||
}, sessionDescription)
|
||||
|
@ -449,7 +450,7 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
|||
|
||||
fun endCall() {
|
||||
if (callId != null && signalingRoomId != null) {
|
||||
sessionHolder.getActiveSession().callService().sendHangup(callId!!, signalingRoomId!!)
|
||||
sessionHolder.getActiveSession().callService().hangup(callId!!, signalingRoomId!!)
|
||||
}
|
||||
close()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue