Bandwidth.Resources.Bridges

The Bridges resource allows you to bridge two calls together allowing for two way audio between them. A common example is bridging an incoming phone call together with a outgoing phone call.

Bandwidth Docs

Summary

create(client, bridge \\ %{})

Create a bridge

find(client, id)

Get information about an specific bridge

list(client)

Get a list of previous bridges

update(client, id, bridge)

Add one or two calls in a bridge and also put the bridge on hold/unhold

Functions

create(client, bridge \\ %{})

Specs:

  • create(Client.t, Map.t) :: Client.response

Create a bridge.

Example:

case Bandwidth.Resources.Bridges.create(client) do
  {:ok, {201, _, _}} -> IO.puts "Bridge created"
  {:error, reason}   -> IO.puts "Error: #{reason}"
end

Bandwidth Docs

find(client, id)

Specs:

  • find(Client.t, binary) :: Client.response

Get information about an specific bridge.

Example:

case Bandwidth.Resources.Bridges.find(client, "some-bridge-id") do
  {:ok, {200, bridge, _}} -> IO.inspect bridge
  {:error, reason}        -> IO.puts "Error: #{reason}"
end

Bandwidth Docs

list(client)

Specs:

  • list(Client.t) :: Client.response

Get a list of previous bridges.

Example:

case Bandwidth.Resources.Bridges.list(client) do
  {:ok, {200, bridges, _}} -> IO.inspect bridges
  {:error, reason}         -> IO.puts "Error: #{reason}"
end

Bandwidth Docs

update(client, id, bridge)

Specs:

  • update(Client.t, binary, Map.t) :: Client.response

Add one or two calls in a bridge and also put the bridge on hold/unhold.

Example:

# Add call-id-1 and call-id-2 to the bridge
bridge = %{ bridgeAudio: true, callIds: [ "call-id-1", "call-id-2" ] }
case Bandwidth.Resources.Bridges.update(client, "some-bridge-id", bridge) do
  {:ok, {200, _, _}} -> IO.puts "Bridge updated"
  {:error, reason}   -> IO.puts "Error: #{reason}"
end

Bandwidth Docs