Permalink
Browse files

KAZOO-813: Fix update callee id when missing account id

  • Loading branch information...
Peter Defebvre
Peter Defebvre committed Apr 9, 2013
1 parent 74b6f1c commit 5433520cea9e7f9ba883915f35f85d44254fa5dd
Showing with 10 additions and 2 deletions.
  1. +1 −1 ecallmgr/src/ecallmgr_fs_authz.erl
  2. +9 −1 whistle_apps/apps/hotornot/src/hon_rater.erl
@@ -611,7 +611,7 @@ authz_identify_req(Props) ->
-spec rating_req(ne_binary(), wh_proplist()) -> wh_proplist().
rating_req(CallId, Props) ->
- AccountId = props:get_value(<<"variable_", ?CHANNEL_VAR_PREFIX, "Account-ID">>, Props),
+ AccountId = props:get_value(?GET_CCV(<<"Account-ID">>), Props),
[{<<"To-DID">>, props:get_value(<<"Caller-Destination-Number">>, Props)}
,{<<"From-DID">>, props:get_value(<<"variable_effective_caller_id_number">>, Props
,props:get_value(<<"Caller-Caller-ID-Number">>, Props))}
@@ -106,7 +106,14 @@ get_rate_cost(Rate) ->
-spec maybe_update_callee_id(wh_json:object()) -> boolean().
maybe_update_callee_id(JObj) ->
- AccountId = wh_json:get_value(<<"Account-ID">>, JObj),
+ AccountId = wh_json:get_value(<<"Account-ID">>, JObj, 'undefined'),
+ case AccountId of
+ 'undefined' -> 'false';
+ Id -> update_callee_id(Id)
+ end.
+
+-spec update_callee_id(wh_json:object()) -> boolean().
+update_callee_id(AccountId) ->
AccountDb = wh_util:format_account_id(AccountId, encoded),
case couch_mgr:open_cache_doc(AccountDb, AccountId) of
{ok, AccountDoc} ->
@@ -115,3 +122,4 @@ maybe_update_callee_id(JObj) ->
lager:debug("failed to load account ~p for update callee id ~p", [AccountId, _R]),
'false'
end.
+

0 comments on commit 5433520

Please sign in to comment.