mirror of
https://dev.narayana.im/narayana/telegabber.git
synced 2026-08-05 20:17:08 +00:00
34 lines
851 B
Go
34 lines
851 B
Go
package tgsig
|
|
|
|
import (
|
|
"dev.narayana.im/narayana/telegabber/calls/signaling"
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
"github.com/zelenin/go-tdlib/client"
|
|
)
|
|
|
|
// tg-side Callee for TG-originated calls
|
|
type Callee struct {
|
|
callBase
|
|
}
|
|
|
|
// no-op on the tg side; tdlib drives Pending{IsReceived:true} instead
|
|
func (c *Callee) Ringing() {}
|
|
|
|
func (c *Callee) Accept() {
|
|
callID := c.getCallID()
|
|
entry := log.WithFields(log.Fields{"call_id": callID, "user_id": c.userID})
|
|
c.adapter.withCallContext(func() {
|
|
if _, err := c.adapter.tdlib.AcceptCall(&client.AcceptCallRequest{
|
|
CallId: callID,
|
|
Protocol: callProtocol(),
|
|
}); err != nil {
|
|
entry.WithError(err).Error("tgsig.Callee.Accept: AcceptCall failed")
|
|
if b := c.getBridge(); b != nil {
|
|
go b.MediaFailed(signaling.ReasonUnknown)
|
|
}
|
|
return
|
|
}
|
|
entry.Info("AcceptCall issued")
|
|
})
|
|
}
|