当前位置: 首页>>代码示例>>Golang>>正文


Golang eventsocket.Event类代码示例

本文整理汇总了Golang中github.com/fiorix/go-eventsocket/eventsocket.Event的典型用法代码示例。如果您正苦于以下问题:Golang Event类的具体用法?Golang Event怎么用?Golang Event使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Event类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: handleUseJoinedEvent

func handleUseJoinedEvent(e *eventsocket.Event) VoiceUserJoinedEvent {
	memberId := getMemberIdFromEvent(e)
	callerIdNum := getCallerIdNumFromEvent(e)
	callerIdName := getCallerIdNameFromEvent(e)
	speak := getSpeakFromEvent(e)
	muted := isUserMuted(speak)
	talking := isUserTalking(e)
	confName := e.Get("Conference-Name")
	//	confSize := e.Get("Conference-Size")

	//   voiceUserId := callerIdName
	globalAudio := isUserJoinedThoughGlobalAudio(callerIdName)

	voiceUser := VoiceUserJoinedEvent{}

	if globalAudio != true {
		user, err := getUser(callerIdName)
		if err != nil {
			voiceUser := VoiceUserJoinedEvent{}
			voiceUser.ConferenceId = confName
			voiceUser.VoiceUserId = user.UserId
			voiceUser.CallerIdNum = callerIdNum
			voiceUser.CallerIdName = user.Username
			voiceUser.Muted = muted
			voiceUser.Talking = talking
			voiceUser.Locked = false
			voiceUser.UserId = memberId

		}

	}
	return voiceUser
}
开发者ID:ritzalam,项目名称:voiceconfmanager,代码行数:33,代码来源:client.go

示例2: isUserTalking

func isUserTalking(e *eventsocket.Event) bool {
	talk, err := strconv.ParseBool(e.Get("Talking"))
	talking := false
	if err != nil {
		if talk {
			talking = false
		} else {
			talking = true
		}
	}

	return talking
}
开发者ID:ritzalam,项目名称:voiceconfmanager,代码行数:13,代码来源:client.go

示例3: AddEvent

