音视频通话

This commit is contained in:
hawklin2017 2026-04-07 20:03:28 +08:00
parent c074921734
commit f64dfe2e64
5 changed files with 22 additions and 15 deletions

View File

@ -17,11 +17,10 @@ prometheus:
ports: [ 12400 ] ports: [ 12400 ]
liveKit: liveKit:
# LiveKit server address reachable from the RTC service (internal/backend address) # RTC 进程访问 LiveKit HTTP APICreateRoom 等)。本机跑 openim-rpc-rtc、LiveKit 映射 7880 时用 127.0.0.1。
# When deployed via docker-compose, use the service name 'livekit' # 与 livekit 容器同 Docker 网络时用 http://livekit:7880。也可用环境变量 OPENIM_LIVEKIT_INTERNAL_ADDRESS 覆盖。
internalAddress: http://livekit:7880 internalAddress: http://127.0.0.1:7880
# LiveKit server address reachable from clients (external/public address) # 下发给客户端的 WebSocketliveURL。真机填本机局域网 IP也可用 OPENIM_LIVEKIT_EXTERNAL_ADDRESS 覆盖。
# Production should use wss://livekit.example.com with TLS
externalAddress: ws://192.168.1.91:7880 externalAddress: ws://192.168.1.91:7880
# LiveKit API key (configured in your LiveKit server) # LiveKit API key (configured in your LiveKit server)
apiKey: devkey apiKey: devkey

6
go.mod
View File

