session

package
v1.1.7-0...-d08fa44 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AllowedMethods    = "INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO"
	AcceptedBody      = "application/sdp, application/dtmf-relay"
	MaxForwards       = 69
	SessionExpires    = 90
	MinSessionExpires = 60
)

Variables

View Source
var ReasonPhrase = map[uint16]string{
	100: "Trying",
	180: "Ringing",
	181: "Call Is Being Forwarded",
	182: "Queued",
	183: "Session Progress",
	199: "Early Dialog Terminated",
	200: "OK",
	202: "Accepted",
	204: "No Notification",
	300: "Multiple Choices",
	301: "Moved Permanently",
	302: "Moved Temporarily",
	305: "Use Proxy",
	380: "Alternative Service",
	400: "Bad Request",
	401: "Unauthorized",
	402: "Payment Required",
	403: "Forbidden",
	404: "Not Found",
	405: "Method Not Allowed",
	406: "Not Acceptable",
	407: "Proxy Authentication Required",
	408: "Request Timeout",
	410: "Gone",
	412: "Conditional Request Failed",
	413: "Request Entity Too Large",
	414: "Request-URI Too Long",
	415: "Unsupported Media Type",
	416: "Unsupported URI Scheme",
	417: "Unknown Resource-Priority",
	420: "Bad Extension",
	421: "Extension Required",
	422: "Session Interval Too Small",
	423: "Interval Too Brief",
	424: "Bad Location Information",
	428: "Use Identity Header",
	429: "Provide Referrer Identity",
	430: "Flow Failed",
	433: "Anonymity Disallowed",
	436: "Bad Identity-Info",
	437: "Unsupported Certificate",
	438: "Invalid Identity Header",
	439: "First Hop Lacks Outbound Support",
	440: "Max-Breadth Exceeded",
	469: "Bad Info Package",
	470: "Consent Needed",
	478: "Unresolvable Destination",
	480: "Temporarily Unavailable",
	481: "Call/Transaction Does Not Exist",
	482: "Loop Detected",
	483: "Too Many Hops",
	484: "Address Incomplete",
	485: "Ambiguous",
	486: "Busy Here",
	487: "Request Terminated",
	488: "Not Acceptable Here",
	489: "Bad Event",
	491: "Request Pending",
	493: "Undecipherable",
	494: "Security Agreement Required",
	500: "DartSIP Internal Error",
	501: "Not Implemented",
	502: "Bad Gateway",
	503: "Service Unavailable",
	504: "Server Time-out",
	505: "Version Not Supported",
	513: "Message Too Large",
	580: "Precondition Failure",
	600: "Busy Everywhere",
	603: "Decline",
	604: "Does Not Exist Anywhere",
	606: "Not Acceptable",
}

ReasonPhrase .

Functions

This section is empty.

Types

type Direction

type Direction string
const (
	Outgoing Direction = "Outgoing"
	Incoming Direction = "Incoming"
)

type RequestCallback

type RequestCallback func(ctx context.Context, request sip.Request, authorizer sip.Authorizer, waitForResult bool, attempt int) (sip.Response, error)

type Session

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

func NewInviteSession

func NewInviteSession(reqcb RequestCallback, uaType string,
	contact *sip.ContactHeader, req sip.Request, cid sip.CallID,
	tx sip.Transaction, dir Direction, logger log.Logger) *Session

func (*Session) Accept

func (s *Session) Accept(statusCode sip.StatusCode)

Accept 200

func (*Session) Bye

func (s *Session) Bye() (sip.Response, error)

Bye send Bye request.

func (*Session) CallID

func (s *Session) CallID() *sip.CallID

func (*Session) Contact

func (s *Session) Contact() string

func (*Session) Direction

func (s *Session) Direction() Direction

func (*Session) End

func (s *Session) End() error

End end session

func (*Session) GetEarlyMedia

func (s *Session) GetEarlyMedia() string

GetEarlyMedia Get sdp for early media.

func (*Session) Info

func (s *Session) Info(content string, contentType string)

Info send SIP INFO

func (*Session) IsEnded

func (s *Session) IsEnded() bool

func (*Session) IsEstablished

func (s *Session) IsEstablished() bool

func (*Session) IsInProgress

func (s *Session) IsInProgress() bool

func (*Session) LocalSdp

func (s *Session) LocalSdp() string

func (*Session) LocalURI

func (s *Session) LocalURI() sip.Address

func (*Session) Log

func (s *Session) Log() log.Logger

func (*Session) ProvideAnswer

func (s *Session) ProvideAnswer(sdp string)

ProvideAnswer .

func (*Session) ProvideOffer

func (s *Session) ProvideOffer(sdp string)

ProvideOffer .

func (*Session) Provisional

func (s *Session) Provisional(statusCode sip.StatusCode, reason string)

Provisional send a provisional code 100|180|183

func (*Session) ReInvite

func (s *Session) ReInvite()

ReInvite send re-INVITE

func (*Session) Redirect

func (s *Session) Redirect(target string, code sip.StatusCode)

Redirect send a 3xx

func (*Session) Reject

func (s *Session) Reject(statusCode sip.StatusCode, reason string)

Reject Reject incoming call or for re-INVITE or UPDATE,

func (*Session) RemoteSdp

func (s *Session) RemoteSdp() string

func (*Session) RemoteURI

func (s *Session) RemoteURI() sip.Address

func (*Session) Request

func (s *Session) Request() sip.Request

func (*Session) Response

func (s *Session) Response() sip.Response

func (*Session) SetState

func (s *Session) SetState(status Status)

func (*Session) Status

func (s *Session) Status() Status

func (*Session) StoreRequest

func (s *Session) StoreRequest(request sip.Request)

func (*Session) StoreResponse

func (s *Session) StoreResponse(response sip.Response)

func (*Session) StoreTransaction

func (s *Session) StoreTransaction(tx sip.Transaction)

func (*Session) String

func (s *Session) String() string

type Status

type Status string
const (
	InviteSent       Status = "InviteSent"       /**< After INVITE s sent */
	InviteReceived   Status = "InviteReceived"   /**< After INVITE s received. */
	ReInviteReceived Status = "ReInviteReceived" /**< After re-INVITE/UPDATE s received */
	//Answer         Status = "Answer"           /**< After response for re-INVITE/UPDATE. */
	Provisional      Status = "Provisional" /**< After response for 1XX. */
	EarlyMedia       Status = "EarlyMedia"  /**< After response 1XX with sdp. */
	WaitingForAnswer Status = "WaitingForAnswer"
	WaitingForACK    Status = "WaitingForACK" /**< After 2xx s sent/received. */
	Answered         Status = "Answered"
	Canceled         Status = "Canceled"
	Confirmed        Status = "Confirmed"  /**< After ACK s sent/received. */
	Failure          Status = "Failure"    /**< Session s rejected or canceled. */
	Terminated       Status = "Terminated" /**< Session s terminated. */
)

Jump to

Keyboard shortcuts

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