model

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// READYTIME 拨号最长持续时间
	READYTIME = 60
	BUSY      = true
	FREE      = false

	READY      = 0
	INPROGRESS = 1
	FINISH     = 2

	MAXROOMID = 1000000000

	// SESSIONMAXTIME session 在 redis 中过期的时间
	SESSIONMAXTIME = 60 * 60 * 24
)

Variables

View Source
var (
	ErrSessionNotExist     = errors.New("the session is not exist")
	ErrUserBusy            = errors.New("user is busy")
	ErrFeaturesUnSupported = errors.New("Features UnSupported")
)

Functions

This section is empty.

Types

type CheckCallRequest

type CheckCallRequest struct {
	PersonId string `json:"-"`
	TraceId  int64  `json:"traceId"`
	// 如果同时填了 tracedIdStr, 则优先选择 traceIdStr
	TraceIdStr string `json:"traceIdStr"`
}

type CheckCallResponse

type CheckCallResponse struct {
	TraceId    int64    `json:"traceId"`
	TraceIdStr string   `json:"traceIdStr"`
	RTCType    int32    `json:"RTCType"`
	Invitees   []string `json:"invitees"`
	Caller     string   `json:"caller"`
	CreateTime int64    `json:"createTime"`
	Timeout    int32    `json:"timeout"`
	Deadline   int64    `json:"deadline"`
	GroupId    string   `json:"groupId"`
}

type GeneralResponse

type GeneralResponse struct {
	Result  int         `json:"result"`
	Message int         `json:"message"`
	Data    interface{} `json:"data"`
}

type HandleCallRequest

type HandleCallRequest struct {
	PersonId string `json:"-"`
	Answer   bool   `json:"answer"`
	TraceId  int64  `json:"traceId"`
	// 如果同时填了 tracedIdStr, 则优先选择 traceIdStr
	TraceIdStr string `json:"traceIdStr"`
}

type HandleCallResponse

type HandleCallResponse struct {
	RoomId        int32  `json:"roomId"`
	UserSig       string `json:"userSig"`
	PrivateMapKey string `json:"privateMapKey"`
	SDKAppId      int32  `json:"sdkAppId"`
}

type ReplyBusyRequest

type ReplyBusyRequest struct {
	PersonId string `json:"-"`
	TraceId  int64  `json:"traceId"`
	// 如果同时填了 tracedIdStr, 则优先选择 traceIdStr
	TraceIdStr string `json:"traceIdStr"`
}

type ReplyBusyResponse

type ReplyBusyResponse struct {
}

type Room

type Room struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Room roomId 生成器, 获得临时唯一的 roomId

func NewRoom

func NewRoom(node int32) *Room

func (*Room) GetID

func (r *Room) GetID() int32

GetID 递增 1 获得 roomId, 到达 max 后取模归零

type Session

type Session struct {
	TraceId int64
	RTCType int32
	RoomId  int32
	// 超出 Deadline 对方未接就结束通话
	Deadline int64
	// 0=对方未接通, 1=双方正在通话中, 2=通话结束
	Status     int32
	Invitees   []string
	Caller     string
	Timeout    int32
	CreateTime int64
	GroupId    int64
}

func NewSession

func NewSession(RTCType int32, caller string, invitees []string, groupId int64,
	idgenClient *idgen.Client, room *Room) (*Session, error)

type StartCallRequest

type StartCallRequest struct {
	PersonId string   `json:"-"`
	GroupId  string   `json:"groupId"`
	Invitees []string `json:"invitees" binding:"required"`
	RTCType  int32    `json:"RTCType" binding:"oneof=1 2"`
}

type StartCallResponse

type StartCallResponse struct {
	TraceId    int64    `json:"traceId"`
	TraceIdStr string   `json:"traceIdStr"`
	RTCType    int32    `json:"RTCType"`
	Invitees   []string `json:"invitees"`
	Caller     string   `json:"caller"`
	CreateTime int64    `json:"createTime"`
	Timeout    int32    `json:"timeout"`
	Deadline   int64    `json:"deadline"`
	// 0表示私聊, 其他表示群聊
	GroupId string `json:"groupId"`
}

type StopType

type StopType int32
const (
	Busy    StopType = 0
	Timeout StopType = 1
	Reject  StopType = 2
	Hangup  StopType = 3
	Cancel  StopType = 4
)

type User

type User struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

弃用

func NewUser

func NewUser() *User

func (*User) GetStatus

func (u *User) GetStatus(key string) bool

func (*User) SetStatus

func (u *User) SetStatus(key string, isBusy bool) error

Jump to

Keyboard shortcuts

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