anchor.diff:      ViaProto = sipsocket:proto2viastr(Proto),
       #via{proto=ViaProto, host=Hostname, port=Port, param=Parameters}.
   
  +%%--------------------------------------------------------------------
  +%% Function: add_record_route(Proto, Hostname, Port, Header)
  +%%           Proto      = term()
  +%%           Hostname   = string()
  +%%           Port       = integer() | none ???
  +%%           Header     = keylist record()
  +%% Descrip.: Prepend a Record-Route header for Proto:Host:Port to the
  +%%           Header keylist.
  +%% Returns : NewHeader = keylist record()
  +%%--------------------------------------------------------------------
   add_record_route(Proto, Hostname, Port, Header) ->
       Param1 = ["maddr=" ++ siphost:myip(), "lr=true"],
       Param2 = case Proto of
  
positive.code: 	_ ->
  	    keylist:prepend({"Record-Route", [Route]}, Header)
      end.
  add_record_route(Header, Origin) when record(Origin, siporigin) ->
      Port = sipserver:get_listenport(Origin#siporigin.proto),
      add_record_route(Origin#siporigin.proto, myhostname(), Port, Header).
  
  standardcopy(Header, ExtraHeaders) ->
      keylist:appendlist(keylist:copy(Header,
  				    ["Via", "From", "To",
  
negative.code:     Out = make_base64_md5_token(In),
      "z9hG4bK-yxa-" ++ Out.
  
  %%--------------------------------------------------------------------
  %% Function: make_answerheader(Header)
  %% Descrip.: Turn Request-Route header from request, into Route header
  %%           to include in a response (answer).
  %% Returns : NewHeader = keylist record()
  %%--------------------------------------------------------------------
  make_answerheader(Header) ->
      RecordRoute = keylist:fetch("Record-Route", Header),
      NewHeader1 = keylist:delete("Record-Route", Header),
      NewHeader2 = case RecordRoute of
  		     [] ->
  			 NewHeader1;
  		     _ ->
  			 keylist:set("Route", RecordRoute, NewHeader1)
  		 end.
  
  %%--------------------------------------------------------------------
  %% Function: get_loop_cookie(Header, OrigURI, Proto)
  %%           Header  = keylist record()
  %%           OrigURI = sipurl record(), original requests URI
  %%           Proto   = term(), the protocol the request was received
  %%           over
  %% Descrip.: Generate a loop detection cookie, RFC3261 16.6 #8.
  %% Returns : Cookie = string()
  %%--------------------------------------------------------------------
  get_loop_cookie(Header, OrigURI, Proto) ->
      OrigURIstr = sipurl:print(OrigURI),
      FromTag = sipheader:get_tag(keylist:fetch("From", Header)),
      ToTag = sipheader:get_tag(keylist:fetch("To", Header)),
      CallId = keylist:fetch("Call-Id", Header),
      {CSeqNum, _} = sipheader:cseq(keylist:fetch("CSeq", Header)),
      ProxyReq = keylist:fetch("Proxy-Require", Header),
      %% We must remove the response part from Proxy-Authorization because it changes with the method
      %% and thus CANCEL does not match INVITE. Contradictingly but implicitly from RFC3261 16.6 #8.
      ProxyAuth = proxyauth_without_response(Header),
      Route = keylist:fetch("Route", Header),
  