anchor.diff:              is_list(Disp) andalso is_list(Opts) ->
       case nksip_transport_sup:get_pid(AppId) of
           AppPid when is_pid(AppPid) ->
  -            Ref = {Proto, Ip, Port},
  -            gen_server:call(?MODULE, {start, AppId, AppPid, Ref, Disp, Opts});
  +            case catch cowboy_router:compile(Disp) of
  +                {'EXIT', _} -> 
  +                    {error, invalid_dispatch};
  +                _ ->
  +                    Ref = {Proto, Ip, Port},
  +                    gen_server:call(?MODULE, {start, AppId, AppPid, Ref, Disp, Opts})
  +            end;
           _ ->
               {error, sipapp_not_found}
       end.
  
positive.code:         {value, #server_info{apps=WebApps, pid=WebPid}=Server, Servers1} ->
              Apps1 = case lists:keytake({AppId, Ref}, #app_info.index, Apps) of
                  false -> 
                      Apps;
                  {value, #app_info{mon=AppMon}, RestApps} ->
                      erlang:demonitor(AppMon),
                      RestApps
              end,
              Apps2 = [App|Apps1],
              do_update_server(Ref, Apps2),
              WebApps1 = nksip_lib:store_value(AppId, WebApps),
              Server1 = Server#server_info{apps=WebApps1},
              State1 = State#state{
                  servers = [Server1|Servers1], 
                  apps = Apps2
              },
              {reply, {ok, WebPid}, State1}
      end;
  
  handle_call({stop, AppId, Ref}, _From, State) ->
  
negative.code:          handle_info/2]).
  -export([ranch_start_link/6, do_stop_server/1]).
  
  -type server_ref() :: {nksip:protocol(), inet:ip_address(), inet:port_number()}.
  
  
  %% ===================================================================
  %% Public
  