@ -2,6 +2,10 @@ module github.com/openimsdk/open-im-server/v3
go 1.25.0 go 1.25.0
replace github.com/openimsdk/tools => ../tools
replace github.com/openimsdk/protocol => ./protocol
require ( require (
firebase.google.com/go/v4 v4.14.1 firebase.google.com/go/v4 v4.14.1
github.com/dtm-labs/rockscache v0.1.1 github.com/dtm-labs/rockscache v0.1.1
@ -272,5 +276,3 @@ require (
golang.org/x/crypto v0.48.0 // indirect golang.org/x/crypto v0.48.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect
) )
replace github.com/openimsdk/protocol => ./protocol

2
go.sum
View File

@ -451,8 +451,6 @@ github.com/opencontainers/runc v1.3.3 h1:qlmBbbhu+yY0QM7jqfuat7M1H3/iXjju3VkP9lk
github.com/opencontainers/runc v1.3.3/go.mod h1:D7rL72gfWxVs9cJ2/AayxB0Hlvn9g0gaF1R7uunumSI= github.com/opencontainers/runc v1.3.3/go.mod h1:D7rL72gfWxVs9cJ2/AayxB0Hlvn9g0gaF1R7uunumSI=
github.com/openimsdk/gomake v0.0.17 h1:q8haP48VOH45WhJRiLj1YSBJyUFJqD8CTedH65i1YH8= github.com/openimsdk/gomake v0.0.17 h1:q8haP48VOH45WhJRiLj1YSBJyUFJqD8CTedH65i1YH8=
github.com/openimsdk/gomake v0.0.17/go.mod h1:nnjS8yCtrPJAt1knMbyPiUwCH2gpyBzj/EZAONfUOXg= github.com/openimsdk/gomake v0.0.17/go.mod h1:nnjS8yCtrPJAt1knMbyPiUwCH2gpyBzj/EZAONfUOXg=
github.com/openimsdk/tools v0.0.50-alpha.113 h1:rhLWaSJuhjgJFNVzmpChLCG7dPXS0+bte+CPI0008Us=
github.com/openimsdk/tools v0.0.50-alpha.113/go.mod h1:x9i/e+WJFW4tocy6RNJQ9NofQiP3KJ1Y576/06TqOG4=
github.com/ory/dockertest/v3 v3.12.0 h1:3oV9d0sDzlSQfHtIaB5k6ghUCVMVLpAY8hwrqoCyRCw= github.com/ory/dockertest/v3 v3.12.0 h1:3oV9d0sDzlSQfHtIaB5k6ghUCVMVLpAY8hwrqoCyRCw=
github.com/ory/dockertest/v3 v3.12.0/go.mod h1:aKNDTva3cp8dwOWwb9cWuX84aH5akkxXRvO7KCwWVjE= github.com/ory/dockertest/v3 v3.12.0/go.mod h1:aKNDTva3cp8dwOWwb9cWuX84aH5akkxXRvO7KCwWVjE=
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=

View File

@ -278,7 +278,7 @@ func (och *OnlineHistoryRedisConsumerHandler) handleMsg(ctx context.Context, key
return return
} }
log.ZDebug(ctx, "handleMsg", "BatchInsertChat2Cache", "lastSeq", lastSeq, "isNewConversation", isNewConversation, "userSeqMap", userSeqMap) log.ZDebug(ctx, "handleMsg", "lastSeq", lastSeq, "isNewConversation", isNewConversation, "userSeqMap", userSeqMap)
err = och.msgTransferDatabase.SetHasReadSeqs(ctx, conversationID, userSeqMap) err = och.msgTransferDatabase.SetHasReadSeqs(ctx, conversationID, userSeqMap)
if err != nil { if err != nil {
@ -302,7 +302,7 @@ func (och *OnlineHistoryRedisConsumerHandler) handleMsg(ctx context.Context, key
log.ZWarn(ctx, "get group member ids error", err, "conversationID", log.ZWarn(ctx, "get group member ids error", err, "conversationID",
conversationID) conversationID)
} else { } else {
log.ZDebug(ctx, "handleMsg", "GetGroupMemberIDs", "userIDs", userIDs) log.ZDebug(ctx, "handleMsg GetGroupMemberIDs", "conversationID", conversationID, "userIDs", userIDs)
if err := och.conversationClient.CreateGroupChatConversations(ctx, msg.GroupID, userIDs); err != nil { if err := och.conversationClient.CreateGroupChatConversations(ctx, msg.GroupID, userIDs); err != nil {
log.ZWarn(ctx, "single chat first create conversation error", err, log.ZWarn(ctx, "single chat first create conversation error", err,
@ -332,10 +332,10 @@ func (och *OnlineHistoryRedisConsumerHandler) handleMsg(ctx context.Context, key
log.ZError(ctx, "Msg To MongoDB MQ error", err, "conversationID", log.ZError(ctx, "Msg To MongoDB MQ error", err, "conversationID",
conversationID, "storageList", storageMessageList, "lastSeq", lastSeq) conversationID, "storageList", storageMessageList, "lastSeq", lastSeq)
} }
log.ZDebug(ctx, "handleMsg", "MsgToMongoMQ", "conversationID", conversationID, "storageList", len(storageList), "lastSeq", lastSeq, "key", key) log.ZDebug(ctx, "handleMsg to MsgToMongoMQ", "conversationID", conversationID, "storageList", len(storageList), "lastSeq", lastSeq, "key", key)
och.toPushTopic(ctx, key, conversationID, storageList) och.toPushTopic(ctx, key, conversationID, storageList)
log.ZDebug(ctx, "handleMsg", "toPushTopic", "conversationID", conversationID, "storageList", len(storageList), "key", key) log.ZDebug(ctx, "handleMsg to toPushTopic", "conversationID", conversationID, "storageList", len(storageList), "key", key)
} }
} }

View File

@ -47,7 +47,7 @@ func (s *rtcServer) SignalMessageAssemble(ctx context.Context, req *rtc.SignalMe
) )
switch payload := req.SignalReq.Payload.(type) { switch payload := req.SignalReq.Payload.(type) {
case *rtc.SignalReq_Invite: case *rtc.SignalReq_Invite:
log.ZDebug(ctx, "SignalMessageAssemble", "handleInvite", "payload", payload) log.ZInfo(ctx, "SignalMessageAssemble", "payload", payload.Invite)
r, err := s.handleInvite(ctx, payload.Invite, req.SignalReq) r, err := s.handleInvite(ctx, payload.Invite, req.SignalReq)
resp.Payload = &rtc.SignalResp_Invite{Invite: r} resp.Payload = &rtc.SignalResp_Invite{Invite: r}
respErr = err respErr = err
@ -116,6 +116,7 @@ func (s *rtcServer) handleInvite(ctx context.Context, req *rtc.SignalInviteReq,
content := marshalSignalReq(signalReq) content := marshalSignalReq(signalReq)
for _, inviteeID := range inv.InviteeUserIDList { for _, inviteeID := range inv.InviteeUserIDList {
log.ZInfo(ctx, "sendSignalingNotification to invitee", "sendID", req.UserID, "recvID", inviteeID)
if err := s.sendSignalingNotification(ctx, req.UserID, inviteeID, int32(constant.SingleChatType), req.OfflinePushInfo, content); err != nil { if err := s.sendSignalingNotification(ctx, req.UserID, inviteeID, int32(constant.SingleChatType), req.OfflinePushInfo, content); err != nil {
log.ZWarn(ctx, "sendSignalingNotification to invitee failed", err, "inviteeID", inviteeID) log.ZWarn(ctx, "sendSignalingNotification to invitee failed", err, "inviteeID", inviteeID)
} }
@ -465,8 +466,15 @@ func (s *rtcServer) sendSignalingNotification(ctx context.Context, sendID, recvI
if offlinePush != nil { if offlinePush != nil {
msgData.OfflinePushInfo = offlinePush msgData.OfflinePushInfo = offlinePush
} }
_, err := s.msgClient.MsgClient.SendMsg(ctx, &pbmsg.SendMsgReq{MsgData: msgData}) _, err := s.msgClient.MsgClient.SendMsg(ctx, &pbmsg.SendMsgReq{MsgData: msgData})
return err if err != nil {
log.ZError(ctx, "sendSignalingNotification", err, "msgdata", msgData)
return err
}
log.ZInfo(ctx, "sendSignalingNotification", "msgData", msgData)
return nil
} }
// sendCustomSignalNotification sends a CustomSignalNotification (1605) to a user. // sendCustomSignalNotification sends a CustomSignalNotification (1605) to a user.