feat(call): add media type support to call invite functionality
All checks were successful
Build Backend / build (push) Successful in 12m57s
Build Backend / build-docker (push) Successful in 1m15s

- Updated the WSHandler to include a media type field in the call invite request, allowing differentiation between voice and video calls.
- Modified the CallService interface and implementation to accept the media type parameter during call invitations, enhancing call handling capabilities.
This commit is contained in:
lafay
2026-03-28 01:01:22 +08:00
parent bac3cbbf60
commit 63cfbad65c
2 changed files with 11 additions and 3 deletions

View File

@@ -33,7 +33,7 @@ const (
// CallService 通话服务接口
type CallService interface {
Invite(ctx context.Context, callerID, calleeID, conversationID string) (*model.CallSession, error)
Invite(ctx context.Context, callerID, calleeID, conversationID, mediaType string) (*model.CallSession, error)
Accept(ctx context.Context, callID, userID string) (*model.CallSession, error)
Reject(ctx context.Context, callID, userID string) error
Busy(ctx context.Context, callID, userID string) error
@@ -72,7 +72,7 @@ func NewCallService(
return svc
}
func (s *callService) Invite(ctx context.Context, callerID, calleeID, conversationID string) (*model.CallSession, error) {
func (s *callService) Invite(ctx context.Context, callerID, calleeID, conversationID, mediaType string) (*model.CallSession, error) {
// === Telegram: 检查被叫方是否在线 ===
if !s.hub.HasClients(calleeID) {
return nil, ErrCalleeOffline
@@ -113,6 +113,7 @@ func (s *callService) Invite(ctx context.Context, callerID, calleeID, conversati
"conversation_id": conversationID,
"caller_id": callerID,
"call_type": call.CallType,
"media_type": mediaType,
"created_at": now.UnixMilli(),
"lifetime": CallLifetimeMs,
"ice_servers": s.config.WebRTC.ICEServers,