Documentation
¶
Index ¶
- Constants
- func GenerateBranchID() string
- type ClientTransaction
- func (ct *ClientTransaction) GetBranchID() string
- func (ct *ClientTransaction) GetLastMessage() *message.SipMsg
- func (ct *ClientTransaction) GetListeningPoint() interfaces.ListeningPoint
- func (ct *ClientTransaction) GetOrigin() *message.SipMsg
- func (ct *ClientTransaction) GetServerTransactionID() string
- func (ct *ClientTransaction) InitFSM(msg *message.SipMsg)
- func (ct *ClientTransaction) Receive(msg *message.SipMsg)
- func (ct *ClientTransaction) Resend()
- func (ct *ClientTransaction) Send(msg *message.SipMsg, host string, port string)
- func (ct *ClientTransaction) SetLastMessage(msg *message.SipMsg)
- func (ct *ClientTransaction) SetListeningPoint(lp interfaces.ListeningPoint)
- func (ct *ClientTransaction) SetServerTransaction(txID string)
- func (ct *ClientTransaction) StatelessSend(msg *message.SipMsg, host string, port string)
- type ServerTransaction
- func (st *ServerTransaction) GetBranchID() string
- func (st *ServerTransaction) GetLastMessage() *message.SipMsg
- func (st *ServerTransaction) GetListeningPoint() interfaces.ListeningPoint
- func (st *ServerTransaction) GetOrigin() *message.SipMsg
- func (st *ServerTransaction) GetServerTransactionID() string
- func (st *ServerTransaction) InitFSM(msg *message.SipMsg)
- func (st *ServerTransaction) Receive(msg *message.SipMsg)
- func (st *ServerTransaction) Respond(msg *message.SipMsg)
- func (st *ServerTransaction) Send(msg *message.SipMsg, host string, port string)
- func (st *ServerTransaction) SetLastMessage(msg *message.SipMsg)
- func (st *ServerTransaction) SetListeningPoint(lp interfaces.ListeningPoint)
- type TransactionManager
- func (tm *TransactionManager) DeleteClientTransaction(branch string)
- func (tm *TransactionManager) DeleteServerTransaction(branch string)
- func (tm *TransactionManager) FindClientTransaction(msg *message.SipMsg) (interfaces.Transaction, bool, error)
- func (tm *TransactionManager) FindClientTransactionByID(value string) (interfaces.Transaction, bool)
- func (tm *TransactionManager) FindServerTransaction(msg *message.SipMsg) (interfaces.Transaction, bool, error)
- func (tm *TransactionManager) FindServerTransactionByID(value string) (interfaces.Transaction, bool)
- func (tm *TransactionManager) Handle(event interfaces.SipEventObject) interfaces.SipEventObject
- func (tm *TransactionManager) MakeKey(msg message.SipMsg) string
- func (tm *TransactionManager) NewClientTransaction(msg *message.SipMsg) *ClientTransaction
- func (tm *TransactionManager) NewServerTransaction(msg *message.SipMsg) *ServerTransaction
- func (tm *TransactionManager) PutClientTransaction(tx interfaces.Transaction)
- func (tm *TransactionManager) PutServerTransaction(tx interfaces.Transaction)
Constants ¶
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 ¶
Types ¶
type ClientTransaction ¶
type ClientTransaction struct { ID string BranchID string ServerTxID string TransManager *TransactionManager Origin *message.SipMsg FSM *fsm.FSM MsgHistory []*message.SipMsg ListeningPoint interfaces.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() interfaces.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 interfaces.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 interfaces.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() interfaces.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 interfaces.ListeningPoint)
SetListeningPoint sets a listening point to the client transaction
type TransactionManager ¶
type TransactionManager struct { ServerTX map[string]interfaces.Transaction ClientTX map[string]interfaces.Transaction RequestChannel chan interfaces.Transaction ResponseChannel chan interfaces.Transaction ListeningPoint interfaces.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) (interfaces.Transaction, bool, error)
FindClientTransaction finds transaction by SipMsg
func (*TransactionManager) FindClientTransactionByID ¶
func (tm *TransactionManager) FindClientTransactionByID(value string) (interfaces.Transaction, bool)
FindClientTransactionByID finds transaction by id
func (*TransactionManager) FindServerTransaction ¶
func (tm *TransactionManager) FindServerTransaction(msg *message.SipMsg) (interfaces.Transaction, bool, error)
FindServerTransaction finds transaction by SipMsg
func (*TransactionManager) FindServerTransactionByID ¶
func (tm *TransactionManager) FindServerTransactionByID(value string) (interfaces.Transaction, bool)
FindServerTransactionByID finds transaction by id
func (*TransactionManager) Handle ¶
func (tm *TransactionManager) Handle(event interfaces.SipEventObject) interfaces.SipEventObject
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 interfaces.Transaction)
PutClientTransaction stores a transaction
func (*TransactionManager) PutServerTransaction ¶
func (tm *TransactionManager) PutServerTransaction(tx interfaces.Transaction)
PutServerTransaction stores a transaction