Module: Punchblock

Extended by:
ActiveSupport::Autoload
Defined in:
lib/punchblock.rb,
lib/punchblock/ref.rb,
lib/punchblock/event.rb,
lib/punchblock/client.rb,
lib/punchblock/version.rb,
lib/punchblock/command.rb,
lib/punchblock/uri_list.rb,
lib/punchblock/rayo_node.rb,
lib/punchblock/event/end.rb,
lib/punchblock/component.rb,
lib/punchblock/translator.rb,
lib/punchblock/connection.rb,
lib/punchblock/event/dtmf.rb,
lib/punchblock/has_headers.rb,
lib/punchblock/event/offer.rb,
lib/punchblock/command/join.rb,
lib/punchblock/command/dial.rb,
lib/punchblock/command/mute.rb,
lib/punchblock/event/joined.rb,
lib/punchblock/command_node.rb,
lib/punchblock/event/ringing.rb,
lib/punchblock/event/unjoined.rb,
lib/punchblock/event/answered.rb,
lib/punchblock/event/complete.rb,
lib/punchblock/event/asterisk.rb,
lib/punchblock/protocol_error.rb,
lib/punchblock/command/unjoin.rb,
lib/punchblock/command/hangup.rb,
lib/punchblock/command/unmute.rb,
lib/punchblock/command/reject.rb,
lib/punchblock/component/stop.rb,
lib/punchblock/command/answer.rb,
lib/punchblock/command/accept.rb,
lib/punchblock/component/input.rb,
lib/punchblock/connection/xmpp.rb,
lib/punchblock/component/record.rb,
lib/punchblock/component/output.rb,
lib/punchblock/component/prompt.rb,
lib/punchblock/command/redirect.rb,
lib/punchblock/dead_actor_safety.rb,
lib/punchblock/component/send_fax.rb,
lib/punchblock/event/asterisk/ami.rb,
lib/punchblock/component/asterisk.rb,
lib/punchblock/disconnected_error.rb,
lib/punchblock/connection/asterisk.rb,
lib/punchblock/translator/asterisk.rb,
lib/punchblock/event/active_speaker.rb,
lib/punchblock/connection/connected.rb,
lib/punchblock/component/receive_fax.rb,
lib/punchblock/connection/freeswitch.rb,
lib/punchblock/translator/freeswitch.rb,
lib/punchblock/component/asterisk/ami.rb,
lib/punchblock/component/asterisk/agi.rb,
lib/punchblock/event/started_speaking.rb,
lib/punchblock/event/stopped_speaking.rb,
lib/punchblock/component/component_node.rb,
lib/punchblock/translator/asterisk/call.rb,
lib/punchblock/event/asterisk/ami/event.rb,
lib/punchblock/client/component_registry.rb,
lib/punchblock/translator/freeswitch/call.rb,
lib/punchblock/translator/input_component.rb,
lib/punchblock/translator/dtmf_recognizer.rb,
lib/punchblock/actor_has_guarded_handlers.rb,
lib/punchblock/event/input_timers_started.rb,
lib/punchblock/translator/asterisk/channel.rb,
lib/punchblock/translator/asterisk/agi_app.rb,
lib/punchblock/component/asterisk/ami/action.rb,
lib/punchblock/connection/generic_connection.rb,
lib/punchblock/translator/asterisk/component.rb,
lib/punchblock/component/asterisk/agi/command.rb,
lib/punchblock/translator/freeswitch/component.rb,
lib/punchblock/translator/asterisk/unimrcp_app.rb,
lib/punchblock/translator/asterisk/agi_command.rb,
lib/punchblock/translator/asterisk/component/input.rb,
lib/punchblock/translator/asterisk/component/output.rb,
lib/punchblock/translator/asterisk/component/record.rb,
lib/punchblock/translator/freeswitch/component/input.rb,
lib/punchblock/translator/freeswitch/component/output.rb,
lib/punchblock/translator/freeswitch/component/record.rb,
lib/punchblock/translator/asterisk/component/asterisk.rb,
lib/punchblock/translator/asterisk/ami_error_converter.rb,
lib/punchblock/translator/asterisk/component/mrcp_prompt.rb,
lib/punchblock/translator/freeswitch/component/tts_output.rb,
lib/punchblock/translator/freeswitch/component/flite_output.rb,
lib/punchblock/translator/asterisk/component/composed_prompt.rb,
lib/punchblock/translator/asterisk/component/stop_by_redirect.rb,
lib/punchblock/translator/freeswitch/component/abstract_output.rb,
lib/punchblock/translator/asterisk/component/mrcp_recog_prompt.rb,
lib/punchblock/translator/asterisk/component/mrcp_native_prompt.rb,
lib/punchblock/translator/asterisk/component/asterisk/ami_action.rb,
lib/punchblock/translator/asterisk/component/asterisk/agi_command.rb

Defined Under Namespace

Modules: ActorHasGuardedHandlers, Command, Component, Connection, DeadActorSafety, HasHeaders, Translator Classes: Client, CommandNode, DisconnectedError, Event, ProtocolError, RayoNode, Ref, URIList

Constant Summary

Error =

This exception may be raised if a transport error is detected.

Class.new StandardError
BASE_RAYO_NAMESPACE =
'urn:xmpp:rayo'
BASE_ASTERISK_NAMESPACE =
'urn:xmpp:rayo:asterisk'
RAYO_VERSION =
'1'
RAYO_NAMESPACES =
{:core => [BASE_RAYO_NAMESPACE, RAYO_VERSION].compact.join(':')}
VERSION =
"2.5.0"

Class Method Summary collapse

Class Method Details

.client_with_connection(type, options) ⇒ Punchblock::Client

Get a new Punchblock client with a connection attached

Parameters:

  • type (Symbol)

    the connection type (eg :XMPP, :asterisk, :freeswitch)

  • options (Hash)

    the options to pass to the connection (credentials, etc

Returns:



53
54
55
56
57
58
# File 'lib/punchblock.rb', line 53

def client_with_connection(type, options)
  connection = Connection.const_get(type == :xmpp ? 'XMPP' : type.to_s.classify).new options
  Client.new :connection => connection
rescue NameError
  raise ArgumentError, "Connection type #{type.inspect} is not valid."
end

.jruby?Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/punchblock.rb', line 68

def jruby?
  @jruby ||= !!(RUBY_PLATFORM =~ /java/)
end

.loggerObject



33
34
35
# File 'lib/punchblock.rb', line 33

def logger
  @logger || reset_logger
end

.logger=(other) ⇒ Object



37
38
39
# File 'lib/punchblock.rb', line 37

def logger=(other)
  @logger = other
end

.new_request_idObject



64
65
66
# File 'lib/punchblock.rb', line 64

def new_request_id
  new_uuid
end

.new_uuidObject



60
61
62
# File 'lib/punchblock.rb', line 60

def new_uuid
  SecureRandom.uuid
end

.reset_loggerObject



41
42
43
# File 'lib/punchblock.rb', line 41

def reset_logger
  @logger = NullObject.new
end