call.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // Copyright (c) 2021 Tulir Asokan
  2. //
  3. // This Source Code Form is subject to the terms of the Mozilla Public
  4. // License, v. 2.0. If a copy of the MPL was not distributed with this
  5. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
  6. package events
  7. import (
  8. waBinary "go.mau.fi/whatsmeow/binary"
  9. "go.mau.fi/whatsmeow/types"
  10. )
  11. // CallOffer is emitted when the user receives a call on WhatsApp.
  12. type CallOffer struct {
  13. types.BasicCallMeta
  14. types.CallRemoteMeta
  15. Data *waBinary.Node // The call offer data
  16. }
  17. // CallAccept is emitted when a call is accepted on WhatsApp.
  18. type CallAccept struct {
  19. types.BasicCallMeta
  20. types.CallRemoteMeta
  21. Data *waBinary.Node
  22. }
  23. type CallPreAccept struct {
  24. types.BasicCallMeta
  25. types.CallRemoteMeta
  26. Data *waBinary.Node
  27. }
  28. type CallTransport struct {
  29. types.BasicCallMeta
  30. types.CallRemoteMeta
  31. Data *waBinary.Node
  32. }
  33. // CallOfferNotice is emitted when the user receives a notice of a call on WhatsApp.
  34. // This seems to be primarily for group calls (whereas CallOffer is for 1:1 calls).
  35. type CallOfferNotice struct {
  36. types.BasicCallMeta
  37. Media string // "audio" or "video" depending on call type
  38. Type string // "group" when it's a group call
  39. Data *waBinary.Node
  40. }
  41. // CallRelayLatency is emitted slightly after the user receives a call on WhatsApp.
  42. type CallRelayLatency struct {
  43. types.BasicCallMeta
  44. Data *waBinary.Node
  45. }
  46. // CallTerminate is emitted when the other party terminates a call on WhatsApp.
  47. type CallTerminate struct {
  48. types.BasicCallMeta
  49. Reason string
  50. Data *waBinary.Node
  51. }
  52. // CallReject is sent when the other party rejects the call on WhatsApp.
  53. type CallReject struct {
  54. types.BasicCallMeta
  55. Data *waBinary.Node
  56. }
  57. // UnknownCallEvent is emitted when a call element with unknown content is received.
  58. type UnknownCallEvent struct {
  59. Node *waBinary.Node
  60. }