Permalink
Browse files

WHISTLE-1678: ensure flags can be found

  • Loading branch information...
1 parent 0ec723a commit fe9429c66f664f4b1a7412296aa130fe6f59de84 @k-anderson k-anderson committed Oct 3, 2012
Showing with 9 additions and 2 deletions.
  1. +9 −2 whistle_apps/apps/trunkstore/src/ts_from_onnet.erl
View
11 whistle_apps/apps/trunkstore/src/ts_from_onnet.erl
@@ -43,13 +43,20 @@ onnet_data(State) ->
Options = case ts_util:lookup_did(FromUser, AcctID) of
{ok, Opts} -> Opts;
- _ -> wh_json:new()
+ _ ->
+ Username = wh_json:get_value([<<"Custom-Channel-Vars">>, <<"Username">>], JObj, <<>>),
+ Realm = wh_json:get_value([<<"Custom-Channel-Vars">>, <<"Realm">>], JObj, <<>>),
+ case ts_util:lookup_user_flags(Username, Realm, AcctID) of
+ {ok, Opts} -> Opts;
+ _ -> wh_json:new()
+ end
end,
DIDOptions = wh_json:get_value(<<"DID_Opts">>, Options, wh_json:new()),
AcctOptions = wh_json:get_value(<<"account">>, Options, wh_json:new()),
SrvOptions = wh_json:get_value([<<"server">>, <<"options">>], Options, wh_json:new()),
+
MediaHandling = ts_util:get_media_handling([
wh_json:get_value(<<"media_handling">>, DIDOptions)
,wh_json:get_value(<<"media_handling">>, SrvOptions)
@@ -90,7 +97,7 @@ onnet_data(State) ->
,wh_json:get_value(<<"flags">>, SrvOptions)
,wh_json:get_value(<<"flags">>, AcctOptions)
]),
-
+io:format("~p ~p~n", [DIDFlags, SrvOptions]),
Q = ts_callflow:get_my_queue(State),
Command = [ KV

0 comments on commit fe9429c

Please sign in to comment.