Module Adhearsion::VoIP::Asterisk::Commands
In: lib/adhearsion/voip/asterisk/commands.rb
lib/adhearsion/voip/asterisk/menu_command/calculated_match.rb
lib/adhearsion/voip/asterisk/menu_command/matchers.rb
lib/adhearsion/voip/asterisk/menu_command/menu_builder.rb
lib/adhearsion/voip/asterisk/menu_command/menu_class.rb

Methods

Classes and Modules

Module Adhearsion::VoIP::Asterisk::Commands::MenuDigitResponse
Module Adhearsion::VoIP::Asterisk::Commands::SpeechEngines
Class Adhearsion::VoIP::Asterisk::Commands::CalculatedMatch
Class Adhearsion::VoIP::Asterisk::Commands::CalculatedMatchCollection
Class Adhearsion::VoIP::Asterisk::Commands::FixnumMatchCalculator
Class Adhearsion::VoIP::Asterisk::Commands::MatchCalculator
Class Adhearsion::VoIP::Asterisk::Commands::Menu
Class Adhearsion::VoIP::Asterisk::Commands::MenuBuilder
Class Adhearsion::VoIP::Asterisk::Commands::QueueProxy
Class Adhearsion::VoIP::Asterisk::Commands::RangeMatchCalculator
Class Adhearsion::VoIP::Asterisk::Commands::StringMatchCalculator
Class Adhearsion::VoIP::Asterisk::Commands::SymbolMatchCalculator

Constants

TONES = { :busy => "480+620/500,0/500", :dial => "440+480/2000,0/4000", :info => "!950/330,!1400/330,!1800/330,0", :record => "1400/500,0/15000"
RESPONSE_PREFIX = "200 result=" unless defined? RESPONSE_PREFIX
DIAL_STATUSES = Hash.new(:unknown).merge(:answer => :answered, :congestion => :congested, :busy => :busy, :cancel => :cancelled, :noanswer => :unanswered, :chanunavail => :channel_unavailable) unless defined? DIAL_STATUSES

Public Instance methods

Returns the number of seconds the given block takes to execute as a Float. This is particularly useful in dialplans for tracking billable time. Note that if the call is hung up during the block, you will need to rescue the exception if you have some mission-critical logic after it with which you‘re recording this return-value.

Input is used to receive keypad input from the user, pausing until they have entered the desired number of digits (specified with the first parameter) or the timeout has been reached (specified as a hash argument with the key :timeout). By default, there is no timeout, waiting infinitely.

If you desire a sound to be played other than a simple beep to instruct the callee to input data, pass the filename as an hash argument with either the :play or :file key.

When called without any arguments (or a first argument of -1), the user is able to enter digits ad infinitum until they press the pound (#) key.

Note: input() does NOT catch "#" character! Use wait_for_digit instead.

Used to join a particular conference with the MeetMe application. To use MeetMe, be sure you have a proper timing device configured on your Asterisk box. MeetMe is Asterisk‘s built-in conferencing program. More info: www.voip-info.org/wiki-Asterisk+cmd+MeetMe

Returns the status of the last dial(). Possible dial statuses include :answer, :busy, :no_answer, :cancelled, :congested, and :channel_unavailable. If :cancel is returned, the caller hung up before the callee picked up. If :congestion is returned, the dialed extension probably doesn‘t exist. If :channel_unavailable, the callee phone may not be registered.

def dial(number, options={})

  rules = callable_routes_for number
  return :no_route if rules.empty?
  call_attempt_status = nil
  rules.each do |provider|

    response = execute "Dial",
      provider.format_number_for_platform(number),
      timeout_from_dial_options(options),
      asterisk_options_from_dial_options(options)

    call_attempt_status = last_dial_status
    break if call_attempt_status == :answered
  end
  call_attempt_status

end

Plays a tone over the call.

Usage:

 - tone:busy
 - tone:dial
 - tone:info
 - tone:record
 - tone "3333/33,0/15000" # Random custom tone

(www.voip-info.org/wiki/index.php?page=Asterisk+cmd+Playtones)

[Validate]