Packages

Elixir client for the Asterisk AGI protocol. Find the user guide in the github repo at: https://github.com/marcelog/elixir_agi.

Current section

Files

Jump to
elixir_agi lib elixir_agi test_app.ex
Raw

lib/elixir_agi/test_app.ex

defmodule TestApp do
use GenServer
alias ElixirAgi.Agi
require Logger
def start_link(agi, state) do
GenServer.start_link __MODULE__, [agi, state]
end
def init([agi, state]) do
{:ok, %{agi: agi, state: state}, 0}
end
def handle_info(:timeout, state) do
Logger.debug "Starting APP"
Logger.debug "AA: #{inspect Agi.answer(state.agi)}"
Logger.debug "AA: #{inspect Agi.get_full_variable(state.agi, "k1")}"
:timer.sleep 1000
Logger.debug "AA: #{inspect Agi.hangup(state.agi)}"
#Logger.debug "AA: #{inspect Agi.hangup(state.agi)}"
Agi.close state.agi
{:noreply, state}
end
end