anchor.diff:                         inet:ip_address(), inet:port_number(), nksip_lib:proplist()) ->
       {ok, pid(), nksip_transport:transport()} | {error, term()}.
   
  +start_connection(AppId, udp, Ip, Port, Opts) ->
  +    nksip_transport_srv:start_connection(AppId, udp, Ip, Port, Opts);
  +
   start_connection(AppId, Proto, Ip, Port, Opts) ->
       Max = nksip_config:get(max_connections),
       case nksip_counters:value(nksip_transport_tcp) of
  
positive.code: 
  
  %% @private
  do_send(tcp, Pid, SipMsg) -> nksip_transport_tcp:send(Pid, SipMsg);
  do_send(tls, Pid, SipMsg) -> nksip_transport_tcp:send(Pid, SipMsg);
  do_send(sctp, Pid, SipMsg) -> nksip_transport_sctp:send(Pid, SipMsg).
  
  
  %% @private
  
negative.code:             send(AppId, Rest, MakeMsg, Opts)
      end;
  
  send(AppId, [{Proto, Ip, 0}|Rest], MakeMsg, Opts)
      when Proto==udp; Proto==tcp; Proto==tls; Proto==sctp ->
      send(AppId, [{Proto, Ip, default_port(Proto)}|Rest], MakeMsg, Opts);
  
  % send(AppId, [{udp, Ip, Port}|Rest]=All, MakeMsg, Opts) -> 
  %     ?debug(AppId, "Transport send to ~p (udp)", [All]),
  %     Class = case size(Ip) of 4 -> ipv4; 8 -> ipv6 end,
  %     case get_listening(AppId, udp, Class) of
  %         [{Transport1, Pid}|_] -> 
  %             Transport2 = Transport1#transport{remote_ip=Ip, remote_port=Port},
  %             SipMsg = MakeMsg(Transport2),
  %             case nksip_transport_udp:send(Pid, SipMsg) of
  %                 ok -> 
  %                     {ok, SipMsg};
  %                 error -> 
  %                     send(AppId, [{tcp, Ip, Port}|Rest], MakeMsg, Opts)
  %             end;
  %         [] ->
  %             send(AppId, [{tcp, Ip, Port}|Rest], MakeMsg, Opts)
  %     end;
  
  send(AppId, [{Proto, Ip, Port}|Rest]=All, MakeMsg, Opts) 
      when Proto==udp; Proto==tcp; Proto==tls; Proto==sctp ->
      ?debug(AppId, "Transport send to ~p (~p)", [All, Proto]),
      case get_connected(AppId, Proto, Ip, Port) of
          [{Transport, Pid}|_] -> 
              SipMsg = MakeMsg(Transport),
              case do_send(Proto, Pid, SipMsg) of
                  ok -> 
                      {ok, SipMsg};
                  error when Proto==udp ->
                      send(AppId, [{tcp, Ip, Port}|Rest], MakeMsg, Opts);
                  error -> 
                      send(AppId, Rest, MakeMsg, Opts)
              end;
          [] ->
              case start_connection(AppId, Proto, Ip, Port, Opts) of
                  {ok, Pid, Transport} ->
                      SipMsg = MakeMsg(Transport),
                      case do_send(Proto, Pid, SipMsg) of
                          ok -> 
                              {ok, SipMsg};
                          error when Proto==udp ->
                              send(AppId, [{tcp, Ip, Port}|Rest], MakeMsg, Opts);
                          error -> 
                              send(AppId, Rest, MakeMsg, Opts)
                      end;
                  {error, Error} ->
                      ?notice(AppId, "error connecting to ~p:~p (~p): ~p",
  