owpengram-server/internal/rpc/phone_register.go

47 lines
2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package rpc
import (
"context"
"github.com/gotd/td/tg"
)
// registerPhone 注册通话域 RPC。
//
// 归属约定(跨任务协调,群聊 M0 落地时遵守):本文件是 phone.* 的唯一注册点;
// gotd ServerDispatcher 对同一 RPC 重复 On* 注册是静默 last-wins,群聊 stub
// 清单不得覆盖此处已注册的真实现。messages.getDhConfig 属通话域(DH 参数下发),
// 注册在这里而非 messages_register.go。
func (r *Router) registerPhone(d *tg.ServerDispatcher) {
d.OnMessagesGetDhConfig(r.onMessagesGetDhConfig)
d.OnPhoneRequestCall(r.onPhoneRequestCall)
d.OnPhoneReceivedCall(r.onPhoneReceivedCall)
d.OnPhoneAcceptCall(r.onPhoneAcceptCall)
d.OnPhoneConfirmCall(r.onPhoneConfirmCall)
d.OnPhoneDiscardCall(r.onPhoneDiscardCall)
d.OnPhoneSendSignalingData(r.onPhoneSendSignalingData)
d.OnPhoneSetCallRating(r.onPhoneSetCallRating)
d.OnPhoneSaveCallDebug(r.onPhoneSaveCallDebug)
d.OnPhoneGetCallConfig(func(ctx context.Context) (*tg.DataJSON, error) {
// tgcalls 对空配置走默认值;需要精调(audio_max_bitrate 等)时再填键值。
return &tg.DataJSON{Data: "{}"}, nil
})
// 超级群语音聊天(group call)。
d.OnPhoneCreateGroupCall(r.onPhoneCreateGroupCall)
d.OnPhoneJoinGroupCall(r.onPhoneJoinGroupCall)
d.OnPhoneLeaveGroupCall(r.onPhoneLeaveGroupCall)
d.OnPhoneDiscardGroupCall(r.onPhoneDiscardGroupCall)
d.OnPhoneGetGroupCall(r.onPhoneGetGroupCall)
d.OnPhoneGetGroupParticipants(r.onPhoneGetGroupParticipants)
d.OnPhoneCheckGroupCall(r.onPhoneCheckGroupCall)
d.OnPhoneEditGroupCallParticipant(r.onPhoneEditGroupCallParticipant)
d.OnPhoneEditGroupCallTitle(r.onPhoneEditGroupCallTitle)
d.OnPhoneToggleGroupCallSettings(r.onPhoneToggleGroupCallSettings)
d.OnPhoneInviteToGroupCall(r.onPhoneInviteToGroupCall)
// 屏幕共享(M4):同参与者第二媒体连接。
d.OnPhoneJoinGroupCallPresentation(r.onPhoneJoinGroupCallPresentation)
d.OnPhoneLeaveGroupCallPresentation(r.onPhoneLeaveGroupCallPresentation)
r.registerPhoneStubs(d)
}