Skip to content

Commit b4530a8

Browse files
committed
reject incoming call
1 parent 350073d commit b4530a8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

call.go

+18
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,21 @@ func (cli *Client) handleCallEvent(node *waBinary.Node) {
8787
cli.dispatchEvent(&events.UnknownCallEvent{Node: node})
8888
}
8989
}
90+
91+
// CallReject reject an incoming call.
92+
func (cli *Client) CallReject(callFrom types.JID, callID string) error {
93+
ownID := cli.getOwnID()
94+
if ownID.IsEmpty() {
95+
return ErrNotLoggedIn
96+
}
97+
ownID, callFrom = ownID.ToNonAD(), callFrom.ToNonAD()
98+
return cli.sendNode(waBinary.Node{
99+
Tag: "call",
100+
Attrs: waBinary.Attrs{"id": cli.GenerateMessageID(), "from": ownID, "to": callFrom},
101+
Content: []waBinary.Node{{
102+
Tag: "reject",
103+
Attrs: waBinary.Attrs{"call-id": callID, "call-creator": callFrom, "count": "0"},
104+
Content: nil,
105+
}},
106+
})
107+
}

0 commit comments

Comments
 (0)