 
   # Make the command responses somewhat unique.
   socket.on 'CHANNEL_EXECUTE_COMPLETE', ->
-    application = req.body['Application']
-    application_data = req.body['Application-Data']
-    socket.emit "#{event_name} #{application} #{application_data}", req, res
+    application = @body['Application']
+    application_data = @body['Application-Data']
+    socket.emit "#{event_name} #{application} #{application_data}", @
 
   parser.process = (headers,body) ->
     if exports.debug


    super()

# You can use createServer(callback) from your code.
# The callback will receive an eslResponse object.
exports.createServer = (requestListener) -> return new eslServer(requestListener)

exports.createCallServer = -> return new eslServer (res) -> res.start_call_server()

#### ESL client
class eslClient extends net.Socket

      if @buffer.length > 0
        util.log "Buffer is not empty, left over: #{@buffer}"

#### ESL response and associated API
class eslResponse
  constructor: (@socket,@headers,@body) ->

  register_callback: (event,cb) ->
    @socket.on event, (res) =>
      @socket.removeAllListeners event
      cb.apply res

  # A generic way of sending commands to FreeSwitch.
  #
  #      send (string,array,function(){})
  #
  # This is normally not used directly.
  # The array and callback are both optional.
