def create_answer(result_code, opts={})
      fail "Cannot answer an answer" if answer
      
      avps = []
      avps << avp_by_name("Session-Id") unless avp_by_name("Session-Id").nil?
      avps += opts.fetch(:avps, [])
      avps << if opts[:experimental_result_vendor]
                AVP.create("Experimental-Result",
                           [AVP.create("Experimental-Result-Code", result_code),
                            AVP.create("Vendor-Id", opts[:experimental_result_vendor])])
              else
                AVP.create("Result-Code", result_code)
              end
      
      avps += opts.fetch(:copying_avps, []).collect do |name|
        src_avp = avp_by_name(name)

        fail if src_avp.nil?
        
        src_avp.dup
      end

      Message.new(version: version, command_code: command_code, app_id: app_id, hbh: hbh, ete: ete, request: false, proxyable: @proxyable, retransmitted: false, error: false, avps: avps)
    end
def create_answer(result_code, opts={})
      fail "Cannot answer an answer" if answer
      
      avps = []
      avps << avp_by_name("Session-Id") unless avp_by_name("Session-Id").nil?
      avps += opts.fetch(:avps, [])
      avps << if opts[:experimental_result_vendor]
                AVP.create("Experimental-Result",
                           [AVP.create("Experimental-Result-Code", result_code),
                            AVP.create("Vendor-Id", opts[:experimental_result_vendor])])
              else
                AVP.create("Result-Code", result_code)
              end
      
      avps += opts.fetch(:copying_avps, []).collect do |name|
        src_avp = avp_by_name(name)

        fail if src_avp.nil?
        
        src_avp.dup
      end

      Message.new(version: version, command_code: command_code, app_id: app_id, hbh: hbh, ete: ete, request: false, proxyable: @proxyable, retransmitted: false, error: false, avps: avps)
    end
@!endgroup
 Generates an answer to this request, filling in a Result-Code or
 Experimental-Result AVP.

 @param result_code [Fixnum] The value for the Result-Code AVP
 @option opts [Fixnum] experimental_result_vendor
   If given, creates an Experimental-Result AVP with this vendor
   instead of the Result-Code AVP.
 @option opts [Array<String>] copying_avps
   A list of AVP names to copy from the request to the answer.
 @option opts [Array<Diameter::AVP>] avps
   A list of AVP objects to add on the answer.
 @return [Diameter::Message] The response created.