// AddEvent parses a FreeSWITCH EventSocket event and merges contained information into the FaxResult
func (f *FaxResult) AddEvent(ev *eventsocket.Event) {
	switch ev.Get("Event-Name") {
	case "CHANNEL_CALLSTATE":
		// Call state has changed
		callstate := ev.Get("Channel-Call-State")
		f.sessionlog.Log("Call state change:", callstate)
		if callstate == "ACTIVE" {
			f.StartTs = time.Now()
		}
		if callstate == "HANGUP" {
			f.EndTs = time.Now()
			f.Hangupcause = ev.Get("Hangup-Cause")
		}

	case "CUSTOM":
		// Fax results have changed
		action := ""
		switch ev.Get("Event-Subclass") {
		case "spandsp::rxfaxnegociateresult":
			fallthrough
		case "spandsp::txfaxnegociateresult":
			f.NegotiateCount++
			if ecm := ev.Get("Fax-Ecm-Used"); ecm == "on" {
				f.Ecm = true
			}
			f.RemoteID = ev.Get("Fax-Remote-Station-Id")
			if rate, err := strconv.ParseUint(ev.Get("Fax-Transfer-Rate"), 10, 0); err == nil {
				f.TransferRate = uint(rate)
			}
			f.sessionlog.Log(fmt.Sprintf("Remote ID: \"%v\", Transfer Rate: %v, ECM=%v", f.RemoteID, f.TransferRate, f.Ecm))

		case "spandsp::rxfaxpageresult":
			action = "received"
			fallthrough
		case "spandsp::txfaxpageresult":
			if action == "" {
				action = "sent"
			}
			// A page was transferred
			if pages, err := strconv.ParseUint(ev.Get("Fax-Document-Transferred-Pages"), 10, 0); err == nil {
				f.TransferredPages = uint(pages)
			}

			pr := new(PageResult)
			pr.Page = f.TransferredPages

			if badrows, err := strconv.ParseUint(ev.Get("Fax-Bad-Rows"), 10, 0); err == nil {
				pr.BadRows = uint(badrows)
			}
			pr.EncodingName = ev.Get("Fax-Encoding-Name")
			if imgsize, err := parseResolution(ev.Get("Fax-Image-Pixel-Size")); err == nil {
				pr.ImagePixelSize = *imgsize
			}
			if filesize, err := parseResolution(ev.Get("Fax-File-Image-Pixel-Size")); err == nil {
				pr.FilePixelSize = *filesize
			}
			if imgres, err := parseResolution(ev.Get("Fax-Image-Resolution")); err == nil {
				pr.ImageResolution = *imgres
			}
			if fileres, err := parseResolution(ev.Get("Fax-File-Image-Resolution")); err == nil {
				pr.FileResolution = *fileres
			}
			if size, err := strconv.ParseUint(ev.Get("Fax-Image-Size"), 10, 0); err == nil {
				pr.ImageSize = uint(size)
			}
			if badrowrun, err := strconv.ParseUint(ev.Get("Fax-Longest-Bad-Row-Run"), 10, 0); err == nil {
				pr.LongestBadRowRun = uint(badrowrun)
			}

			f.PageResults = append(f.PageResults, *pr)
			f.sessionlog.Log(fmt.Sprintf("Page %d %v: %v", f.TransferredPages, action, *pr))

		case "spandsp::rxfaxresult":
			fallthrough
		case "spandsp::txfaxresult":
			if totalpages, err := strconv.ParseUint(ev.Get("Fax-Document-Total-Pages"), 10, 0); err == nil {
				f.TotalPages = uint(totalpages)
			}
			if transferredpages, err := strconv.ParseUint(ev.Get("Fax-Document-Transferred-Pages"), 10, 0); err == nil {
				f.TransferredPages = uint(transferredpages)
			}
			if ecm := ev.Get("Fax-Ecm-Used"); ecm == "on" {
				f.Ecm = true
			}
			f.RemoteID = ev.Get("Fax-Remote-Station-Id")
			if resultcode, err := strconv.Atoi(ev.Get("Fax-Result-Code")); err == nil {
				f.ResultCode = resultcode
			}
			f.ResultText = ev.Get("Fax-Result-Text")
			if ev.Get("Fax-Success") == "1" {
				f.Success = true
			}
			if rate, err := strconv.ParseUint(ev.Get("Fax-Transfer-Rate"), 10, 0); err == nil {
				f.TransferRate = uint(rate)
			}

		}
	}

//.........这里部分代码省略.........
开发者ID:beres,项目名称:gofaxip,代码行数:101,代码来源:faxresult.go

示例4: getSpeakFromEvent

func getSpeakFromEvent(e *eventsocket.Event) string {
	return e.Get("Speak")
}
开发者ID:ritzalam,项目名称:voiceconfmanager,代码行数:3,代码来源:client.go

示例5: getRecordFilenameFromEvent

func getRecordFilenameFromEvent(e *eventsocket.Event) string {
	return e.Get("Path")
}
开发者ID:ritzalam,项目名称:voiceconfmanager,代码行数:3,代码来源:client.go

示例6: getCallerIdNameFromEvent

func getCallerIdNameFromEvent(e *eventsocket.Event) string {
	return e.Get("Caller-Caller-ID-Name")
}
开发者ID:ritzalam,项目名称:voiceconfmanager,代码行数:3,代码来源:client.go

示例7: getCallerIdNumFromEvent

func getCallerIdNumFromEvent(e *eventsocket.Event) string {
	return e.Get("Caller-Caller-ID-Number")
}
开发者ID:ritzalam,项目名称:voiceconfmanager,代码行数:3,代码来源:client.go

示例8: getMemberIdFromEvent

func getMemberIdFromEvent(e *eventsocket.Event) string {
	return e.Get("Member-ID")
}
开发者ID:ritzalam,项目名称:voiceconfmanager,代码行数:3,代码来源:client.go


注:本文中的github.com/fiorix/go-eventsocket/eventsocket.Event类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。