Permalink
Browse files

v1.48: patch to trunkstore to handle failed bridge requests and try e…

…ither failover or hangup the call
  • Loading branch information...
1 parent dea730a commit 5c497c4c76d4763c01f8a15c23f931946d6a4329 @jamesaimonetti jamesaimonetti committed Feb 18, 2012
@@ -3,6 +3,9 @@
-define(MILLISECONDS_IN_DAY, 86400000).
-define(SECONDS_IN_DAY, 86400).
+%% Hangup Causes that are fine
+-define(SUCCESSFUL_HANGUPS, [<<"NORMAL_CLEARING">>, <<"ORIGINATOR_CANCEL">>, <<"SUCCESS">>]).
+
-define(IS_JSON_OBJECT,
fun({struct, L}) when is_list(L) ->
lists:all(fun({K, V}) when (is_binary(K) orelse is_atom(K)) andalso
@@ -19,9 +19,6 @@
-define(LIST_BY_NUMBER, {<<"callflow">>, <<"listing_by_number">>}).
-define(LIST_BY_PATTERN, {<<"callflow">>, <<"listing_by_pattern">>}).
-%% Hangup Causes that are fine
--define(SUCCESSFUL_HANGUPS, [<<"NORMAL_CLEARING">>, <<"ORIGINATOR_CANCEL">>, <<"SUCCESS">>]).
-
-define(NO_MATCH_CF, <<"no_match">>).
-define(DEFAULT_TIMEOUT, <<"20">>).
@@ -166,6 +166,15 @@ process_event_for_bridge(#state{aleg_callid=ALeg, my_q=Q, callctl_q=CtlQ}=State,
wh_call_response:send(ALeg, CtlQ, Code, Message),
{hangup, State};
+ {<<"bridge">>, <<"CHANNEL_EXECUTE_COMPLETE">>, <<"call_event">>} ->
+ Resp = wh_json:get_value(<<"Application-Response">>, JObj),
+
+ ?LOG("bridge completed unexpectedly: ~s(~s)", [Resp, wh_json:get_value(<<"Hangup-Cause">>, JObj)]),
+
+ case lists:member(Resp, ?SUCCESSFUL_HANGUPS) of
+ true -> {hangup, State};
+ false -> {error, State}
+ end;
_Unhandled ->
?LOG("Unhandled combo: ~p", [_Unhandled]),
ignore

0 comments on commit 5c497c4

Please sign in to comment.