elixir_agi v0.0.20 ElixirAgi.Agi

This module handles the AGI implementation by reading and writing to/from the source.

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

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_answer

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_channel+status

See: https://wiki.asterisk.org/wiki/display/AST/Application_Dial

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_exec

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_get+data

See: https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+AGICommand_get+full+variable

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_get+option

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_hangup

Returns an AGI struct that uses STDIN and STDOUT

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_record+file

Runs an agi command on a channel

Parameters

  • agi: the agi channel to send command to
  • cmd: Asterisk command name
  • args: List of asterisk command parameters in order of asterisk command docs

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_say+alpha

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_say+date

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_say+datetime TODO: This function needs testing!

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_say+digits

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_say+number

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_say+phonetic

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_say+time

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_set+autohangup

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_set+callerid

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_set+context

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_set+extension

See: https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+AGICommand_set+variable

See: https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+AGICommand_stream+file

See: https://wiki.asterisk.org/wiki/display/AST/Application_Wait

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_wait+for+digit

Types

close()
close() :: function
init()
init() :: function
reader()
reader() :: function
t()
t() :: ElixirAgi.Agi
writer()
writer() :: function

Functions

amd(agi, initial_silence, greeting, after_greeting_silence, total_time, min_word_length, between_words_silence, max_words, silence_threshold, max_word_length)
amd(t, non_neg_integer, non_neg_integer, non_neg_integer, non_neg_integer, non_neg_integer, non_neg_integer, non_neg_integer, non_neg_integer, non_neg_integer) :: ElixirAgi.Agi.Result.t

See: https://wiki.asterisk.org/wiki/display/AST/Application_AMD

answer(agi)

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_answer

channel_status(agi, channel)
channel_status(t, String.t) :: ElixirAgi.Agi.Result.t

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_channel+status

control_stream_file(agi, file, escape_digits \\ "", offset \\ 0, forward_digits \\ "", rewind_digits \\ "", pause_digits \\ "")

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_control+stream+file

dial(agi, dial_string, timeout_seconds, options)
dial(t, String.t, non_neg_integer, [String.t]) :: ElixirAgi.Agi.Result.t

See: https://wiki.asterisk.org/wiki/display/AST/Application_Dial

exec(agi, application, args \\ [])

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_exec

get_data(agi, file, timeout \\ 0, max_digits \\ 0)

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_get+data

get_full_variable(agi, name)
get_full_variable(t, String.t) :: ElixirAgi.Agi.Result.t

See: https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+AGICommand_get+full+variable

get_option(agi, file, escape_digits \\ "", timeout \\ 0)

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_get+option

hangup(agi, channel \\ "")

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_hangup

new(debug \\ false)
new(boolean) :: t

Returns an AGI struct that uses STDIN and STDOUT.

new(init, close, reader, writer, debug)
new(init, close, reader, writer, boolean) :: t

Returns an AGI struct.

read_variables(agi, vars \\ %{})
read_variables(t, Map.t) :: Map.t
record_file(agi, file, format \\ "wav", escape_digits \\ "", timeout \\ 0, offset \\ 0, bool, silence \\ 0)

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_record+file

run(agi, cmd, args)

Runs an agi command on a channel

Parameters

  • agi: the agi channel to send command to
  • cmd: Asterisk command name
  • args: List of asterisk command parameters in order of asterisk command docs
say_alpha(agi, number, escape_digits \\ "")

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_say+alpha

say_date(agi, elapsed_seconds, escape_digits \\ "")

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_say+date

say_datetime(agi, elapsed_seconds, escape_digits \\ "", format \\ "", timezone \\ "")

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_say+datetime TODO: This function needs testing!

say_digits(agi, number, escape_digits \\ "")

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_say+digits

say_number(agi, number, escape_digits \\ "", gender \\ "c")

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_say+number

say_phonetic(agi, string, escape_digits \\ "")

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_say+phonetic

say_time(agi, time, escape_digits \\ "")

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_say+time

set_autohangup(agi, timespan)
set_autohangup(t, Integer.t) :: ElixirAgi.Agi.Result.t

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_set+autohangup

set_callerid(agi, callerid)
set_callerid(t, String.t) :: ElixirAgi.Agi.Result.t

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_set+callerid

set_context(agi, context)
set_context(t, String.t) :: ElixirAgi.Agi.Result.t

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_set+context

set_extension(agi, extension)
set_extension(t, String.t) :: ElixirAgi.Agi.Result.t

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_set+extension

set_variable(agi, name, value)

See: https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+AGICommand_set+variable

stream_file(agi, file, escape_digits \\ "")

See: https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+AGICommand_stream+file

wait(agi, seconds)
wait(t, non_neg_integer) :: ElixirAgi.Agi.Result.t

See: https://wiki.asterisk.org/wiki/display/AST/Application_Wait

wait_for_digit(agi, timeout \\ 0)
wait_for_digit(t, Integer.t) :: ElixirAgi.Agi.Result.t

See: https://wiki.asterisk.org/wiki/display/AST/AGICommand_wait+for+digit

Macros

log(level, message)