voip

package
v1.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package voip holds the call types shared by the session manager (which drives the engine) and the webhook layer (which turns them into call.* events), so neither has to import the other.

Index

Constants

View Source
const (
	DirectionIncoming = "incoming"
	DirectionOutgoing = "outgoing"
)
View Source
const (
	KindState    = "state"
	KindEnded    = "ended"
	KindAccepted = "accepted"
	// KindVideo carries the peer's camera state in Reason: on, off, upgrade_requested.
	KindVideo = "video"
)

Kinds of StateEvent: a phase change, the single end of a call, and the moment an outgoing call is answered.

View Source
const (
	ReasonMissed            = "missed"
	ReasonRejected          = "rejected"
	ReasonRejectedElsewhere = "rejected_elsewhere"
	ReasonAcceptedElsewhere = "accepted_elsewhere"
	ReasonCancelled         = "cancelled"
	ReasonHangup            = "hangup"
	ReasonGroupCallEnded    = "group_call_ended"
)

Normalized end reasons, so consumers do not parse WhatsApp's own strings.

Variables

View Source
var (
	ErrCallsDisabled = errors.New("chamadas desativadas nesta instância")
	ErrCallNotFound  = errors.New("chamada não encontrada")

	ErrMediaClosed        = errors.New("ponte de mídia encerrada")
	ErrInvalidVideoAction = errors.New("ação de vídeo inválida: use start, accept, stop, pause ou resume")
)

Functions

This section is empty.

Types

type Call

type Call struct {
	ID        string    `json:"callId"`
	Peer      string    `json:"peer"`
	Direction string    `json:"direction"`
	State     string    `json:"state"`
	StartedAt time.Time `json:"startedAt"`
	IsVideo   bool      `json:"isVideo"`
	// GroupJID is set when the call was started from a group chat.
	GroupJID string `json:"groupJid,omitempty"`
}

Call is the public snapshot of a call the engine is tracking.

type MediaBridge added in v1.5.0

type MediaBridge interface {
	// SendAudio queues PCM16LE mono 16 kHz audio, in any chunk size.
	SendAudio(pcm []byte)
	// SendVideo sends one Annex-B H.264 access unit.
	SendVideo(accessUnit []byte) error
	// SetOrientation announces this side's camera rotation, in quarter turns clockwise.
	SetOrientation(quarterTurns int) error
	Close()
}

MediaBridge carries one call's media to a consumer (see the /calls/:callId/media route).

type StateEvent

type StateEvent struct {
	Call
	Kind   string `json:"kind"`
	Reason string `json:"reason,omitempty"`
}

StateEvent is what the engine reports about a tracked call. On instances with the engine it is the only source of call.state, call.accepted and call.ended, each end emitted once per call.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL