transaction

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2022 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	//T1 is a timer described in RFC3261.
	T1 = 500 * time.Millisecond
	//T2 is a timer described in RFC3261.
	T2 = 4 * time.Second
)

Variables

This section is empty.

Functions

func GenerateBranchID

func GenerateBranchID() string

GenerateBranchID creates new branch ID

Types

type ClientTransaction

type ClientTransaction struct {
	ID           string
	BranchID     string
	ServerTxID   string
	TransManager *TransactionManager
	Origin       *message.SipMsg
	FSM          *fsm.FSM

	ListeningPoint message.ListeningPoint
	Host           string
	Port           string
	LastMessage    *message.SipMsg
	// contains filtered or unexported fields
}

ClientTransaction represents a client transaction references in RFC3261

func (*ClientTransaction) GetBranchID

func (ct *ClientTransaction) GetBranchID() string

GetBranchID returns branchID which is the identifier of a transaction

func (*ClientTransaction) GetLastMessage

func (ct *ClientTransaction) GetLastMessage() *message.SipMsg

GetLastMessage returns the last received SIP message to this transaction

func (*ClientTransaction) GetListeningPoint

func (ct *ClientTransaction) GetListeningPoint() message.ListeningPoint

GetListeningPoint returns current listening point

func (*ClientTransaction) GetOrigin

func (ct *ClientTransaction) GetOrigin() *message.SipMsg

GetOrigin returns the SIP message that initiated this transaction

func (*ClientTransaction) GetServerTransactionID

func (ct *ClientTransaction) GetServerTransactionID() string

GetServerTransactionID returns a ServerTransaction that has been set with SetServerTransaction()

func (*ClientTransaction) InitFSM

func (ct *ClientTransaction) InitFSM(msg *message.SipMsg)

InitFSM initializes the finite state machine within the client transaction

func (*ClientTransaction) Receive

func (ct *ClientTransaction) Receive(msg *message.SipMsg)

Receive takes in the SIP message from the transport layer

func (*ClientTransaction) Resend

func (ct *ClientTransaction) Resend()

Resend is used for retransmissions

func (*ClientTransaction) Send

func (ct *ClientTransaction) Send(msg *message.SipMsg, host string, port string)

Send is used to send a SIP message

func (*ClientTransaction) SetLastMessage

func (ct *ClientTransaction) SetLastMessage(msg *message.SipMsg)

SetLastMessage sets the last message received

func (*ClientTransaction) SetListeningPoint

func (ct *ClientTransaction) SetListeningPoint(lp message.ListeningPoint)

SetListeningPoint sets a listening point to the client transaction

func (*ClientTransaction) SetServerTransaction

func (ct *ClientTransaction) SetServerTransaction(txID string)

SetServerTransaction is used to set a Server Transaction

func (*ClientTransaction) StatelessSend

func (ct *ClientTransaction) StatelessSend(msg *message.SipMsg, host string, port string)

StatelessSend send a sip message without acting on the FSM

type ServerTransaction

type ServerTransaction struct {
	ID           string
	BranchID     string
	TransManager *TransactionManager
	Origin       *message.SipMsg
	FSM          *fsm.FSM

	ListeningPoint message.ListeningPoint
	Host           string
	Port           string
	LastMessage    *message.SipMsg
	// contains filtered or unexported fields
}

ServerTransaction is a representation of a Server Transaction references in RFC3261

func (*ServerTransaction) GetBranchID

func (st *ServerTransaction) GetBranchID() string

GetBranchID returns branchID which is the identifier of a transaction

func (*ServerTransaction) GetLastMessage

func (st *ServerTransaction) GetLastMessage() *message.SipMsg

GetLastMessage returns the last received SIP message to this transaction

func (*ServerTransaction) GetListeningPoint

func (st *ServerTransaction) GetListeningPoint() message.ListeningPoint

GetListeningPoint returns current listening point

