anchor.diff:      Dialog.
   
   
  +
   %% @private
   -spec timer_update(nksip:request(), nksip:response(), 
                                nksip:dialog(), nksip_call:call()) ->
  
positive.code:     cancel_timer(RetransTimer),
      cancel_timer(TimeoutTimer),
      cancel_timer(RefreshTimer),
      {ReqSE, ReqRefresh} = case nksip_parse:session_expires(Req) of
          {ok, ReqSE0, ReqRefresh0} -> {ReqSE0, ReqRefresh0};
          _ -> {0, undefined}
      end,
      {RespSE, Refresh} = case nksip_parse:session_expires(Resp) of
          {ok, RespSE0, _} when ReqRefresh/=undefined -> {RespSE0, ReqRefresh};
          {ok, RespSE0, RespRefresh0} -> {RespSE0, RespRefresh0};
          _ when ReqRefresh/=undefined -> {0, ReqRefresh};
          _ -> {0, undefined}
      end,
      lager:warning("Req: ~p, Resp: ~p", [ReqSE, RespSE]),
      Time = case {ReqSE, RespSE} of
          {0, 0} -> nksip_config:get_cached(session_expires, AppOpts);
          {TA, 0} -> TA;
          {_, TB} -> TB
      end,
      ToRefresh = if
          Class==uac andalso ReqSE>0 andalso Refresh/=uas -> true;
          Class==uas andalso RespSE>0 andalso Refresh/=uac -> true;
          true -> false
      end,
      lager:warning("REFRESH at ~p: ~p, ~p", [AppId, round(Time/1000), ToRefresh]),
      Invite1 = case ToRefresh of
          true ->
              Invite#invite{
                  retrans_timer = undefined,
                  session_expires = Time,
                  timeout_timer = start_timer(1000*Time, invite_timeout, DialogId),
                  refresh_timer = start_timer(500*Time, invite_refresh, DialogId)
              };
          false ->
              Invite#invite{
                  retrans_timer = undefined,
                  session_expires = undefined,
                  timeout_timer = start_timer(1000*Time, invite_timeout, DialogId),
                  refresh_timer = undefined
              }
      end,
      Dialog#dialog{invite=Invite1};
  
  timer_update(_Req, _Resp, Dialog, Call) ->
      #dialog{id=DialogId, invite=Invite} = Dialog,
  
negative.code: -include("nksip.hrl").
  -include("nksip_call.hrl").
  
  -export([create/4, update/3, stop/3, find/2, store/2, get_meta/3, update_meta/4]).
  -export([timer/3, cast/4]).
  -export_type([sdp_offer/0]).
  
  