sessionmanager

package
v0.9.1-rc3 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2014 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Freswitch event proprities names
	DIRECTION          = "Call-Direction"
	SUBJECT            = "variable_cgr_subject"
	ACCOUNT            = "variable_cgr_account"
	DESTINATION        = "variable_cgr_destination"
	REQTYPE            = "variable_cgr_reqtype" //prepaid or postpaid
	TOR                = "variable_cgr_tor"
	UUID               = "Unique-ID" // -Unique ID for this call leg
	CSTMID             = "variable_cgr_tenant"
	CALL_DEST_NR       = "Caller-Destination-Number"
	PARK_TIME          = "Caller-Profile-Created-Time"
	START_TIME         = "Caller-Channel-Answered-Time"
	END_TIME           = "Caller-Channel-Hangup-Time"
	NAME               = "Event-Name"
	HEARTBEAT          = "HEARTBEAT"
	ANSWER             = "CHANNEL_ANSWER"
	HANGUP             = "CHANNEL_HANGUP_COMPLETE"
	PARK               = "CHANNEL_PARK"
	AUTH_OK            = "+AUTH_OK"
	DISCONNECT         = "+SWITCH DISCONNECT"
	INSUFFICIENT_FUNDS = "-INSUFFICIENT_FUNDS"
	MISSING_PARAMETER  = "-MISSING_PARAMETER"
	SYSTEM_ERROR       = "-SYSTEM_ERROR"
	MANAGER_REQUEST    = "+MANAGER_REQUEST"
	USERNAME           = "Caller-Username"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event interface {
	New(string) Event
	GetName() string
	GetDirection() string
	GetSubject() string
	GetAccount() string
	GetDestination() string
	GetCallDestNr() string
	GetTOR() string
	GetUUID() string
	GetTenant() string
	GetReqType() string
	GetStartTime(string) (time.Time, error)
	GetEndTime() (time.Time, error)
	MissingParameter() bool
}

type FSEvent

type FSEvent map[string]string

Event type holding a mapping of all event's proprieties

func (FSEvent) GetAccount

func (fsev FSEvent) GetAccount() string

func (FSEvent) GetCallDestNr

func (fsev FSEvent) GetCallDestNr() string

Original dialed destination number, useful in case of unpark

func (FSEvent) GetDestination

func (fsev FSEvent) GetDestination() string

Charging destination number

func (FSEvent) GetDirection

func (fsev FSEvent) GetDirection() string

func (FSEvent) GetEndTime

func (fsev FSEvent) GetEndTime() (t time.Time, err error)

func (FSEvent) GetName

func (fsev FSEvent) GetName() string

func (FSEvent) GetReqType

func (fsev FSEvent) GetReqType() string

func (FSEvent) GetStartTime

func (fsev FSEvent) GetStartTime(field string) (t time.Time, err error)

func (FSEvent) GetSubject

func (fsev FSEvent) GetSubject() string

func (FSEvent) GetTOR

func (fsev FSEvent) GetTOR() string

func (FSEvent) GetTenant

func (fsev FSEvent) GetTenant() string

func (FSEvent) GetUUID

func (fsev FSEvent) GetUUID() string

func (FSEvent) MissingParameter

func (fsev FSEvent) MissingParameter() bool

func (FSEvent) New

func (fsev FSEvent) New(body string) Event

Loads the new event data from a body of text containing the key value proprieties. It stores the parsed proprieties in the internal map.

func (FSEvent) String

func (fsev FSEvent) String() (result string)

Nice printing for the event object.

type FSSessionManager

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

The freeswitch session manager type holding a buffer for the network connection and the active sessions

func NewFSSessionManager

func NewFSSessionManager(storage engine.LogStorage, connector engine.Connector, debitPeriod time.Duration) *FSSessionManager

func (*FSSessionManager) Connect

func (sm *FSSessionManager) Connect(cgrCfg *config.CGRConfig) (err error)

Connects to the freeswitch mod_event_socket server and starts listening for events.

func (*FSSessionManager) DisconnectSession

func (sm *FSSessionManager) DisconnectSession(s *Session, notify string)

Disconnects a session by sending hangup command to freeswitch

func (*FSSessionManager) GetDbLogger

func (sm *FSSessionManager) GetDbLogger() engine.LogStorage

func (*FSSessionManager) GetDebitPeriod

func (sm *FSSessionManager) GetDebitPeriod() time.Duration

func (*FSSessionManager) GetSession

func (sm *FSSessionManager) GetSession(uuid string) *Session

Searches and return the session with the specifed uuid

func (*FSSessionManager) LoopAction

func (sm *FSSessionManager) LoopAction(s *Session, cd *engine.CallDescriptor) (cc *engine.CallCost)

func (*FSSessionManager) OnChannelAnswer

func (sm *FSSessionManager) OnChannelAnswer(ev Event)

func (*FSSessionManager) OnChannelHangupComplete

func (sm *FSSessionManager) OnChannelHangupComplete(ev Event)

func (*FSSessionManager) OnChannelPark

func (sm *FSSessionManager) OnChannelPark(ev Event)

func (*FSSessionManager) OnHeartBeat

func (sm *FSSessionManager) OnHeartBeat(ev Event)

func (*FSSessionManager) RemoveSession

func (sm *FSSessionManager) RemoveSession(s *Session)

Remove session from sessin list

func (*FSSessionManager) Shutdown

func (sm *FSSessionManager) Shutdown() (err error)

type Session

type Session struct {
	CallCosts []*engine.CallCost
	// contains filtered or unexported fields
}

Session type holding the call information fields, a session delegate for specific actions and a channel to signal end of the debit loop.

func NewSession

func NewSession(ev Event, sm SessionManager) (s *Session)

Creates a new session and starts the debit loop

func (*Session) Close

func (s *Session) Close(ev Event)

Stops the debit loop

func (*Session) SaveOperations

func (s *Session) SaveOperations()

func (*Session) String

func (s *Session) String() string

Nice print for session

type SessionManager

type SessionManager interface {
	Connect(*config.CGRConfig) error
	DisconnectSession(*Session, string)
	RemoveSession(*Session)
	LoopAction(*Session, *engine.CallDescriptor) *engine.CallCost
	GetDebitPeriod() time.Duration
	GetDbLogger() engine.LogStorage
	Shutdown() error
}

Jump to

Keyboard shortcuts

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