anchor.diff:  	    NewHeader1 = siprequest:proxy_add_via(Header, OrigURI, ViaParameters, Proto),
   	    NewHeader2 = siprequest:fix_content_length(NewHeader1, Body),
   	    BinLine1 = list_to_binary([Method, " ", sipurl:print(Dst#sipdst.uri), " SIP/2.0"]),
  -	    BinMsg = siprequest:binary_make_message(BinLine1, NewHeader2, list_to_binary(Body)),
  +	    BinMsg = siprequest:binary_make_message(BinLine1, NewHeader2, Body),
   	    SendRes = sipsocket:send(SipSocket, Proto, IP, Port, BinMsg),
   	    case SendRes of
   		ok ->
  -		    logger:log(debug, "Siprequest (transport layer) : sent request(dst=~s) :~n~s~n",
  -			       [DestStr, binary_to_list(BinMsg)]),
  +		    %% Log the request we just sent out. Since we have it in binary format already,
  +		    %% and list operations on big lists are quite expensive, we avoid making it a
  +		    %% list that would then be made a binary again by the logger, by using the
  +		    %% special logger:log_iolist() here.
  +		    LogPrefix1 = <<"Siprequest (transport layer) : sent request(">>,
  +		    LogPrefix2 = io_lib:format("~p bytes, dst=~s) :", [size(BinMsg), DestStr]),
  +		    logger:log_iolist(debug, [LogPrefix1, LogPrefix2, 10, BinMsg, 10]),
   		    TopVia = sipheader:topvia(NewHeader2),
   		    UsedBranch = lists:flatten(sipheader:get_via_branch_full(TopVia)),
   		    {ok, SipSocket, UsedBranch};
   		{error, E} ->
  -		    logger:log(debug, "Siprequest (transport layer) : Failed sending message to ~p:~s:~p, error ~p",
  -			       [Proto, IP, Port, E]),
  +		    %% Don't log the actual request when we fail, since that would fill up our logs
  +		    %% with requests failed for one destination (TCP for example) and then succeeding
  +		    %% for another (UDP for example).
  +		    logger:log(debug, "Siprequest (transport layer) : Failed sending request (~p bytes) to ~p:~s:~p, error ~p",
  +			       [size(BinMsg), Proto, IP, Port, E]),
   		    {error, E}
   	    end
       end.
   
   send_result(RequestHeader, Socket, Body, Status, Reason)
     when is_record(RequestHeader, keylist), is_record(Socket, sipsocket); Socket == none,
  -       is_list(Body), is_integer(Status), is_list(Reason) ->
  +       is_binary(Body); is_list(Body), is_integer(Status), is_list(Reason) ->
       Response1 = #response{status=Status, reason=Reason,
   			  header=siprequest:standardcopy(RequestHeader, [])},
       Response = siprequest:set_response_body(Response1, Body),
  
positive.code: 					Response#response.header, Response#response.body},
      Header = siprequest:fix_content_length(HeaderIn, Body),
      BinLine1 = list_to_binary(["SIP/2.0 ", integer_to_list(Status), " ", Reason]),
      BinMsg = siprequest:binary_make_message(BinLine1, Header, list_to_binary(Body)),
      case sipdst:get_response_destination(TopVia) of
  	Dst when is_record(Dst, sipdst) ->
  	    case get_good_socket(DefaultSocket, Dst#sipdst.proto, Dst#sipdst.addr, Dst#sipdst.port) of
  		SendSocket when is_record(SendSocket, sipsocket) ->
  		    CPid = SendSocket#sipsocket.pid,
  		    SendRes = sipsocket:send(SendSocket, Dst#sipdst.proto, Dst#sipdst.addr, Dst#sipdst.port, BinMsg),
  		    %% Do costly list operations _after_ we sent the response, to reduce latency
  		    logger:log(debug, "send response(~p bytes, sent to=~s (using ~p)) :~n~s~n",
  			       [size(BinMsg), sipdst:dst2str(Dst), CPid, binary_to_list(BinMsg)]),
  		    case SendRes of
  			ok ->
  			    ok;
  
negative.code: 
  send_result(RequestHeader, Socket, Body, Status, Reason, ExtraHeaders)
    when is_record(RequestHeader, keylist), is_record(Socket, sipsocket); Socket == none,
         is_binary(Body); is_list(Body), is_integer(Status), is_list(Reason), is_record(ExtraHeaders, keylist) ->
      Response1 = #response{status=Status, reason=Reason,
  			  header=siprequest:standardcopy(RequestHeader, ExtraHeaders)},
      Response = siprequest:set_response_body(Response1, Body),
  