trans

package
v0.0.0-...-f6e02f1 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	T1      = 100 * time.Millisecond
	T2      = 4 * time.Second
	T4      = 5 * time.Second
	TimeA   = T1
	TimeB   = 64 * T1
	TimeD   = 32 * time.Second
	TimeE   = T1
	TimeF   = 64 * T1
	TimeG   = T1
	TimeH   = 64 * T1
	TimeI   = T4
	TimeJ   = 64 * T1
	TimeK   = T4
	Time1xx = 100 * time.Millisecond
)

timer相关基础常量、方法等定义

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Type EventType
	Tid  string // trans id
	Msg  *sip.Msg
}

type EventType

type EventType int
const (
	/* TIMEOUT EVENTS for ICT */
	TIMEOUT_A EventType = iota /**< Timer A */
	TIMEOUT_B                  /**< Timer B */
	TIMEOUT_D                  /**< Timer D */

	/* TIMEOUT EVENTS for NICT */
	TIMEOUT_E /**< Timer E */
	TIMEOUT_F /**< Timer F */
	TIMEOUT_K /**< Timer K */

	/* TIMEOUT EVENTS for IST */
	TIMEOUT_G /**< Timer G */
	TIMEOUT_H /**< Timer H */
	TIMEOUT_I /**< Timer I */

	/* TIMEOUT EVENTS for NIST */
	TIMEOUT_J /**< Timer J */

	/* FOR INCOMING MESSAGE */
	RCV_REQINVITE     /**< Event is an incoming INVITE request */
	RCV_REQACK        /**< Event is an incoming ACK request */
	RCV_REQUEST       /**< Event is an incoming NON-INVITE and NON-ACK request */
	RCV_STATUS_1XX    /**< Event is an incoming informational response */
	RCV_STATUS_2XX    /**< Event is an incoming 2XX response */
	RCV_STATUS_3456XX /**< Event is an incoming final response (not 2XX) */

	/* FOR OUTGOING MESSAGE */
	SND_REQINVITE     /**< Event is an outgoing INVITE request */
	SND_REQACK        /**< Event is an outgoing ACK request */
	SND_REQUEST       /**< Event is an outgoing NON-INVITE and NON-ACK request */
	SND_STATUS_1XX    /**< Event is an outgoing informational response */
	SND_STATUS_2XX    /**< Event is an outgoing 2XX response */
	SND_STATUS_3456XX /**< Event is an outgoing final response (not 2XX) */

	//	KILL_TRANSACTION /**< Event to 'kill' the trans before termination */
	UNKNOWN_EVT /**< Max event */
)

func SetIncomingEventType

func SetIncomingEventType(msg *sip.Msg) EventType

func SetOutcomingEventType

func SetOutcomingEventType(msg *sip.Msg) EventType

type Ict

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

func NewIct

func NewIct(id string, cb Ictcber) *Ict

func (*Ict) Do

func (t *Ict) Do(e *Event) error
ICT_PRE_CALLING: {
	SND_REQINVITE: sendInvite,
},
ICT_CALLING: {
	TIMEOUT_A:         timeoutA,
	TIMEOUT_B:         timeoutB,
	RCV_STATUS_1XX:    recv1xx,
	RCV_STATUS_2XX:    recv2xx,
	RCV_STATUS_3456XX: recv3456xx,
},
ICT_PROCEEDING: {
	RCV_STATUS_1XX:    recv1xx,
	RCV_STATUS_2XX:    recv2xx,
	RCV_STATUS_3456XX: recv3456xx,
},
ICT_COMPLETED: {
	RCV_STATUS_3456XX: recv3456xx,
	TIMEOUT_D:         timeoutD,
},

func (*Ict) IsTerminated

func (t *Ict) IsTerminated() bool

type Ictcber

type Ictcber interface {
	Recv1xx(*Ict, *Event) error
	Recv2xx(*Ict, *Event) error
	Recv3456xx(*Ict, *Event) error
}

type Ist

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

func NewIst

func NewIst(id string, cb Istcber) *Ist

func (*Ist) Do

