Sha256: c077d6488d0bf5ad7d2f95d6ff911a1ee8c6ba841710e8669efa5bfc99cfee67
Contents?: true
Size: 1.02 KB
Versions: 16
Compression:
Stored size: 1.02 KB
Contents
module Adhearsion module VoIP module FreeSwitch class BasicConnectionManager def initialize(io) @io = io end # The send-command operator def <<(str) @io.write str + "\n\n" end def get_header separate_pairs get_raw_header end def get_raw_header (returning [] do |lines| until line = @io.gets and line.chomp.empty? lines << line.chomp end end) * "\n" end def next_event header = get_raw_header length = header.first[/\d+$/].to_i # puts "Reading an event of #{length} bytes" separate_pairs @io.read(length) end def separate_pairs(lines) lines.inject({}) do |h,line| returning h do |hash| k,v = line.split(/\s*:\s*/) hash[k] = URI.unescape(v).strip if k && v end end end end end end end
Version data entries
16 entries across 16 versions & 7 rubygems