Documentation
¶
Index ¶
- Variables
- func NewConnRecorder() *connRecorder
- type AnswerOptions
- type AudioPlayback
- type AudioPlaybackControl
- type AudioReaderOption
- type AudioRingtone
- type AudioStereoRecordingWav
- type AudioWriterOption
- type Bridge
- type Bridger
- type DTMFReader
- type DTMFWriter
- type Diago
- func (dg *Diago) DialogCacheClient() DialogCache[*DialogClientSession]
- func (dg *Diago) DialogCacheServer() DialogCache[*DialogServerSession]
- func (dg *Diago) HandleFunc(f ServeDialogFunc)
- func (dg *Diago) Invite(ctx context.Context, recipient sip.Uri, opts InviteOptions) (d *DialogClientSession, err error)
- func (dg *Diago) InviteBridge(ctx context.Context, recipient sip.Uri, bridge *Bridge, opts InviteOptions) (d *DialogClientSession, err error)
- func (dg *Diago) NewDialog(recipient sip.Uri, opts NewDialogOptions) (d *DialogClientSession, err error)
- func (dg *Diago) Register(ctx context.Context, recipient sip.Uri, opts RegisterOptions) error
- func (dg *Diago) RegisterTransaction(ctx context.Context, recipient sip.Uri, opts RegisterOptions) (*RegisterTransaction, error)
- func (dg *Diago) Serve(ctx context.Context, f ServeDialogFunc) error
- func (dg *Diago) ServeBackground(ctx context.Context, f ServeDialogFunc) error
- type DiagoOption
- func WithAuth(auth sipgo.DigestAuth) DiagoOption
- func WithClient(client *sipgo.Client) DiagoOption
- func WithLogger(l *slog.Logger) DiagoOption
- func WithMediaConfig(conf MediaConfig) DiagoOption
- func WithServer(srv *sipgo.Server) DiagoOption
- func WithServerRequestMiddleware(f func(next sipgo.RequestHandler) sipgo.RequestHandler) DiagoOption
- func WithTransport(t Transport) DiagoOption
- type DialogCache
- type DialogCachePool
- type DialogClientSession
- func (d *DialogClientSession) Ack(ctx context.Context) error
- func (d *DialogClientSession) Close() error
- func (d *DialogClientSession) DialogSIP() *sipgo.Dialog
- func (d *DialogClientSession) FromUser() string
- func (d *DialogClientSession) Hangup(ctx context.Context) error
- func (d *DialogClientSession) Id() string
- func (d *DialogClientSession) Invite(ctx context.Context, opts InviteClientOptions) error
- func (d *DialogClientSession) ReInvite(ctx context.Context) error
- func (d *DialogClientSession) Refer(ctx context.Context, referTo sip.Uri, headers ...sip.Header) error
- func (d *DialogClientSession) ReferOptions(ctx context.Context, referTo sip.Uri, opts ReferClientOptions) error
- func (d *DialogClientSession) RemoteContact() *sip.ContactHeader
- func (d *DialogClientSession) ToUser() string
- func (d *DialogClientSession) WaitAnswer(ctx context.Context, opts sipgo.AnswerOptions) error
- type DialogData
- type DialogMedia
- func (d *DialogMedia) AudioReader(opts ...AudioReaderOption) (io.Reader, error)
- func (m *DialogMedia) AudioReaderDTMF() *DTMFReader
- func (d *DialogMedia) AudioStereoRecordingCreate(wawFile *os.File) (AudioStereoRecordingWav, error)
- func (d *DialogMedia) AudioWriter(opts ...AudioWriterOption) (io.Writer, error)
- func (m *DialogMedia) AudioWriterDTMF() *DTMFWriter
- func (d *DialogMedia) Close() error
- func (d *DialogMedia) Echo() error
- func (d *DialogMedia) InitMediaSession(m *media.MediaSession, r *media.RTPPacketReader, w *media.RTPPacketWriter)
- func (d *DialogMedia) Listen() (err error)
- func (d *DialogMedia) ListenBackground() (stop func() error, err error)
- func (d *DialogMedia) ListenContext(pctx context.Context) error
- func (d *DialogMedia) ListenUntil(dur time.Duration) error
- func (d *DialogMedia) Media() *DialogMedia
- func (d *DialogMedia) MediaSession() *media.MediaSession
- func (d *DialogMedia) OnClose(f func() error)
- func (d *DialogMedia) PlaybackControlCreate() (AudioPlaybackControl, error)
- func (d *DialogMedia) PlaybackCreate() (AudioPlayback, error)
- func (d *DialogMedia) PlaybackRingtoneCreate() (AudioRingtone, error)
- func (d *DialogMedia) RTPSession() *media.RTPSession
- func (d *DialogMedia) SetAudioReader(r io.Reader)
- func (d *DialogMedia) SetAudioWriter(r io.Writer)
- func (d *DialogMedia) StartRTP(rw int8, dur time.Duration) error
- func (d *DialogMedia) StopRTP(rw int8, dur time.Duration) error
- type DialogServerSession
- func (d *DialogServerSession) Answer() error
- func (d *DialogServerSession) AnswerLate() error
- func (d *DialogServerSession) AnswerOptions(opt AnswerOptions) error
- func (d *DialogServerSession) Close() error
- func (d *DialogServerSession) DialogSIP() *sipgo.Dialog
- func (d *DialogServerSession) FromUser() string
- func (d *DialogServerSession) Hangup(ctx context.Context) error
- func (d *DialogServerSession) Id() string
- func (d *DialogServerSession) Progress() errordeprecated
- func (d *DialogServerSession) ProgressMedia() error
- func (d *DialogServerSession) ProgressMediaOptions(opt ProgressMediaOptions) error
- func (d *DialogServerSession) ReInvite(ctx context.Context) error
- func (d *DialogServerSession) ReadAck(req *sip.Request, tx sip.ServerTransaction) error
- func (d *DialogServerSession) Refer(ctx context.Context, referTo sip.Uri, headers ...sip.Header) error
- func (d *DialogServerSession) ReferOptions(ctx context.Context, referTo sip.Uri, opts ReferServerOptions) error
- func (d *DialogServerSession) RemoteContact() *sip.ContactHeader
- func (d *DialogServerSession) RespondSDP(body []byte) error
- func (d *DialogServerSession) Ringing() error
- func (d *DialogServerSession) ToUser() string
- func (d *DialogServerSession) Transport() string
- func (d *DialogServerSession) Trying() error
- type DialogSession
- type DigestAuth
- type DigestAuthServer
- type InviteClientOptions
- type InviteOptions
- type MediaConfig
- type MediaProps
- type NewDialogOptions
- type OnReferDialogFunc
- type ProgressMediaOptions
- type ReferClientOptions
- type ReferServerOptions
- type RegisterOptions
- type RegisterResponseError
- type RegisterTransaction
- type ServeDialogFunc
- type Transport
Constants ¶
This section is empty.
Variables ¶
var ( HTTPDebug = os.Getenv("HTTP_DEBUG") == "true" DefaultPlaybackHTTPClient = http.Client{ Timeout: 20 * time.Second, } )
var ( ErrDigestAuthNoChallenge = errors.New("no challenge") ErrDigestAuthBadCreds = errors.New("bad credentials") )
var (
DefaultPlaybackURLRangeSize int = 65536
)
var (
ErrClientEarlyMedia = errors.New("Early media detected")
)
var (
PlaybackBufferSize = 3840 // For now largest we support. 48000 sample rate with 2 channels
)
Functions ¶
func NewConnRecorder ¶ added in v0.3.0
func NewConnRecorder() *connRecorder
Types ¶
type AnswerOptions ¶ added in v0.4.0
type AnswerOptions struct {
// OnMediaUpdate triggers when media update happens. It is blocking func, so make sure you exit
OnMediaUpdate func(d *DialogMedia)
// OnRefer is called on successfull REFER handling
//
// It creates new dialog (NewDialog) on which you need to call Invite() and Ack()
// Any error from invite, ack or other processing should be returned for correct Notify handling
//
// NOTE: IT is SCOPED to handler and exiting handler will Close/Terminate this dialog!
OnRefer func(referDialog *DialogClientSession) error
// Codecs that will be used
Codecs []media.Codec
// RTPNAT is media.MediaSession.RTPNAT
// Check media.RTPNAT... options
RTPNAT int
}
type AudioPlayback ¶
type AudioPlayback struct {
// Read only values
// This will influence playout sampling buffer
BitDepth int
NumChannels int
// contains filtered or unexported fields
}
func NewAudioPlayback ¶
func NewAudioPlayback(writer io.Writer, codec media.Codec) AudioPlayback
NewAudioPlayback creates a playback where writer is encoder/streamer to media codec Use dialog.PlaybackCreate() instead creating manually playback
func (*AudioPlayback) Codec ¶ added in v0.21.0
func (p *AudioPlayback) Codec() media.Codec
func (*AudioPlayback) Play ¶
Play is generic approach to play supported audio contents Empty mimeType will stream reader as buffer. Make sure that bitdepth and numchannels is set correctly
type AudioPlaybackControl ¶
type AudioPlaybackControl struct {
AudioPlayback
// contains filtered or unexported fields
}
func NewAudioPlaybackControl ¶ added in v0.26.1
func NewAudioPlaybackControl(a AudioPlayback) AudioPlaybackControl
func (*AudioPlaybackControl) Mute ¶
func (p *AudioPlaybackControl) Mute(mute bool)
func (*AudioPlaybackControl) Stop ¶ added in v0.1.1
func (p *AudioPlaybackControl) Stop()
type AudioReaderOption ¶ added in v0.1.1
type AudioReaderOption func(d *DialogMedia) error
func WithAudioReaderDTMF ¶ added in v0.14.0
func WithAudioReaderDTMF(r *DTMFReader) AudioReaderOption
WithAudioReaderDTMF creates DTMF interceptor
func WithAudioReaderMediaProps ¶ added in v0.1.1
func WithAudioReaderMediaProps(p *MediaProps) AudioReaderOption
func WithAudioReaderRTPStats ¶ added in v0.10.0
func WithAudioReaderRTPStats(hook media.OnRTPReadStats) AudioReaderOption
WithAudioReaderRTPStats creates RTP Statistics interceptor on audio reader
type AudioRingtone ¶ added in v0.19.0
type AudioRingtone struct {
// contains filtered or unexported fields
}
AudioRingtone is playback for ringtone
func (*AudioRingtone) Play ¶ added in v0.19.0
func (a *AudioRingtone) Play(ctx context.Context) error
func (*AudioRingtone) PlayBackground ¶ added in v0.19.0
func (a *AudioRingtone) PlayBackground() (func() error, error)
type AudioStereoRecordingWav ¶ added in v0.17.0
type AudioStereoRecordingWav struct {
// contains filtered or unexported fields
}
func (*AudioStereoRecordingWav) AudioReader ¶ added in v0.17.0
func (r *AudioStereoRecordingWav) AudioReader() *audio.MonitorPCMStereo
func (*AudioStereoRecordingWav) AudioWriter ¶ added in v0.17.0
func (r *AudioStereoRecordingWav) AudioWriter() *audio.MonitorPCMStereo
func (*AudioStereoRecordingWav) Close ¶ added in v0.17.0
func (r *AudioStereoRecordingWav) Close() error
type AudioWriterOption ¶ added in v0.1.1
type AudioWriterOption func(d *DialogMedia) error
func WithAudioWriterDTMF ¶ added in v0.14.0
func WithAudioWriterDTMF(r *DTMFWriter) AudioWriterOption
WithAudioWriterDTMF creates DTMF interceptor
func WithAudioWriterMediaProps ¶ added in v0.1.1
func WithAudioWriterMediaProps(p *MediaProps) AudioWriterOption
func WithAudioWriterRTPStats ¶ added in v0.10.0
func WithAudioWriterRTPStats(hook media.OnRTPWriteStats) AudioWriterOption
WithAudioReaderRTPStats creates RTP Statistics interceptor on audio reader
type Bridge ¶
type Bridge struct {
// Originator is dialog session that created bridge
Originator DialogSession
// DTMFpass is also dtmf pipeline and proxy. By default only audio media is proxied
// NOTE: this may not work if you are already processing DTMF with AudioReaderDTMF
DTMFpass bool
// minDialogs is just helper flag when to start proxy
WaitDialogsNum int
// contains filtered or unexported fields
}
func (*Bridge) AddDialogSession ¶
func (b *Bridge) AddDialogSession(d DialogSession) error
func (*Bridge) GetDialogs ¶
func (b *Bridge) GetDialogs() []DialogSession
func (*Bridge) ProxyMedia ¶ added in v0.19.0
ProxyMedia is explicit starting proxy media. In some cases you want to control and be signaled when bridge terminates
NOTE: Should be only called if you want to start manually proxying. It is required to set WaitDialogsNum higher than 2
Experimental
func (*Bridge) ProxyMediaControl ¶ added in v0.19.0
ProxyMediaControl starts proxy in background and allows to stop proxy at any time. Stop should be called once and it is not needed to be called if call is terminating
Experimental
type Bridger ¶
type Bridger interface {
AddDialogSession(d DialogSession) error
}
type DTMFReader ¶ added in v0.1.1
type DTMFReader struct {
// contains filtered or unexported fields
}
func (*DTMFReader) OnDTMF ¶ added in v0.8.0
func (d *DTMFReader) OnDTMF(onDTMF func(dtmf rune) error)
OnDTMF must be called before audio reading
type DTMFWriter ¶ added in v0.1.1
type DTMFWriter struct {
// contains filtered or unexported fields
}
func (*DTMFWriter) AudioWriter ¶ added in v0.8.0
func (w *DTMFWriter) AudioWriter() *media.RTPDtmfWriter
AudioReader exposes DTMF audio writer. You should use this for parallel audio processing
func (*DTMFWriter) Write ¶ added in v0.8.0
func (w *DTMFWriter) Write(buf []byte) (n int, err error)
Write exposes as io.Writer that can be used as AudioWriter
func (*DTMFWriter) WriteDTMF ¶ added in v0.1.1
func (w *DTMFWriter) WriteDTMF(dtmf rune) error
type Diago ¶
type Diago struct {
// contains filtered or unexported fields
}
func NewDiago ¶
func NewDiago(ua *sipgo.UserAgent, opts ...DiagoOption) *Diago
NewDiago construct b2b user agent that will act as server and client
func (*Diago) DialogCacheClient ¶ added in v0.15.0
func (dg *Diago) DialogCacheClient() DialogCache[*DialogClientSession]
func (*Diago) DialogCacheServer ¶ added in v0.15.0
func (dg *Diago) DialogCacheServer() DialogCache[*DialogServerSession]
func (*Diago) HandleFunc ¶ added in v0.5.0
func (dg *Diago) HandleFunc(f ServeDialogFunc)
HandleFunc registers you handler function for dialog. Must be called before serving request
func (*Diago) Invite ¶
func (dg *Diago) Invite(ctx context.Context, recipient sip.Uri, opts InviteOptions) (d *DialogClientSession, err error)
Invite makes outgoing call leg and waits for answer. It is helper that calls - NewDialog - dialog.Invite
For better control more details use above functions instead. If you want to bridge call then use helper InviteBridge
func (*Diago) InviteBridge ¶
func (dg *Diago) InviteBridge(ctx context.Context, recipient sip.Uri, bridge *Bridge, opts InviteOptions) (d *DialogClientSession, err error)
InviteBridge makes outgoing call leg and does bridging. Outgoing session will be added into bridge on answer If bridge has Originator (first participant) it will be used for creating outgoing call leg as in B2BUA When bridge is provided then this call will be bridged with any participant already present in bridge
func (*Diago) NewDialog ¶ added in v0.14.0
func (dg *Diago) NewDialog(recipient sip.Uri, opts NewDialogOptions) (d *DialogClientSession, err error)
NewDialog creates a new client dialog session after you can perform dialog Invite - You call Invite(...) after this call followed with ACK
func (*Diago) Register ¶
Register will create register transaction and keep registration ongoing until error is hit. For more granular control over registrations use RegisterTransaction
func (*Diago) RegisterTransaction ¶ added in v0.3.0
func (dg *Diago) RegisterTransaction(ctx context.Context, recipient sip.Uri, opts RegisterOptions) (*RegisterTransaction, error)
Register transaction creates register transaction object that can be used for Register Unregister requests
func (*Diago) Serve ¶
func (dg *Diago) Serve(ctx context.Context, f ServeDialogFunc) error
Serve starts 'Server' handle for SIP. Should be called for UAS but can be skipped for UAC behavior
func (*Diago) ServeBackground ¶
func (dg *Diago) ServeBackground(ctx context.Context, f ServeDialogFunc) error
ServeBackground starts serving in background, but waits server listener to be started before returning Checkout more info on Serve()
type DiagoOption ¶
type DiagoOption func(dg *Diago)
func WithAuth ¶
func WithAuth(auth sipgo.DigestAuth) DiagoOption
func WithClient ¶ added in v0.3.0
func WithClient(client *sipgo.Client) DiagoOption
WithClient allows providing custom client handle. Consider still it needs to use same UA as diago
func WithLogger ¶ added in v0.8.0
func WithLogger(l *slog.Logger) DiagoOption
func WithMediaConfig ¶
func WithMediaConfig(conf MediaConfig) DiagoOption
func WithServer ¶
func WithServer(srv *sipgo.Server) DiagoOption
WithServer allows providing custom server handle. Consider still it needs to use same UA as diago
func WithServerRequestMiddleware ¶ added in v0.22.0
func WithServerRequestMiddleware(f func(next sipgo.RequestHandler) sipgo.RequestHandler) DiagoOption
func WithTransport ¶
func WithTransport(t Transport) DiagoOption
type DialogCache ¶ added in v0.1.1
type DialogCachePool ¶ added in v0.15.0
type DialogCachePool struct {
// contains filtered or unexported fields
}
func (*DialogCachePool) MatchDialog ¶ added in v0.15.0
func (p *DialogCachePool) MatchDialog(req *sip.Request) (*DialogServerSession, *DialogClientSession, error)
func (*DialogCachePool) MatchDialogClient ¶ added in v0.15.0
func (p *DialogCachePool) MatchDialogClient(req *sip.Request) (*DialogClientSession, error)
func (*DialogCachePool) MatchDialogServer ¶ added in v0.15.0
func (p *DialogCachePool) MatchDialogServer(req *sip.Request) (*DialogServerSession, error)
type DialogClientSession ¶
type DialogClientSession struct {
*sipgo.DialogClientSession
DialogMedia
// contains filtered or unexported fields
}
DialogClientSession represents outbound channel
func (*DialogClientSession) Ack ¶ added in v0.14.0
func (d *DialogClientSession) Ack(ctx context.Context) error
Ack acknowledgeds media Before Ack normally you want to setup more stuff like bridging
func (*DialogClientSession) Close ¶
func (d *DialogClientSession) Close() error
func (*DialogClientSession) DialogSIP ¶
func (d *DialogClientSession) DialogSIP() *sipgo.Dialog
func (*DialogClientSession) FromUser ¶
func (d *DialogClientSession) FromUser() string
func (*DialogClientSession) Hangup ¶
func (d *DialogClientSession) Hangup(ctx context.Context) error
func (*DialogClientSession) Id ¶
func (d *DialogClientSession) Id() string
func (*DialogClientSession) Invite ¶ added in v0.14.0
func (d *DialogClientSession) Invite(ctx context.Context, opts InviteClientOptions) error
Invite sends Invite request and establishes [early] media. Normally you need to call Ack after.
Normal Answer with 200 OK (SDP) - You MUST call Ack() after to acknowledge session.
Early Media Detect: - It RETURNS ErrClientEarlyMedia if remote answers with 183 Session in Progress - Media is negotiated and setuped - You need to call WaitAnswer() if you want to proceed with answering call
Errors: - sipgo.ErrDialogResponse - ErrClientEarlyMedia
NOTE: It updates internal invite request so NOT THREAD SAFE. If you pass originator it will use originator to set correct from header and avoid media transcoding
Experimental: Note API may have changes
func (*DialogClientSession) ReInvite ¶
func (d *DialogClientSession) ReInvite(ctx context.Context) error
ReInvite sends new invite based on current media session
func (*DialogClientSession) Refer ¶ added in v0.14.0
func (d *DialogClientSession) Refer(ctx context.Context, referTo sip.Uri, headers ...sip.Header) error
Refer tries todo refer (blind transfer) on call. For more control use ReferOptions
NOTE: It is expected that after calling this you are hanguping call to send BYE
func (*DialogClientSession) ReferOptions ¶ added in v0.27.0
func (d *DialogClientSession) ReferOptions(ctx context.Context, referTo sip.Uri, opts ReferClientOptions) error
func (*DialogClientSession) RemoteContact ¶
func (d *DialogClientSession) RemoteContact() *sip.ContactHeader
func (*DialogClientSession) ToUser ¶
func (d *DialogClientSession) ToUser() string
func (*DialogClientSession) WaitAnswer ¶ added in v0.18.0
func (d *DialogClientSession) WaitAnswer(ctx context.Context, opts sipgo.AnswerOptions) error
WaitAnswer waits dialog on answer. It should only be used if you have error Invite but still want to continue ex. ErrClientEarlyMedia was returned but you want to proceed with answering
type DialogData ¶
type DialogData struct {
InviteRequest sip.Request
State sip.DialogState
}
type DialogMedia ¶
type DialogMedia struct {
// Packet reader is default reader for RTP audio stream
// Use always AudioReader to get current Audio reader
// Use this only as read only
// It MUST be always created on Media Session Init
// Only safe to use after dialog Answered (Completed state)
RTPPacketReader *media.RTPPacketReader
// Packet writer is default writer for RTP audio stream
// Use always AudioWriter to get current Audio reader
// Use this only as read only
RTPPacketWriter *media.RTPPacketWriter
// contains filtered or unexported fields
}
DialogMedia is common struct for server and client session and it shares same functionality which is mostly arround media
func (*DialogMedia) AudioReader ¶
func (d *DialogMedia) AudioReader(opts ...AudioReaderOption) (io.Reader, error)
AudioReader gets current audio reader. It MUST be called after Answer. Use AuidioListen for optimized reading. Reading buffer should be equal or bigger of media.RTPBufSize Options allow more intercepting audio reading like Stats or DTMF NOTE that this interceptors will stay,
func (*DialogMedia) AudioReaderDTMF ¶ added in v0.1.1
func (m *DialogMedia) AudioReaderDTMF() *DTMFReader
AudioReaderDTMF is DTMF over RTP. It reads audio and provides hook for dtmf while listening for audio Use Listen or OnDTMF after this call
func (*DialogMedia) AudioStereoRecordingCreate ¶ added in v0.17.0
func (d *DialogMedia) AudioStereoRecordingCreate(wawFile *os.File) (AudioStereoRecordingWav, error)
AudioStereoRecordingCreate creates Stereo Recording audio Pipeline and stores as Wav file format For audio to be recorded use AudioReader and AudioWriter from Recording
Tips: If you want to make permanent in audio pipeline use SetAudioReader, SetAudioWriter
NOTE: API WILL change
func (*DialogMedia) AudioWriter ¶
func (d *DialogMedia) AudioWriter(opts ...AudioWriterOption) (io.Writer, error)
func (*DialogMedia) AudioWriterDTMF ¶ added in v0.1.1
func (m *DialogMedia) AudioWriterDTMF() *DTMFWriter
func (*DialogMedia) Close ¶ added in v0.1.1
func (d *DialogMedia) Close() error
func (*DialogMedia) Echo ¶ added in v0.13.0
func (d *DialogMedia) Echo() error
Echo does audio echo for you
func (*DialogMedia) InitMediaSession ¶
func (d *DialogMedia) InitMediaSession(m *media.MediaSession, r *media.RTPPacketReader, w *media.RTPPacketWriter)
func (*DialogMedia) Listen ¶
func (d *DialogMedia) Listen() (err error)
Listen keeps reading stream until it gets closed or deadlined Use ListenBackground or ListenContext for better control
func (*DialogMedia) ListenBackground ¶ added in v0.18.0
func (d *DialogMedia) ListenBackground() (stop func() error, err error)
ListenBackground listens on stream in background and allows correct stoping of stream on network layer
func (*DialogMedia) ListenContext ¶ added in v0.1.1
func (d *DialogMedia) ListenContext(pctx context.Context) error
ListenContext listens until context is canceled.
func (*DialogMedia) ListenUntil ¶ added in v0.1.1
func (d *DialogMedia) ListenUntil(dur time.Duration) error
func (*DialogMedia) Media ¶
func (d *DialogMedia) Media() *DialogMedia
func (*DialogMedia) MediaSession ¶
func (d *DialogMedia) MediaSession() *media.MediaSession
func (*DialogMedia) OnClose ¶ added in v0.1.1
func (d *DialogMedia) OnClose(f func() error)
func (*DialogMedia) PlaybackControlCreate ¶
func (d *DialogMedia) PlaybackControlCreate() (AudioPlaybackControl, error)
PlaybackControlCreate creates playback for audio with controls like mute unmute
func (*DialogMedia) PlaybackCreate ¶
func (d *DialogMedia) PlaybackCreate() (AudioPlayback, error)
PlaybackCreate creates playback for audio
func (*DialogMedia) PlaybackRingtoneCreate ¶ added in v0.19.0
func (d *DialogMedia) PlaybackRingtoneCreate() (AudioRingtone, error)
PlaybackRingtoneCreate is creating playback for ringtone
Experimental
func (*DialogMedia) RTPSession ¶ added in v0.8.0
func (d *DialogMedia) RTPSession() *media.RTPSession
RTPSession returns underhood rtp session NOTE: this can be nil
func (*DialogMedia) SetAudioReader ¶
func (d *DialogMedia) SetAudioReader(r io.Reader)
SetAudioReader adds/changes audio reader. Use this when you want to have interceptors of your audio
func (*DialogMedia) SetAudioWriter ¶
func (d *DialogMedia) SetAudioWriter(r io.Writer)
SetAudioWriter adds/changes audio reader. Use this when you want to have pipelines of your audio
type DialogServerSession ¶
type DialogServerSession struct {
*sipgo.DialogServerSession
// MediaSession *media.MediaSession
DialogMedia
// contains filtered or unexported fields
}
DialogServerSession represents inbound channel
func (*DialogServerSession) Answer ¶
func (d *DialogServerSession) Answer() error
Answer creates media session and answers After this new AudioReader and AudioWriter are created for audio manipulation NOTE: Not final API
func (*DialogServerSession) AnswerLate ¶ added in v0.11.0
func (d *DialogServerSession) AnswerLate() error
AnswerLate does answer with Late offer.
func (*DialogServerSession) AnswerOptions ¶ added in v0.4.0
func (d *DialogServerSession) AnswerOptions(opt AnswerOptions) error
AnswerOptions allows to answer dialog with options Experimental
NOTE: API may change
func (*DialogServerSession) Close ¶
func (d *DialogServerSession) Close() error
func (*DialogServerSession) DialogSIP ¶
func (d *DialogServerSession) DialogSIP() *sipgo.Dialog
func (*DialogServerSession) FromUser ¶
func (d *DialogServerSession) FromUser() string
func (*DialogServerSession) Hangup ¶
func (d *DialogServerSession) Hangup(ctx context.Context) error
func (*DialogServerSession) Id ¶
func (d *DialogServerSession) Id() string
func (*DialogServerSession) Progress
deprecated
func (d *DialogServerSession) Progress() error
Progress sends 100 trying.
Deprecated: Use Trying. It will change behavior to 183 Sesion Progress in future releases
func (*DialogServerSession) ProgressMedia ¶ added in v0.18.0
func (d *DialogServerSession) ProgressMedia() error
ProgressMedia sends 183 Session Progress and creates early media
Experimental: Naming of API might change
func (*DialogServerSession) ProgressMediaOptions ¶ added in v0.23.0
func (d *DialogServerSession) ProgressMediaOptions(opt ProgressMediaOptions) error
func (*DialogServerSession) ReInvite ¶
func (d *DialogServerSession) ReInvite(ctx context.Context) error
func (*DialogServerSession) ReadAck ¶ added in v0.11.0
func (d *DialogServerSession) ReadAck(req *sip.Request, tx sip.ServerTransaction) error
func (*DialogServerSession) Refer ¶ added in v0.3.0
func (d *DialogServerSession) Refer(ctx context.Context, referTo sip.Uri, headers ...sip.Header) error
Refer tries todo refer (blind transfer) on call. For more control use ReferOptions
NOTE: It is expected that after calling this you are hanguping call to send BYE
func (*DialogServerSession) ReferOptions ¶ added in v0.27.0
func (d *DialogServerSession) ReferOptions(ctx context.Context, referTo sip.Uri, opts ReferServerOptions) error
func (*DialogServerSession) RemoteContact ¶
func (d *DialogServerSession) RemoteContact() *sip.ContactHeader
func (*DialogServerSession) RespondSDP ¶
func (d *DialogServerSession) RespondSDP(body []byte) error
func (*DialogServerSession) Ringing ¶
func (d *DialogServerSession) Ringing() error
func (*DialogServerSession) ToUser ¶
func (d *DialogServerSession) ToUser() string
User that was dialed
func (*DialogServerSession) Transport ¶ added in v0.1.1
func (d *DialogServerSession) Transport() string
func (*DialogServerSession) Trying ¶ added in v0.17.0
func (d *DialogServerSession) Trying() error
type DialogSession ¶
type DigestAuth ¶ added in v0.9.0
type DigestAuthServer ¶ added in v0.9.0
type DigestAuthServer struct {
// contains filtered or unexported fields
}
func NewDigestServer ¶ added in v0.9.0
func NewDigestServer() *DigestAuthServer
func (*DigestAuthServer) AuthorizeDialog ¶ added in v0.9.0
func (s *DigestAuthServer) AuthorizeDialog(d *DialogServerSession, auth DigestAuth) error
func (*DigestAuthServer) AuthorizeRequest ¶ added in v0.9.0
func (s *DigestAuthServer) AuthorizeRequest(req *sip.Request, auth DigestAuth) (res *sip.Response, err error)
AuthorizeRequest authorizes request. Returns SIP response that can be passed with error
func (*DigestAuthServer) Close ¶ added in v0.14.0
func (s *DigestAuthServer) Close()
type InviteClientOptions ¶ added in v0.14.0
type InviteClientOptions struct {
Originator DialogSession
OnResponse func(res *sip.Response) error
// OnMediaUpdate called when media is changed.
// NOTE: you should not block this call as it blocks response processing.
OnMediaUpdate func(d *DialogMedia)
// OnRefer is called on successfull REFER handling
//
// It creates new dialog (NewDialog) on which you need to call Invite() and Ack()
// Any error from invite, ack or other processing should be returned for correct Notify handling
//
// NOTE: IT is SCOPED to handler and exiting handler will Close/Terminate this dialog!
OnRefer OnReferDialogFunc
// For digest authentication
Username string
Password string
// Custom headers to pass. DO NOT SET THIS to nil
Headers []sip.Header
// Stop on early media. ErrClientEarlyMedia will be returned
EarlyMediaDetect bool
}
InviteClientOptions is passed on dialog client Invite with extra control over dialog
func (*InviteClientOptions) WithAnonymousCaller ¶ added in v0.15.0
func (o *InviteClientOptions) WithAnonymousCaller()
WithAnonymousCaller sets from user Anonymous per RFC
func (*InviteClientOptions) WithCaller ¶ added in v0.15.0
func (o *InviteClientOptions) WithCaller(displayName string, callerID string, host string)
WithCaller allows simpler way modifying caller
type InviteOptions ¶
type MediaConfig ¶
type NewDialogOptions ¶ added in v0.14.0
type OnReferDialogFunc ¶ added in v0.27.0
type OnReferDialogFunc func(referDialog *DialogClientSession) error
type ProgressMediaOptions ¶ added in v0.23.0
type ReferClientOptions ¶ added in v0.27.0
type ReferServerOptions ¶ added in v0.27.0
type RegisterOptions ¶ added in v0.2.0
type RegisterResponseError ¶ added in v0.2.0
func (RegisterResponseError) Error ¶ added in v0.2.0
func (e RegisterResponseError) Error() string
func (*RegisterResponseError) StatusCode ¶ added in v0.2.0
func (e *RegisterResponseError) StatusCode() int
type RegisterTransaction ¶ added in v0.2.0
func (*RegisterTransaction) Qualify ¶ added in v0.14.0
func (t *RegisterTransaction) Qualify(ctx context.Context) error
func (*RegisterTransaction) QualifyLoop ¶ added in v0.2.0
func (t *RegisterTransaction) QualifyLoop(ctx context.Context) error
func (*RegisterTransaction) Register ¶ added in v0.2.0
func (t *RegisterTransaction) Register(ctx context.Context) error
func (*RegisterTransaction) Unregister ¶ added in v0.2.0
func (t *RegisterTransaction) Unregister(ctx context.Context) error
type ServeDialogFunc ¶
type ServeDialogFunc func(d *DialogServerSession)
type Transport ¶
type Transport struct {
ID string
// Transport must be udp,tcp or ws, or even forcing v4 like udp4, tcp4
Transport string
// BindHost sets IP to bind. If specified (not 0.0.0.0) it will be used same for media IP unless MediaExternalIP is set.
BindHost string
// BindPort sets port to bind. Leaving at 0 will use empheral port and apply on Contact addr
BindPort int
ExternalHost string // SIP signaling and media external addr
ExternalPort int
// MediaExternalIP changes SDP IP, by default it tries to use external host if it is IP defined
MediaExternalIP net.IP
// MediaSRTP offers SRTP. Values: 0-none, 1-sdes
MediaSRTP int
MediaDTLSConf media.DTLSConfig
// In case TLS protocol
TLSConf *tls.Config
// Avoiding SIPS in contact uri https://datatracker.ietf.org/doc/html/rfc5630#section-3.3
TLSURINoSIPS bool
RewriteContact bool
// contains filtered or unexported fields
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
183ringing
command
SPDX-License-Identifier: MPL-2.0 SPDX-FileCopyrightText: Copyright (c) 2024, Emir Aganovic
|
SPDX-License-Identifier: MPL-2.0 SPDX-FileCopyrightText: Copyright (c) 2024, Emir Aganovic |
|
bridge
command
|
|
|
dtls/dtls_client
command
|
|
|
dtls/dtls_server
command
|
|
|
dtmf
command
|
|
|
playback
command
|
|
|
playback_control
command
|
|
|
readmedia
command
|
|
|
register
command
|
|
|
wav_record
command
SPDX-License-Identifier: MPL-2.0 SPDX-FileCopyrightText: Copyright (c) 2024, Emir Aganovic
|
SPDX-License-Identifier: MPL-2.0 SPDX-FileCopyrightText: Copyright (c) 2024, Emir Aganovic |