anchor.diff:  		       [NewBranch]),
   	    Request = State#state.request,
   	    Timeout = State#state.timeout,
  -	    NewDstList = resolve_if_necessary(DstList),
  +	    ApproxMsgSize = State#state.approxmsgsize,
  +	    NewDstList = resolve_if_necessary(DstList, ApproxMsgSize),
   	    [FirstDst | _] = NewDstList,
   	    %% XXX ideally we should not try to contact the same host over UDP, when
   	    %% we receive a transport layer error for TCP, if there were any other
  
positive.code:     end.
  
  %% Do piping between a now existing server and client transaction handler.
  final_start(Branch, ServerHandler, ClientPid, Request, DstList, Timeout) when record(Request, request) ->
      StartTime = util:timestamp(),
      State=#state{branch=Branch, serverhandler=ServerHandler, clienthandler=ClientPid,
  		 request=Request, dstlist=DstList,
  		 timeout=Timeout, endtime = StartTime + Timeout, warntime = StartTime + 300},
      logger:log(debug, "sippipe: All preparations finished, entering pipe loop"),
      loop(State).
  
negative.code: 	    end
      end.
  
  %% Function: resolve_if_necessary/2
  %% Description: Look at the first element of the input DstList. If it
  %%              is a URI instead of a sipdst record, then resolve the
  %%              URI into sipdst record(s) and prepend the new
  %%              record(s) to the input DstList and return the new list
  %% Returns: NewDstList
  %%--------------------------------------------------------------------
  resolve_if_necessary([], _) ->
      [];
  resolve_if_necessary([Dst | T], ApproxMsgSize) when record(Dst, sipdst), Dst#sipdst.proto == undefined; Dst#sipdst.addr == undefined; Dst#sipdst.port == undefined ->
      URI = Dst#sipdst.uri,
      %% This is an incomplete sipdst, it should have it's URI set so we resolve the rest from here
      case URI of
  	_ when record(URI, sipurl) ->
  	    case sipdst:url_to_dstlist(URI, ApproxMsgSize, URI) of
  		DstList when list(DstList) ->
  		    DstList;
  		Unknown ->
  		    logger:log(error, "sippipe: Failed resolving URI ~s : ~p", [sipurl:print(URI), Unknown]),
  		    resolve_if_necessary(T, ApproxMsgSize)
  	    end;
  	InvalidURI ->
  	    logger:log(error, "sippipe: Skipping destination with invalid URI : ~p", [InvalidURI]),
  	    resolve_if_necessary(T, ApproxMsgSize)
      end;
  resolve_if_necessary([Dst | T], _) when record(Dst, sipdst) ->
      [Dst | T];
  resolve_if_necessary([Dst | T], AMS) ->
      logger:log(error, "sippipe: Skipping invalid destination : ~p", [Dst]),
      resolve_if_necessary(T, AMS);
  resolve_if_necessary(Unknown, _) ->
      logger:log(error, "sippipe: Unrecognized destination input data : ~p", [Unknown]),
      [].
  
  