From b4530a8ea492f7d2e3e3889760f38414e45076bb Mon Sep 17 00:00:00 2001 From: arugaz Date: Thu, 28 Mar 2024 20:31:38 +0700 Subject: [PATCH 1/2] reject incoming call --- call.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/call.go b/call.go index 7a6ffcb2..591e1518 100644 --- a/call.go +++ b/call.go @@ -87,3 +87,21 @@ func (cli *Client) handleCallEvent(node *waBinary.Node) { cli.dispatchEvent(&events.UnknownCallEvent{Node: node}) } } + +// CallReject reject an incoming call. +func (cli *Client) CallReject(callFrom types.JID, callID string) error { + ownID := cli.getOwnID() + if ownID.IsEmpty() { + return ErrNotLoggedIn + } + ownID, callFrom = ownID.ToNonAD(), callFrom.ToNonAD() + return cli.sendNode(waBinary.Node{ + Tag: "call", + Attrs: waBinary.Attrs{"id": cli.GenerateMessageID(), "from": ownID, "to": callFrom}, + Content: []waBinary.Node{{ + Tag: "reject", + Attrs: waBinary.Attrs{"call-id": callID, "call-creator": callFrom, "count": "0"}, + Content: nil, + }}, + }) +} From b63aa8dc9923631433a4f24fae69eb1d72263512 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Tue, 24 Sep 2024 15:34:39 +0300 Subject: [PATCH 2/2] Rename function --- call.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/call.go b/call.go index 591e1518..b67e00d7 100644 --- a/call.go +++ b/call.go @@ -88,8 +88,8 @@ func (cli *Client) handleCallEvent(node *waBinary.Node) { } } -// CallReject reject an incoming call. -func (cli *Client) CallReject(callFrom types.JID, callID string) error { +// RejectCall reject an incoming call. +func (cli *Client) RejectCall(callFrom types.JID, callID string) error { ownID := cli.getOwnID() if ownID.IsEmpty() { return ErrNotLoggedIn