diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/call/CallAnswerContent.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/call/CallAnswerContent.kt index 24eb68bd78..f9f9cf15b2 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/call/CallAnswerContent.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/call/CallAnswerContent.kt @@ -19,16 +19,34 @@ package im.vector.matrix.android.api.session.room.model.call import com.squareup.moshi.Json import com.squareup.moshi.JsonClass +/** + * This event is sent by the callee when they wish to answer the call. + */ @JsonClass(generateAdapter = true) data class CallAnswerContent( + /** + * Required. The ID of the call this event relates to. + */ @Json(name = "call_id") val callId: String, - @Json(name = "version") val version: Int, - @Json(name = "answer") val answer: Answer + /** + * Required. The session description object + */ + @Json(name = "answer") val answer: Answer, + /** + * Required. The version of the VoIP specification this messages adheres to. This specification is version 0. + */ + @Json(name = "version") val version: Int ) { @JsonClass(generateAdapter = true) data class Answer( + /** + * Required. The type of session description. Must be 'answer'. + */ @Json(name = "type") val type: String, + /** + * Required. The SDP text of the session description. + */ @Json(name = "sdp") val sdp: String ) } diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/call/CallCandidatesContent.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/call/CallCandidatesContent.kt index 5fb4db84a3..1375776919 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/call/CallCandidatesContent.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/call/CallCandidatesContent.kt @@ -19,17 +19,39 @@ package im.vector.matrix.android.api.session.room.model.call import com.squareup.moshi.Json import com.squareup.moshi.JsonClass +/** + * This event is sent by callers after sending an invite and by the callee after answering. + * Its purpose is to give the other party additional ICE candidates to try using to communicate. + */ @JsonClass(generateAdapter = true) data class CallCandidatesContent( + /** + * Required. The ID of the call this event relates to. + */ @Json(name = "call_id") val callId: String, - @Json(name = "version") val version: Int, - @Json(name = "candidates") val candidates: List = emptyList() + /** + * Required. Array of objects describing the candidates. + */ + @Json(name = "candidates") val candidates: List = emptyList(), + /** + * Required. The version of the VoIP specification this messages adheres to. This specification is version 0. + */ + @Json(name = "version") val version: Int ) { @JsonClass(generateAdapter = true) data class Candidate( + /** + * Required. The SDP media type this candidate is intended for. + */ @Json(name = "sdpMid") val sdpMid: String, + /** + * Required. The index of the SDP 'm' line this candidate is intended for. + */ @Json(name = "sdpMLineIndex") val sdpMLineIndex: String, + /** + * Required. The SDP 'a' line of the candidate. + */ @Json(name = "candidate") val candidate: String ) } diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/call/CallHangupContent.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/call/CallHangupContent.kt index eda2486aa2..c17efd2559 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/call/CallHangupContent.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/call/CallHangupContent.kt @@ -19,8 +19,24 @@ package im.vector.matrix.android.api.session.room.model.call import com.squareup.moshi.Json import com.squareup.moshi.JsonClass +/** + * Sent by either party to signal their termination of the call. This can be sent either once + * the call has been established or before to abort the call. + */ @JsonClass(generateAdapter = true) data class CallHangupContent( + /** + * Required. The ID of the call this event relates to. + */ @Json(name = "call_id") val callId: String, - @Json(name = "version") val version: Int + /** + * Required. The version of the VoIP specification this message adheres to. This specification is version 0. + */ + @Json(name = "version") val version: Int, + /** + * Optional error reason for the hangup. This should not be provided when the user naturally ends or rejects the call. + * When there was an error in the call negotiation, this should be `ice_failed` for when ICE negotiation fails + * or `invite_timeout` for when the other party did not answer in time. One of: ["ice_failed", "invite_timeout"] + */ + @Json(name = "reason") val reason: String? ) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/call/CallInviteContent.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/call/CallInviteContent.kt index 44c3cfbf0b..cd0df70c96 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/call/CallInviteContent.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/call/CallInviteContent.kt @@ -19,37 +19,38 @@ package im.vector.matrix.android.api.session.room.model.call import com.squareup.moshi.Json import com.squareup.moshi.JsonClass +/** + * This event is sent by the caller when they wish to establish a call. + */ @JsonClass(generateAdapter = true) data class CallInviteContent( - /** - * A unique identifier for the call. + * Required. A unique identifier for the call. */ @Json(name = "call_id") val callId: String?, /** - * The session description object + * Required. The session description object */ @Json(name = "version") val version: Int?, /** - * The version of the VoIP specification this message adheres to. This specification is version 0. + * Required. The version of the VoIP specification this message adheres to. This specification is version 0. */ @Json(name = "lifetime") val lifetime: Int?, /** - * The time in milliseconds that the invite is valid for. - * Once the invite age exceeds this value, clients should discard it. - * They should also no longer show the call as awaiting an answer in the UI. + * Required. The time in milliseconds that the invite is valid for. + * Once the invite age exceeds this value, clients should discard it. + * They should also no longer show the call as awaiting an answer in the UI. */ @Json(name = "offer") val offer: Offer? ) { - @JsonClass(generateAdapter = true) data class Offer( /** - * The type of session description (offer, answer) + * Required. The type of session description. Must be 'offer'. */ @Json(name = "type") val type: String?, /** - * The SDP text of the session description. + * Required. The SDP text of the session description. */ @Json(name = "sdp") val sdp: String? ) { diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/call/DefaultCallService.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/call/DefaultCallService.kt index abc17cf89c..7b0731d8a8 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/call/DefaultCallService.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/call/DefaultCallService.kt @@ -130,7 +130,8 @@ internal class DefaultCallService @Inject constructor( override fun sendHangup(callId: String, roomId: String) { val eventContent = CallHangupContent( callId = callId, - version = 0 + version = 0, + reason = null ) createEventAndLocalEcho(type = EventType.CALL_HANGUP, roomId = roomId, content = eventContent.toContent()).let { event -> roomEventSender.sendEvent(event)