Top Level Namespace

Includes:
Punchblock

Defined Under Namespace

Modules: Blather, Punchblock Classes: Hash

Constant Summary collapse

CALL_QUEUES =
{}

Constants included from Punchblock

Punchblock::BASE_RAYO_NAMESPACE, Punchblock::BASE_TROPO_NAMESPACE, Punchblock::RAYO_NAMESPACES, Punchblock::RAYO_VERSION, Punchblock::TransportError, Punchblock::VERSION

Instance Method Summary collapse

Instance Method Details

#run_call(client, offer) ⇒ Object



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'bin/punchblock-console', line 105

def run_call(client, offer)
  ### CALL THREAD
  # One thread is spun up to handle each call.
  Thread.new do
    raise "Unknown call #{offer.call_id}" unless CALL_QUEUES.has_key?(offer.call_id)
    queue = CALL_QUEUES[offer.call_id]
    call = queue.pop
    dsl = DSL.new client, offer.call_id, queue

    puts "Incoming offer to #{offer.to} from #{offer.headers_hash[:from]} #{offer}"
    dsl.pry

    # Clean up the queue.
    CALL_QUEUES[offer.call_id] = nil
  end
end