BaileysEx.Feature.Call (baileys_ex v0.1.0-alpha.9)

Copy Markdown View Source

Call helpers aligned with Baileys call handling in messages-recv.ts and chats.ts.

Summary

Functions

Create a call link for audio or video.

Parse and emit an inbound call node, cache offer metadata, and send the call ack when opts[:send_node_fun] is available.

Types

call_event()

@type call_event() :: %{
  :chat_id => String.t() | nil,
  :from => String.t() | nil,
  optional(:caller_pn) => String.t() | nil,
  :id => String.t(),
  :date => DateTime.t(),
  :offline => boolean(),
  :status => call_status(),
  optional(:is_video) => boolean(),
  optional(:is_group) => boolean(),
  optional(:group_jid) => String.t() | nil,
  optional(:latency_ms) => integer()
}

call_status()

@type call_status() :: :offer | :ringing | :timeout | :reject | :accept | :terminate

Functions

create_call_link(queryable, type, opts \\ [])

@spec create_call_link(term(), :audio | :video, keyword()) ::
  {:ok, String.t() | nil} | {:error, term()}

Create a call link for audio or video.

handle_node(node, opts \\ [])

@spec handle_node(
  BaileysEx.BinaryNode.t(),
  keyword()
) :: {:ok, call_event()} | {:error, term()}

Parse and emit an inbound call node, cache offer metadata, and send the call ack when opts[:send_node_fun] is available.

reject_call(queryable, call_id, caller_jid, opts \\ [])

@spec reject_call(term(), String.t(), String.t(), keyword()) ::
  {:ok, BaileysEx.BinaryNode.t()} | {:error, term()}

Reject an inbound call.