func (*ServerTransaction) GetOrigin

func (st *ServerTransaction) GetOrigin() *message.SipMsg

GetOrigin returns the SIP message that initiated this transaction

func (*ServerTransaction) GetServerTransactionID

func (st *ServerTransaction) GetServerTransactionID() string

GetServerTransactionID returns Server transaction ID

func (*ServerTransaction) InitFSM

func (st *ServerTransaction) InitFSM(msg *message.SipMsg)

InitFSM initializes the finite state machine within the client transaction

func (*ServerTransaction) Receive

func (st *ServerTransaction) Receive(msg *message.SipMsg)

Receive takes in the SIP message from the transport layer

func (*ServerTransaction) Respond

func (st *ServerTransaction) Respond(msg *message.SipMsg)

Respond is used to process response from transport layer

func (*ServerTransaction) Send

func (st *ServerTransaction) Send(msg *message.SipMsg, host string, port string)

Send used to send SIP message to specified host

func (*ServerTransaction) SetLastMessage

func (st *ServerTransaction) SetLastMessage(msg *message.SipMsg)

SetLastMessage sets the last message received

func (*ServerTransaction) SetListeningPoint

func (st *ServerTransaction) SetListeningPoint(lp message.ListeningPoint)

SetListeningPoint sets a listening point to the client transaction

type TransactionManager

type TransactionManager struct {
	ServerTX        map[string]message.Transaction
	ClientTX        map[string]message.Transaction
	RequestChannel  chan message.Transaction
	ResponseChannel chan message.Transaction
	ListeningPoint  message.ListeningPoint
	// contains filtered or unexported fields
}

TransactionManager handles SIP transactions

func NewTransactionManager

func NewTransactionManager() *TransactionManager

NewTransactionManager returns a new TransactionManager

func (*TransactionManager) DeleteClientTransaction

func (tm *TransactionManager) DeleteClientTransaction(branch string)

DeleteClientTransaction removes a stored transaction

func (*TransactionManager) DeleteServerTransaction

func (tm *TransactionManager) DeleteServerTransaction(branch string)

DeleteServerTransaction removes a stored transaction

func (*TransactionManager) FindClientTransaction

func (tm *TransactionManager) FindClientTransaction(msg *message.SipMsg) (message.Transaction, bool, error)

FindClientTransaction finds transaction by SipMsg

func (*TransactionManager) FindClientTransactionByID

func (tm *TransactionManager) FindClientTransactionByID(value string) (message.Transaction, bool)

FindClientTransactionByID finds transaction by id

func (*TransactionManager) FindServerTransaction

func (tm *TransactionManager) FindServerTransaction(msg *message.SipMsg) (message.Transaction, bool, error)

FindServerTransaction finds transaction by SipMsg

func (*TransactionManager) FindServerTransactionByID

func (tm *TransactionManager) FindServerTransactionByID(value string) (message.Transaction, bool)

FindServerTransactionByID finds transaction by id

func (*TransactionManager) Handle

Handle runs TransManager

func (*TransactionManager) MakeKey

func (tm *TransactionManager) MakeKey(msg message.SipMsg) string

MakeKey creates new transaction identifier

func (*TransactionManager) NewClientTransaction

func (tm *TransactionManager) NewClientTransaction(msg *message.SipMsg) *ClientTransaction

NewClientTransaction builds new CLientTransaction

func (*TransactionManager) NewServerTransaction

func (tm *TransactionManager) NewServerTransaction(msg *message.SipMsg) *ServerTransaction

NewServerTransaction builds new ServerTransaction

func (*TransactionManager) PutClientTransaction

func (tm *TransactionManager) PutClientTransaction(tx message.Transaction)

PutClientTransaction stores a transaction

func (*TransactionManager) PutServerTransaction

func (tm *TransactionManager) PutServerTransaction(tx message.Transaction)

PutServerTransaction stores a transaction

Jump to

Keyboard shortcuts

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