Skip to content

Commit

Permalink
WHISTLE-1304: removed the system alert for missing contacts, promoted…
Browse files Browse the repository at this point in the history
… log to notice
  • Loading branch information
k-anderson authored and James Aimonetti committed Jun 22, 2012
1 parent d5ed8db commit 3c33787
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
2 changes: 1 addition & 1 deletion ecallmgr/src/ecallmgr_fs_notify.erl
Expand Up @@ -297,7 +297,7 @@ code_change(_OldVsn, State, _Extra) ->
%%--------------------------------------------------------------------
-spec get_endpoint/2 :: (ne_binary(), ne_binary()) -> {'error', 'timeout'} | nonempty_string().
get_endpoint(Username, Realm) ->
case ecallmgr_registrar:lookup_contact(Realm, Username, false) of
case ecallmgr_registrar:lookup_contact(Realm, Username) of
{ok, Contact} ->
RURI = binary:replace(re:replace(Contact, "^[^\@]+", Username, [{return, binary}]), <<">">>, <<"">>),
wh_util:to_list(<<"sip:", (RURI)/binary>>);
Expand Down
15 changes: 2 additions & 13 deletions ecallmgr/src/ecallmgr_registrar.erl
Expand Up @@ -8,7 +8,7 @@
-module(ecallmgr_registrar).

-export([reg_success/2]).
-export([lookup_contact/2, lookup_contact/3]).
-export([lookup_contact/2]).
-export([endpoint_node/2]).
-export([lookup/3]).

Expand All @@ -31,25 +31,14 @@ reg_success(Props, Node) ->
wh_cache:store_local(?ECALLMGR_REG_CACHE, ?NODE_KEY(Realm, Username), Node, ecallmgr_util:get_expires(Props)).

-spec lookup_contact/2 :: (ne_binary(), ne_binary()) -> {'ok', ne_binary()} | {'error', 'timeout'}.
-spec lookup_contact/3 :: (ne_binary(), ne_binary(), boolean()) -> {'ok', ne_binary()} | {'error', 'timeout'}.

lookup_contact(Realm, Username) ->
lookup_contact(Realm, Username, true).

lookup_contact(Realm, Username, Notify) ->
case wh_cache:peek_local(?ECALLMGR_REG_CACHE, ?CONTACT_KEY(Realm, Username)) of
{ok, Contact} -> {ok, Contact};
{error, not_found} ->
case lookup(Realm, Username, [<<"Contact">>]) of
[{<<"Contact">>, Contact}] -> {ok, Contact};
{error, Reason}=E when Notify ->
lager:debug("failed to find registration for ~s@~s: ~p", [Username, Realm, Reason]),
wh_notify:system_alert("Failed to find registration for ~s@~s"
,[Username, Realm]
,[{<<"Reason">>, wh_util:to_binary(Reason)}]),
E;
{error, _R}=E ->
lager:debug("failed to find registration for ~s@~s: ~p", [Username, Realm, _R]),
lager:notice("failed to find registration for ~s@~s: ~p", [Username, Realm, _R]),
E
end
end.
Expand Down

0 comments on commit 3c33787

Please sign in to comment.