anchor.diff:  
   %%--------------------------------------------------------------------
   %% Function: process_non_wildcard_contacts(LogTag, SipUser, Location,
  -%%           Header)
  +%%                                         Header, AppName)
   %%           LogTag    = string(),
   %%           SipUser   =
   %%           Locations = list() of contact record(), binding to add for
   %%                       SipUser
  -%%           RequestHeader = keylist record()
  +%%           Header    = keylist record(), REGISTER request header
  +%%           AppName   = atom(), incomingproxy | outgoingproxy
   %% Descrip.: process a SIP Contact entry (thats not a wildcard)
   %%           and do the appropriate db add/rm/update, see:
   %%           RFC 3261 chapter 10.3 - Processing REGISTER Request -
   %%           step 7 for more details
  -%% Returns : -
  -%%--------------------------------------------------------------------
  -process_non_wildcard_contacts(LogTag, SipUser, Locations, RequestHeader) ->
  -    RequestCallId = sipheader:callid(RequestHeader),
  -    {CSeq, _CSeqMethod}  = sipheader:cseq(RequestHeader),
  -    RequestCSeq = list_to_integer(CSeq),
  +%% Returns : void() | throw(...) (throw is either a siperror or a
  +%%                                Mnesia error)
  +%%--------------------------------------------------------------------
  +process_non_wildcard_contacts(LogTag, SipUser, Locations, Header, AppName) ->
  +    CallId = sipheader:callid(Header),
  +    {CSeqStr, _CSeqMethod} = sipheader:cseq(Header),
  +    CSeq = list_to_integer(CSeqStr),
   
       %% get expire value from request header only once, this will speed up the calls to
       %% parse_register_contact_expire/2 that are done for each Locations entry
  -    ExpireHeader = sipheader:expires(RequestHeader),
  -    F = fun(Location) ->
  -		process_non_wildcard_contact(LogTag, SipUser, Location,
  -					     RequestCallId, RequestCSeq, ExpireHeader)
  -	end,
  -    lists:foreach(F, Locations).
  -
  -
  -
  -process_non_wildcard_contact(LogTag, SipUser, Location, RequestCallId, RequestCSeq, ExpireHeader) ->
  +    ExpireHeader = sipheader:expires(Header),
  +    process_non_wildcard_contacts2(LogTag, SipUser, CallId, CSeq, ExpireHeader, AppName, Locations).
  +
  +%% process_non_wildcard_contacts2 - part of process_non_wildcard_contacts()
  +process_non_wildcard_contacts2(LogTag, SipUser, CallId, CSeq, ExpireHeader, AppName, [Location | T]) ->
       {atomic, R} = phone:get_sipuser_location_binding(SipUser, sipurl:parse(Location#contact.urlstr)),
       Priority = 100,
       %% check if SipUser-Location binding exists in database
       case R of
   	[] ->
   	    %% User has no bindings in the location database, register this one
  -	    register_contact(LogTag, SipUser, Location, Priority, ExpireHeader,RequestCallId, RequestCSeq);
  +	    register_contact(LogTag, SipUser, Location, Priority, ExpireHeader, CallId, CSeq, AppName);
   	[SipUserLocation] ->
   	    %% User has exactly one binding in the location database matching this one, do some checking
   	    check_same_call_id(LogTag, SipUser, Location, SipUserLocation, Priority,
  -			       RequestCallId, RequestCSeq, ExpireHeader)
  -    end.
  +			       CallId, CSeq, ExpireHeader, AppName)
  +    end,
  +    process_non_wildcard_contacts2(LogTag, SipUser, CallId, CSeq, ExpireHeader, AppName, T);
  +process_non_wildcard_contacts2(_LogTag, _SipUser, _CallId, _CSeq, _ExpireHeader, _AppName, []) ->
  +    ok.
   
   %% DBLocation = phone record(), currently stored sipuser-location info
   %% ReqLocation = contact record(), sipuser-location binding data in REGISTER request
  -check_same_call_id(LogTag, SipUser, ReqLocation, DBLocation, Priority, RequestCallId, RequestCSeq, ExpireHeader) ->
  -    case RequestCallId == DBLocation#phone.callid of
  +check_same_call_id(LogTag, SipUser, ReqLocation, DBLocation, Priority, CallId, CSeq, ExpireHeader, AppName) ->
  +    case CallId == DBLocation#phone.callid of
   	true ->
   	    %% request has same call-id so a binding already exists
   	    check_greater_cseq(LogTag, SipUser, ReqLocation, DBLocation,
  -			       Priority, RequestCallId, RequestCSeq, ExpireHeader);
  +			       Priority, CallId, CSeq, ExpireHeader, AppName);
   	false ->
   	    %% call-id differs, so the UAC has probably been restarted.
   	    case parse_register_contact_expire(ExpireHeader, ReqLocation) == 0 of
  
positive.code:     Loc1 = #siplocationdb_e{flags=[{priority, 1}], expire=1},
      Loc2 = #siplocationdb_e{flags=[{priority, 2}], expire=2},
      Loc3 = #siplocationdb_e{flags=[{priority, 2}], expire=3},
      
      io:format("test: get_priorities/1 - 1~n"),
      %% normal case
      [1, 2, 2] = get_priorities([Loc0, Loc1, Loc2, Loc3]),
  
negative.code:     ExpireHeader = sipheader:expires(Header),
      parse_register_contact_expire(ExpireHeader, Contact).
  
  
  %%====================================================================
  %% Test functions
  %%====================================================================
  