Skip to content

Commit

Permalink
ignore "endpoints" that don't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesaimonetti committed Feb 22, 2018
1 parent 4098e57 commit e644762
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions applications/callflow/src/module/cf_resources.erl
Original file line number Diff line number Diff line change
Expand Up @@ -369,15 +369,20 @@ check_inception(Call) ->

-spec get_privacy_prefs_from_endpoint(kapps_call:call()) -> kz_term:proplist().
get_privacy_prefs_from_endpoint(Call) ->
lager:debug("Call is outbound, checking caller_id_outbound_privacy value"),
{'ok', Endpoint} = kz_endpoint:get(Call),
get_privacy_prefs_from_endpoint(Call, kz_endpoint:get(Call)).

-spec get_privacy_prefs_from_endpoint(kapps_call:call(), {'ok', kz_json:object()} | {'error', any()}) -> kz_term:proplist().
get_privacy_prefs_from_endpoint(Call, {'ok', Endpoint}) ->
lager:debug("call is outbound, checking caller_id_outbound_privacy value"),
case kz_json:get_value([<<"caller_id_options">>, <<"outbound_privacy">>], Endpoint) of
'undefined' ->
[];
'undefined' -> [];
%% can't call kapps_call_command:privacy/2 with Mode = <<"none">>
<<"none">>=NoneMode ->
cf_util:ccvs_by_privacy_mode(NoneMode);
Mode ->
kapps_call_command:privacy(Mode, Call),
cf_util:ccvs_by_privacy_mode(Mode)
end.
end;
get_privacy_prefs_from_endpoint(_Call, {'error', _E}) ->
lager:debug("authorizing endpoint has no privacy settings"),
[].

0 comments on commit e644762

Please sign in to comment.