anchor.diff:      case catch apply(Module, Function, Arguments) of
   	{'EXIT', E} ->
   	    logger:log(error, "=ERROR REPORT==== from ~p:~p :~n~p", [Module, Function, E]),
  -	    true;
  +	    error;
  +	{siperror, Status, Reason} ->
  +	    logger:log(error, "Spawned function ~p:~p generated a SIP-error (ignoring) : ~p ~s",
  +			[Module, Function, Status, Reason]),
  +	    error;
  +	{siperror, Status, Reason, _} ->
  +	    logger:log(error, "Spawned function ~p:~p generated a SIP-error (ignoring) : ~p ~s",
  +			[Module, Function, Status, Reason]),
  +	    error;
   	_ ->
   	    true
       end.
   
  -internal_error(Header, Socket) ->
  -    siprequest:send_result(Header, Socket, "", 500, "Server Internal Error").
  -
  -internal_error(Header, Socket, Code, Text) ->
  -    siprequest:send_result(Header, Socket, "", Code, Text).
  -
  -internal_error(Header, Socket, Code, Text, ExtraHeaders) ->
  -    siprequest:send_result(Header, Socket, "", Code, Text, ExtraHeaders).
  -
  +send_result(Request, Socket, Status, Reason, ExtraHeaders) ->
  +    case transactionlayer:send_response_request(Request, Status, Reason, ExtraHeaders) of
  +	ok -> ok;
  +	_ ->
  +	    {Method, URI, Header, Body} = Request,
  +	    logger:log(error, "Sipserver: Failed sending caught error ~p ~s (in response to ~s ~s) " ++
  +	    		"using transaction layer - sending directly on the socket we received the request on",
  +	    		[Status, Reason, Method, sipurl:print(URI)]),
  +	    transportlayer:send_result(Header, Socket, "", Status, Reason, ExtraHeaders)
  +    end.
  +
  +internal_error(Request, Socket) ->
  +    send_result(Request, Socket, 500, "Server Internal Error", []).
  +
  +internal_error(Request, Socket, Status, Reason) ->
  +    send_result(Request, Socket, Status, Reason, []).
  +
  +internal_error(Request, Socket, Status, Reason, ExtraHeaders) ->
  +    send_result(Request, Socket, Status, Reason, ExtraHeaders).
  +
  +% note: RequestFun and ResponseFun can actually be pids too.
   process(Packet, Socket, Origin, RequestFun, ResponseFun) ->
       {_, IP, _, _} = Origin,
       case parse_packet(Socket, Packet, Origin) of
  
positive.code: 	    case catch my_apply(RequestFun, request, [Method, URL, Header, Body, Socket, IP], LogStr) of
  		{'EXIT', E} ->
  		    logger:log(error, "=ERROR REPORT==== from RequestFun~n~p", [E]),
  		    internal_error(Header, Socket);
  		{siperror, Code, Text} ->
  		    logger:log(error, "INVALID request: ~s -> ~p ~s", [LogStr, Code, Text]),
  		    internal_error(Header, Socket, Code, Text);
  		{siperror, Code, Text, ExtraHeaders} ->
  		    logger:log(error, "INVALID request: ~s -> ~p ~s", [LogStr, Code, Text]),
  		    internal_error(Header, Socket, Code, Text, ExtraHeaders);
  		_ ->
  		    true
  	    end;
  
negative.code:     end,
      case sipserver:get_env(detect_loops, true) of
  	true ->
  	    check_for_loop(Header, URI, Method);	
  	_ ->
  	    true
      end;
  