siptest

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2025 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(id string, conf ClientConfig) (*Client, error)

func (*Client) Close

func (c *Client) Close()

func (*Client) Dial

func (c *Client) Dial(ip string, host string, number string, headers map[string]string) error

func (*Client) LocalIP

func (c *Client) LocalIP() string

func (*Client) Record

func (c *Client) Record(w io.WriteCloser)

func (*Client) RemoteHeaders

func (c *Client) RemoteHeaders() []sip.Header

func (*Client) SendAudio

func (c *Client) SendAudio(path string) error

Sends PCM audio from a webm file

func (*Client) SendDTMF

func (c *Client) SendDTMF(digits string) error

func (*Client) SendNotify

func (c *Client) SendNotify(eventReq *sip.Request, notifyStatus string) error

func (*Client) SendSignal

func (c *Client) SendSignal(ctx context.Context, n int, val int) error

SendSignal generate an audio signal with a given value. It repeats the signal n times, each frame containing one signal. If n <= 0, it will send the signal until the context is cancelled.

func (*Client) SendSilence

func (c *Client) SendSilence(ctx context.Context) error

func (*Client) WaitSignals

func (c *Client) WaitSignals(ctx context.Context, vals []int, w io.WriteCloser) error

WaitSignals waits for an audio frame to contain all signals.

type ClientConfig

type ClientConfig struct {
	IP             netip.Addr
	Port           uint16
	Number         string
	AuthUser       string
	AuthPass       string
	Log            *slog.Logger
	OnBye          func()
	OnMediaTimeout func()
	OnDTMF         func(ev dtmf.Event)
	OnRefer        func(req *sip.Request)
	Codec          string
}

Jump to

Keyboard shortcuts

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