cmd

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultUptimeInfo = UptimeInfo{
		SystemUptimeSeconds: -1,
		LastReloadSeconds:   -1,
	}

	DefaultChannelsInfo = ChannelsInfo{
		ActiveChannels: -1,
		ActiveCalls:    -1,
		ProcessedCalls: -1,
	}

	DefaultPeersInfo = PeersInfo{
		SipPeers:             -1,
		MonitoredOnline:      -1,
		MonitoredOffline:     -1,
		UnmonitoredOnline:    -1,
		UnmonitoredOffline:   -1,
		PeersStatusUnknown:   -1,
		PeersStatusQualified: -1,
	}

	DefaultThreadsInfo = ThreadsInfo{
		ThreadCount: -1,
	}

	DefaultAgentsInfo = AgentsInfo{
		DefinedAgents: -1,
		LoggedAgents:  -1,
		TalkingAgents: -1,
	}

	DefaultOnlineAgentsInfo = OnlineAgentsInfo{
		OnlineDefinedAgents: -1,
		OnlineLoggedAgents:  -1,
		OnlineTalkingAgents: -1,
	}

	DefaultBridgesInfo = BridgesInfo{
		Count: -1,
	}

	DefaultBridgeTechnologiesInfo = BridgeTechnologiesInfo{
		BridgeTechnologies: []BridgeTechnology{},
	}

	DefaultCalendarsInfo = CalendarsInfo{
		Count: -1,
	}

	DefaultConfBridgeInfo = ConfBridgeInfo{
		Menus:    []string{},
		Profiles: []string{},
		Users:    []string{},
	}

	DefaultChannelTypesInfo = ChannelTypesInfo{
		ChannelTypes: []ChannelType{},
	}

	DefaultImagesInfo = ImagesInfo{
		Registered: -1,
	}

	DefaultSystemInfo = SystemInfo{
		TotalMemory:  -1,
		FreeMemory:   -1,
		BufferMemory: -1,
		TotalSwap:    -1,
		FreeSwap:     -1,
		ProcessCount: -1,
	}

	DefaultTaskProcessorsInfo = TaskProcessorsInfo{
		ProcessorCounter:    -1,
		ProcessedTasksTotal: -1,
		InQueue:             -1,
	}

	DefaultVersionInfo = VersionInfo{
		Version: "",
	}

	DefaultIaxChannelsInfo = IaxChannelsInfo{
		ActiveCount: -1,
	}

	DefaultModulesInfo = ModulesInfo{
		ModuleCount: -1,
	}

	DefaultActiveSipDialogs       = int64(-1)
	DefaultActiveSipSubscriptions = int64(-1)
	DefaultActiveSipChannels      = int64(-1)

	DefaultUsersInfo = UsersInfo{
		Users: -1,
	}

	AllNumbersRegexp              = regexp.MustCompile(`\d[\d,]*[\.]?[\d{2}]*`)
	AllIntegersRegexp             = regexp.MustCompile(`\d+`)
	StringWithoutWhitespaceRegexp = regexp.MustCompile(`[^\s]+`)
	YesNoRegexp                   = regexp.MustCompile(`no|yes`)
)

Functions

This section is empty.

Types

type AgentsInfo

type AgentsInfo struct {
	//agent show all
	DefinedAgents int64
	LoggedAgents  int64
	TalkingAgents int64
}

type BridgeTechnologiesInfo

type BridgeTechnologiesInfo struct {
	// bridge technology show
	BridgeTechnologies []BridgeTechnology
}

type BridgeTechnology

type BridgeTechnology struct {
	Name      string
	Type      string
	Priority  string
	Suspended string
}

type BridgesInfo

type BridgesInfo struct {
	// bridge show all
	Count int64
}

type CalendarsInfo

type CalendarsInfo struct {
	// calendar show calendars
	// calendar show types
	Count int64
}

type ChannelType

type ChannelType struct {
	Type        string
	DeviceState bool
	Indications bool
	Transfer    bool
}

type ChannelTypesInfo

type ChannelTypesInfo struct {
	// core show channeltypes
	ChannelTypes []ChannelType
}

type ChannelsInfo

type ChannelsInfo struct {
	ActiveChannels int64
	ActiveCalls    int64
	ProcessedCalls int64
}

ChannelsInfo Channels and calls infos

type CmdRunner

type CmdRunner struct {
	Logger log.Logger
	Cmd    string
}

CmdRunner command struct

func NewCmdRunner

func NewCmdRunner(asteriskPath string, logger log.Logger) *CmdRunner

NewCmdRunner build cmdRunner instance

func (*CmdRunner) AgentsInfo

func (c *CmdRunner) AgentsInfo() *AgentsInfo

func (*CmdRunner) BridgeTechnologiesInfo

func (c *CmdRunner) BridgeTechnologiesInfo() *BridgeTechnologiesInfo

func (*CmdRunner) BridgesInfo