func (t *Ist) Do(e *Event) error
IST_PRE_PROCEEDING: {
	RCV_REQINVITE: recvInvite,
},
IST_PROCEEDING: {
	RCV_REQINVITE:     recvInvite,
	SND_STATUS_1XX:    send1xx,
	SND_STATUS_2XX:    send2xx,
	SND_STATUS_3456XX: send3456xx,
},
IST_COMPLETED: {
	RCV_REQINVITE: recvInvite,
	RCV_REQACK:    recvAck,
	TIMEOUT_G:     timeoutG,
	TIMEOUT_H:     timeoutH,
	TIMEOUT_I:     timeoutI,
},

func (*Ist) IsTerminated

func (t *Ist) IsTerminated() bool

type Istcber

type Istcber interface {
	RecvInvite(*Ist, *Event) error
	RecvAck(*Ist, *Event) error
}

type Nict

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

func NewNict

func NewNict(id string, cb Nictcber) *Nict

func (*Nict) Do

func (t *Nict) Do(e *Event) error
NICT_PRE_TRYING: {
	SND_REQUEST: sendRequest,
},
NICT_TRYING: {
	TIMEOUT_F:         timeoutF,
	TIMEOUT_E:         timeoutE,
	RCV_STATUS_1XX:    recv1xx,
	RCV_STATUS_2XX:    recv23456xx,
	RCV_STATUS_3456XX: recv23456xx,
},
NICT_PROCEEDING: {
	TIMEOUT_F:         timeoutF,
	TIMEOUT_E:         timeoutE,
	RCV_STATUS_1XX:    recv1xx,
	RCV_STATUS_2XX:    recv23456xx,
	RCV_STATUS_3456XX: recv23456xx,
},
NICT_COMPLETED: {
	TIMEOUT_K: timeoutK,
},

func (*Nict) IsTerminated

func (t *Nict) IsTerminated() bool

type Nictcber

type Nictcber interface {
	Recv1xx(*Nict, *Event) error
	Recv23456xx(*Nict, *Event) error
}

type Nist

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

func NewNist

func NewNist(id string, cb Nistcber) *Nist

func (*Nist) Do

func (t *Nist) Do(e *Event) error
NIST_PRE_TRYING: {
    RCV_REQUEST: recvRequest,
},
NIST_TRYING: {
    SND_STATUS_1XX:    send1xx,
    SND_STATUS_2XX:    send23456xx,
    SND_STATUS_3456XX: send23456xx,
},
NIST_PROCEEDING: {
    RCV_REQUEST:       recvRequest,
    SND_STATUS_1XX:    send1xx,
    SND_STATUS_2XX:    send23456xx,
    SND_STATUS_3456XX: send23456xx,
},
NIST_COMPLETED: {
    RCV_REQUEST: recvRequest,
    TIMEOUT_J:   timeoutJ,
},

func (*Nist) IsTerminated

func (t *Nist) IsTerminated() bool

type Nistcber

type Nistcber interface {
	RecvRequest(*Nist, *Event) error
}

type State

type State int
const (
	/* STATES for invite client trans */
	ICT_PRE_CALLING State = iota
	ICT_CALLING
	ICT_PROCEEDING
	ICT_COMPLETED
	ICT_TERMINATED

	/* STATES for invite server trans */
	IST_PRE_PROCEEDING
	IST_PROCEEDING
	IST_COMPLETED
	IST_CONFIRMED
	IST_TERMINATED

	/* STATES for NON-invite client trans */
	NICT_PRE_TRYING
	NICT_TRYING
	NICT_PROCEEDING
	NICT_COMPLETED
	NICT_TERMINATED

	/* STATES for NON-invite server trans */
	NIST_PRE_TRYING
	NIST_TRYING
	NIST_PROCEEDING
	NIST_COMPLETED
	NIST_TERMINATED

	UNKNOWN_STATE /**< Max state*/

)

type Transactioner

type Transactioner interface {
	Do(*Event) error
	IsTerminated() bool
}

type Type

type Type int
const (
	ICT     Type = iota /**< Invite Client (outgoing) Transaction */
	IST                 /**< Invite Server (incoming) Transaction */
	NICT                /**< Non-Invite Client (outgoing) Transaction */
	NIST                /**< Non-Invite Server (incoming) Transaction */
	UNKNOWN             /**< Invalid Transaction */
)

Jump to

Keyboard shortcuts

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