anchor.diff:  	    end,
       mnesia:transaction(F).
   
  +delete_all_calls() ->
  +    F = fun() ->
  +		Q = query
  +			[E || E <- table(call)]
  +		    end,
  +		    A = mnemosyne:eval(Q),
  +		    Delete = fun(O) ->
  +				   mnesia:delete_object(O)
  +			   end,
  +		    lists:foreach(Delete, A)
  +	end,
  +    mnesia:transaction(F).
  +
   list_calls() ->
       F = fun() ->
   		Q = query
  
positive.code: 	    end,
      mnesia:transaction(F).
  
  set_data(CallID, Data) ->
      F = fun() ->
  		Q = query
  			[E || E <- table(call),
  			      E.callid = CallID]
  		    end,
  		A = mnemosyne:eval(Q),
  		Update = fun(O) ->
  
negative.code: 		lists:foreach(Update, A)
  	end,
      mnesia:transaction(F).
  
  fetch_dialogue({CallID, FromTag, none}, Type) ->
      case get_call_type({CallID, FromTag, none}, Type) of
  	{atomic, [Record]} ->
  	    {{CallID, FromTag, none}, Record};
  	{atomic, []} ->
  	     nomatch
      end;
  fetch_dialogue(DialogueID, Type) ->
      case database_call:get_call_type(DialogueID, Type) of
  	{atomic, [Record]} ->
  	    {DialogueID, Record};
  	{atomic, []} ->
  	    {CallID, FromTag, _} = DialogueID,
  	    fetch_dialogue({CallID, FromTag, none}, Type)
      end.
          
  fetch_call(Header, Type) ->
      DialogueID = sipheader:dialogueid(Header),
      case fetch_dialogue(DialogueID, Type) of
  	{_, Call} ->
  	    Call;
  	_ ->
  	    nomatch
      end.
  
  