Merge branch 'claude/add-webrtc-calls-4kBSR' of https://github.com/vitorpamplona/amethyst into claude/add-webrtc-calls-4kBSR

# Conflicts:
#	amethyst/src/main/AndroidManifest.xml
#	amethyst/src/main/java/com/vitorpamplona/amethyst/service/call/CallForegroundService.kt
#	commons/src/commonMain/kotlin/com/vitorpamplona/amethyst/commons/call/CallManager.kt
#	quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nipACWebRtcCalls/NIP-AC.md
#	quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nipACWebRtcCalls/events/CallAnswerEvent.kt
#	quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nipACWebRtcCalls/events/CallHangupEvent.kt
#	quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nipACWebRtcCalls/events/CallIceCandidateEvent.kt
#	quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nipACWebRtcCalls/events/CallOfferEvent.kt
#	quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nipACWebRtcCalls/events/CallRejectEvent.kt
#	quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nipACWebRtcCalls/events/CallRenegotiateEvent.kt
This commit is contained in:
Vitor Pamplona
2026-04-01 21:52:02 -04:00
8 changed files with 8 additions and 8 deletions
@@ -61,7 +61,7 @@ class CallManager(
companion object {
const val CALL_TIMEOUT_MS = 60_000L // 60 seconds ringing timeout
const val ENDED_DISPLAY_MS = 2_000L // show "call ended" briefly before resetting
const val MAX_EVENT_AGE_SECONDS = 30L // discard signaling events older than this
const val MAX_EVENT_AGE_SECONDS = 20L // discard signaling events older than this
}
private fun isEventTooOld(event: Event): Boolean = TimeUtils.now() - event.createdAt > MAX_EVENT_AGE_SECONDS
@@ -215,7 +215,7 @@ This NIP does not mandate specific STUN or TURN servers. Clients SHOULD:
## Implementation Notes
- The `call-id` tag MUST be a UUID that is unique per call session. All signaling events for the same call share the same `call-id`.
- Events SHOULD have short expiration times (~5 minutes) since signaling data is ephemeral and has no long-term value.
- Events SHOULD have short expiration times (~20 seconds) since signaling data is ephemeral and has no long-term value.
- Clients SHOULD implement a ringing timeout (e.g., 60 seconds). If no answer is received, the call transitions to a "timed out" state.
- Clients SHOULD use a foreground service or equivalent mechanism to keep calls active when the app is backgrounded.
- The WebRTC `PeerConnection` SHOULD use Unified Plan SDP semantics.
@@ -48,7 +48,7 @@ class CallAnswerEvent(
companion object {
const val KIND = 25051
const val ALT_DESCRIPTION = "WebRTC call answer"
const val EXPIRATION_SECONDS = 300L
const val EXPIRATION_SECONDS = 20L
fun build(
sdpAnswer: String,
@@ -48,7 +48,7 @@ class CallHangupEvent(
companion object {
const val KIND = 25053
const val ALT_DESCRIPTION = "WebRTC call hangup"
const val EXPIRATION_SECONDS = 300L
const val EXPIRATION_SECONDS = 20L
fun build(
peerPubKey: HexKey,
@@ -48,7 +48,7 @@ class CallIceCandidateEvent(
companion object {
const val KIND = 25052
const val ALT_DESCRIPTION = "WebRTC ICE candidate"
const val EXPIRATION_SECONDS = 300L
const val EXPIRATION_SECONDS = 20L
fun build(
candidateJson: String,
@@ -53,7 +53,7 @@ class CallOfferEvent(
companion object {
const val KIND = 25050
const val ALT_DESCRIPTION = "WebRTC call offer"
const val EXPIRATION_SECONDS = 300L // 5 minutes
const val EXPIRATION_SECONDS = 20L
fun build(
sdpOffer: String,
@@ -48,7 +48,7 @@ class CallRejectEvent(
companion object {
const val KIND = 25054
const val ALT_DESCRIPTION = "WebRTC call rejection"
const val EXPIRATION_SECONDS = 300L
const val EXPIRATION_SECONDS = 20L
fun build(
callerPubKey: HexKey,
@@ -48,7 +48,7 @@ class CallRenegotiateEvent(
companion object {
const val KIND = 25055
const val ALT_DESCRIPTION = "WebRTC call renegotiation"
const val EXPIRATION_SECONDS = 300L
const val EXPIRATION_SECONDS = 20L
fun build(
sdpOffer: String,