elixir_ami v0.0.20 ElixirAmi.Connection

Main module. Connects to Asterisk and allows you to send actions, and receive events and responses.

Copyright 2015 Marcelo Gornstein marcelog@gmail.com

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Summary

Functions

Adds an event listener with the given filter

Waits for an asyncagistart event on an optional channel and starts an agi application with elixir_agi

Closes an AMI connection

GenServer callback

Enables debug

Removes an event listener

GenServer callback

GenServer callback

GenServer callback

GenServer callback

Tests if this connection is open and logged in

Sends an action to asterisk

Starts an AMI connection

Starts and link an AMI connection

GenServer callback

Disables debug

Types

listener_id()
listener_id() :: String.t
listener_option()
listener_option() :: :once
listener_options()
listener_options() :: [listener_option]
t()
t() :: ElixirAmi.Connection

Functions

add_listener(server, filter, listener, options \\ [])
add_listener(GenServer.server, function, function, listener_options) :: listener_id

Adds an event listener with the given filter.

async_agi(server, app_module, app_function, debug, channel \\ nil)
async_agi(GenServer.server, module, atom, boolean, String.t) :: :ok

Waits for an asyncagistart event on an optional channel and starts an agi application with elixir_agi.

close(server)
close(GenServer.server) :: :ok

Closes an AMI connection.

code_change(arg1, state, extra)
code_change(term, state, term) :: {:ok, state}

GenServer callback

debug(server)
debug(GenServer.server) :: :ok

Enables debug.

del_listener(server, id)
del_listener(GenServer.server, listener_id) :: :ok

Removes an event listener.

forward(server, filter, process, options \\ [])
forward(GenServer.server, function, pid, listener_options) :: listener_id

Forward event.

handle_call(msg, from, state)
handle_call(term, term, state) ::
  {:noreply, state} |
  {:reply, term, state}

GenServer callback

handle_cast(msg, state)
handle_cast(term, state) ::
  {:noreply, state} |
  {:stop, :normal, state}

GenServer callback

handle_info(msg, state)
handle_info(term, state) :: {:noreply, state}

GenServer callback

init(args)
init(t) :: {:ok, state}

GenServer callback

ready?(server)
ready?(GenServer.server) :: boolean

Tests if this connection is open and logged in.

send_action(server, action)

Sends an action to asterisk.

start(info)
start(t) :: GenServer.on_start

Starts an AMI connection.

start_link(info)
start_link(t) :: GenServer.on_start

Starts and link an AMI connection.

terminate(reason, state)
terminate(term, state) :: :ok

GenServer callback

undebug(server)
undebug(GenServer.server) :: :ok

Disables debug.

Macros

astsend(action, is_login \\ false)
hostent(args \\ [])
hostent(record, args)
log(level, message)
schedule_reconnect()