func (c *CmdRunner) BridgesInfo() *BridgesInfo

func (*CmdRunner) CalendarsInfo

func (c *CmdRunner) CalendarsInfo() *CalendarsInfo

func (*CmdRunner) ChannelTypesInfo

func (c *CmdRunner) ChannelTypesInfo() *ChannelTypesInfo

func (*CmdRunner) ChannelsInfo

func (c *CmdRunner) ChannelsInfo() *ChannelsInfo

ChannelsInfo get channels and calls info

func (*CmdRunner) ConfBridgeInfo

func (c *CmdRunner) ConfBridgeInfo() *ConfBridgeInfo

func (*CmdRunner) IaxChannelsInfo

func (c *CmdRunner) IaxChannelsInfo() *IaxChannelsInfo

func (*CmdRunner) ImagesInfo

func (c *CmdRunner) ImagesInfo() *ImagesInfo

func (*CmdRunner) ModulesInfo

func (c *CmdRunner) ModulesInfo() *ModulesInfo

func (*CmdRunner) OnlineAgentsInfo

func (c *CmdRunner) OnlineAgentsInfo() *OnlineAgentsInfo

func (*CmdRunner) PeersInfo

func (c *CmdRunner) PeersInfo() *PeersInfo

PeersInfo get peers infos

func (*CmdRunner) SipChannelsInfo

func (c *CmdRunner) SipChannelsInfo() *SipChannelsInfo

func (*CmdRunner) SystemInfo

func (c *CmdRunner) SystemInfo() *SystemInfo

func (*CmdRunner) TaskProcessorsInfo

func (c *CmdRunner) TaskProcessorsInfo() *TaskProcessorsInfo

func (*CmdRunner) ThreadsInfo

func (c *CmdRunner) ThreadsInfo() *ThreadsInfo

ThreadsInfo get threads infos

func (*CmdRunner) UptimeInfos

func (c *CmdRunner) UptimeInfos() *UptimeInfo

UptimeInfos get uptime and reload infos

func (*CmdRunner) UsersInfo

func (c *CmdRunner) UsersInfo() *UsersInfo

func (*CmdRunner) VersionInfo

func (c *CmdRunner) VersionInfo() *VersionInfo

type ConfBridgeInfo

type ConfBridgeInfo struct {
	// confbridge show menus
	Menus []string
	// confbridge show profile bridges
	Profiles []string
	// confbridge show profile users
	Users []string
}

type IaxChannelsInfo

type IaxChannelsInfo struct {
	// iax2 show channels
	ActiveCount int64
}

type ImagesInfo

type ImagesInfo struct {
	// core show image formats
	Registered int64
}

type ModulesInfo

type ModulesInfo struct {
	// module show
	ModuleCount int64
}

type OnlineAgentsInfo

type OnlineAgentsInfo struct {
	//agent show online
	OnlineDefinedAgents int64
	OnlineLoggedAgents  int64
	OnlineTalkingAgents int64
}

type PeersInfo

type PeersInfo struct {
	// asterisk -rx 'sip show peers' | grep 'sip peers' | grep 'Monitored' | grep 'Unmonitored'"
	// [sip_peers, monitored_online, monitored_offline, unmonitored_online, unmonitored_offline] = re.findall("\d+", sip_show_peers)
	SipPeers           int64
	MonitoredOnline    int64
	MonitoredOffline   int64
	UnmonitoredOnline  int64
	UnmonitoredOffline int64
	// asterisk -rx 'sip show peers' | grep -P '^\d{3,}.*UNKNOWN\s' | wc -l"
	PeersStatusUnknown int64
	// asterisk -rx 'sip show peers' | grep -P '^\d{3,}.*OK\s\(\d+' | wc -l"
	PeersStatusQualified int64
}

PeersInfo peers infos

type SipChannelsInfo

type SipChannelsInfo struct {
	// sip show channels
	// sip show subscriptions
	// sip show channelstats
	ActiveSipDialogs       int64
	ActiveSipSubscriptions int64
	ActiveSipChannels      int64
}

type SystemInfo

type SystemInfo struct {
	// core show sysinfo
	TotalMemory  int64
	FreeMemory   int64
	BufferMemory int64
	TotalSwap    int64
	FreeSwap     int64
	ProcessCount int64
}

type TaskProcessorsInfo

type TaskProcessorsInfo struct {
	// core show taskprocessors
	ProcessorCounter    int64
	ProcessedTasksTotal int64
	InQueue             int64
}

type ThreadsInfo

type ThreadsInfo struct {
	ThreadCount int64
}

ThreadsInfo threads infos

type UptimeInfo

type UptimeInfo struct {
	SystemUptimeSeconds int64
	LastReloadSeconds   int64
}

UptimeInfo uptime and reload time infos

type UsersInfo

type UsersInfo struct {
	// sip show users
	Users int64
}

type VersionInfo

type VersionInfo struct {
	// core show version
	Version string
}

Jump to

Keyboard shortcuts

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