voice

package
v0.0.0-...-b2c82e1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// LastCall specifies the call id from what you want to get new calls.
	LastCall = "calls_since"
)

Functions

func RegisterHandlers

func RegisterHandlers(r *echo.Group, service Service, cService connection.Service, logger log.Logger)

RegisterHandlers sets up the routing of the HTTP handlers.

Types

type ExtCall

type ExtCall struct {
	ConnectionID string    `json:"connection_id"`
	PeerInfo     string    `json:"peer_info"`
	ID           string    `json:"id"`
	Name         string    `json:"name"`
	Status       string    `json:"status"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

type ProceedData

type ProceedData struct {
	PeerInfo string `json:"peer_info"`
	Name     string `json:"name"`
}

func (ProceedData) Validate

func (p ProceedData) Validate() *response.Error

type Repository

type Repository interface {
	// Get returns the call with the specified call ID.
	Get(ctx context.Context, appID, selfID, id string) (entity.Call, error)
	// Create saves a new call in the storage.
	Create(ctx context.Context, call *entity.Call) error
	// Update updates the call with given ID in the storage.
	Update(ctx context.Context, call entity.Call) error
	// Delete removes the call with given ID from the storage.
	Delete(ctx context.Context, appID, selfID, id string) error
	// Count returns the number of the calls records in the database.
	Count(ctx context.Context, aID, cID string, callsSince int) (int, error)
	// Query retrieves the calls records with the specified offset and limit from the database.
	Query(ctx context.Context, aID, cID string, callsSince int, offset, limit int) ([]entity.Call, error)
}

Repository encapsulates the logic to access calls from the data source.

func NewRepository

func NewRepository(db *dbcontext.DB, logger log.Logger) Repository

NewRepository creates a new call repository

type Service

type Service interface {
	Get(ctx context.Context, appID, recipient, callID string) (ExtCall, error)
	Start(ctx context.Context, appID, connectionID, callID string, data ProceedData) error
	Accept(ctx context.Context, appID, recipient, callID string, data ProceedData) error
	Busy(ctx context.Context, appID, recipient, callID string) error
	Stop(ctx context.Context, appID, recipient, callID string) error
	Setup(ctx context.Context, appID, recipient, name string) (*entity.Call, error)
	// Count returns the number of calls.
	Count(ctx context.Context, aID, cID string, callsSince int) (int, error)
	// Query returns the calls with the specified offset and limit.
	Query(ctx context.Context, aID, cID string, callsSince int, offset, limit int) ([]ExtCall, error)
}

func NewService

func NewService(repo Repository, runner support.SelfClientGetter, logger log.Logger) Service

type SetupData

type SetupData struct {
	Name string `json:"name"`
}

func (SetupData) Validate

func (p SetupData) Validate() *response.Error

Jump to

Keyboard shortcuts

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