Guava (Guava v0.34.0)

Copy Markdown View Source

The Elixir SDK for the Guava voice-agent platform.

Two layers:

  • Guava.Client — account-level HTTP operations (phone numbers, SMS, outbound-call creation, campaigns).
  • Guava.Agent — a behaviour for handling live voice calls. Define an agent module, then attach it to a channel with Guava.Channel (supervised) or the blocking helpers here (listen_phone/3, call_phone/5, …) for scripts.

See the README and the guides under docs/.

Summary

Types

An E.164 formatted phone number, e.g. "+14155550123".

Functions

Serve an outbound campaign by code. Blocks.

Place an outbound call and handle it with agent. Blocks until the call ends.

Listen for inbound phone calls on agent_number. Blocks.

Listen for inbound SIP calls on sip_code. Blocks.

Listen for inbound WebRTC calls (creates a code when nil). Blocks.

Start one or more Guava.Channel child specs under a supervisor and block until they stop. For scripts/mix run; in an app, add the child specs to your own supervision tree instead.

Types

phone_number()

@type phone_number() :: String.t()

An E.164 formatted phone number, e.g. "+14155550123".

Functions

attach_campaign(agent, campaign_code, opts \\ [])

@spec attach_campaign(module(), String.t(), keyword()) :: :ok

Serve an outbound campaign by code. Blocks.

call_phone(agent, from_number, to_number, variables \\ %{}, opts \\ [])

@spec call_phone(module(), phone_number(), phone_number(), map(), keyword()) :: :ok

Place an outbound call and handle it with agent. Blocks until the call ends.

listen_phone(agent, agent_number, opts \\ [])

@spec listen_phone(module(), phone_number(), keyword()) :: :ok

Listen for inbound phone calls on agent_number. Blocks.

listen_sip(agent, sip_code, opts \\ [])

@spec listen_sip(module(), String.t(), keyword()) :: :ok

Listen for inbound SIP calls on sip_code. Blocks.

listen_webrtc(agent, webrtc_code \\ nil, opts \\ [])

@spec listen_webrtc(module(), String.t() | nil, keyword()) :: :ok

Listen for inbound WebRTC calls (creates a code when nil). Blocks.

run(children)

@spec run(Supervisor.child_spec() | [Supervisor.child_spec()]) :: :ok

Start one or more Guava.Channel child specs under a supervisor and block until they stop. For scripts/mix run; in an app, add the child specs to your own supervision tree instead.

Guava.run({Guava.Channel, agent: MyAgent, listen: {:phone, "+14155550123"}})