Skip to content

Commit

Permalink
WHISTLE-42: do not directly decode JObjs as the data structure has ch…
Browse files Browse the repository at this point in the history
…anged and may again
  • Loading branch information
k-anderson committed Jun 24, 2012
1 parent 89ac23c commit 50fe5c7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions whistle_apps/apps/trunkstore/src/ts_callflow.erl
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ wait_for_win(#ts_callflow_state{aleg_callid=CallID}=State) ->

%% call events come from callevt exchange, ignore for now
{#'basic.deliver'{exchange = <<"targeted">>}, #amqp_msg{payload=Payload}} ->
WinJObj = mochijson2:decode(Payload),
WinJObj = wh_json:decode(Payload),
true = wapi_route:win_v(WinJObj),
CallID = wh_json:get_value(<<"Call-ID">>, WinJObj),

Expand All @@ -113,7 +113,7 @@ wait_for_bridge(State, Timeout) ->
receive
#'basic.consume_ok'{} -> wait_for_bridge(State, Timeout);
{_, #amqp_msg{payload=Payload}} ->
JObj = mochijson2:decode(Payload),
JObj = wh_json:decode(Payload),
case process_event_for_bridge(State, JObj) of
ignore ->
wait_for_bridge(State, Timeout - (timer:now_diff(erlang:now(), Start) div 1000));
Expand Down Expand Up @@ -197,7 +197,7 @@ wait_for_cdr(State, Timeout) ->
receive
#'basic.consume_ok'{} -> wait_for_cdr(State, Timeout);
{_, #amqp_msg{payload=Payload}} ->
JObj = mochijson2:decode(Payload),
JObj = wh_json:decode(Payload),
case process_event_for_cdr(State, JObj) of
{cdr, _, _, _}=CDR -> CDR;
{hangup, State1} ->
Expand Down

0 comments on commit 50fe5c7

Please sign in to comment.