Skip to content

Commit

Permalink
changes to address delayed prompts for menus, as well as voicemail bu…
Browse files Browse the repository at this point in the history
…g fix
  • Loading branch information
k-anderson committed Oct 5, 2011
1 parent d5428d1 commit ef67649
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 26 deletions.
5 changes: 5 additions & 0 deletions ecallmgr/src/ecallmgr_call_command.erl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ exec_cmd(Node, UUID, JObj, ControlPID) ->
Result;
{AppName, noop} ->
ControlPID ! {execute_complete, UUID, AppName};
{<<"answer">> = AppName, AppData} ->
send_cmd(Node, UUID, AppName, AppData),
%% 22:55 pyite_mac can you sleep 0.5 seconds before continuing
timer:sleep(500),
ControlPID ! {execute_complete, UUID, AppName};
{AppName, AppData} ->
send_cmd(Node, UUID, AppName, AppData)
end;
Expand Down
29 changes: 15 additions & 14 deletions ecallmgr/src/ecallmgr_call_events.erl
Original file line number Diff line number Diff line change
Expand Up @@ -243,21 +243,22 @@ handle_info({#'basic.deliver'{}, #amqp_msg{props=#'P_basic'{content_type = <<"ap

handle_info(startup, #state{node=Node, uuid=UUID}=State) ->
erlang:monitor_node(Node, true),
?LOG("starting handler on ~s for ~s", [Node, UUID]),
case freeswitch:handlecall(Node, UUID) of
ok ->
?LOG("handling call events for ~s", [Node]),
Q = add_amqp_listener(UUID),
{'noreply', State#state{amqp_q = Q, is_amqp_up = is_binary(Q)}, hibernate};
timeout ->
?LOG("timed out trying to handle events for ~s, trying again", [Node]),
self() ! startup,
{'noreply', State};
{'error', badsession} ->
?LOG("bad session received when handling events for ~s", [Node]),
{'stop', 'normal', State};
_E ->
?LOG("failed to handle call events for ~s: ~p", [Node, _E]),
{'stop', 'normal', State}
ok ->
Q = add_amqp_listener(UUID),
?LOG("call event handler setup complete"),
{'noreply', State#state{amqp_q = Q, is_amqp_up = is_binary(Q)}, hibernate};
timeout ->
?LOG("timed out trying to handle events for ~s, trying again", [Node]),
self() ! startup,
{'noreply', State};
{'error', badsession} ->
?LOG("bad session received when handling events for ~s", [Node]),
{'stop', 'normal', State};
_E ->
?LOG("failed to handle call events for ~s: ~p", [Node, _E]),
{'stop', 'normal', State}
end;

handle_info(#'basic.consume_ok'{}, State) ->
Expand Down
1 change: 0 additions & 1 deletion whistle_apps/apps/callflow/src/module/cf_menu.erl
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ menu_loop(#menu{retries=Retries, prompts=Prompts}, #cf_call{cf_pid=CFPid} = Call
CFPid ! { continue }; %% too many retries, we're out
menu_loop(#menu{retries=Retries, max_length=MaxLength, timeout=Timeout, record_pin=RecordPin, prompts=Prompts}=Menu, Call) ->
try
_ = flush_dtmf(Call),
case b_play_and_collect_digits(<<"1">>, MaxLength, get_prompt(Menu, Call), <<"1">>, Timeout, Call) of
{ok, <<>>} ->
throw(no_digits_collected);
Expand Down
20 changes: 9 additions & 11 deletions whistle_apps/apps/callflow/src/module/cf_voicemail.erl
Original file line number Diff line number Diff line change
Expand Up @@ -181,17 +181,15 @@ check_mailbox(#mailbox{prompts=Prompts, pin = <<>>, exists=true}, Call, _) ->
b_play(Prompts#prompts.no_access, Call);
check_mailbox(#mailbox{prompts=#prompts{enter_password=EnterPass, invalid_login=InvalidLogin}
,pin=Pin}=Box, Call, Loop) ->
{ok, _} = try
%% Request the pin number from the caller but crash if it doesnt match the mailbox
?LOG("requesting pin number to check mailbox"),
{ok, Pin} = b_play_and_collect_digits(<<"1">>, <<"6">>, EnterPass, <<"1">>, Call)
catch
_:R ->
?LOG("invalid mailbox login ~w", [R]),
{ok, _} = b_play(InvalidLogin, Call),
check_mailbox(Box#mailbox{exists=false}, Call, Loop+1)
end,
main_menu(Box, Call).
?LOG("requesting pin number to check mailbox"),
case b_play_and_collect_digits(<<"1">>, <<"6">>, EnterPass, <<"1">>, Call) of
{ok, Pin} ->
main_menu(Box, Call);
{ok, _} ->
?LOG("invalid mailbox login"),
b_play(InvalidLogin, Call),
check_mailbox(Box#mailbox{exists=false}, Call, Loop+1)
end.

%%--------------------------------------------------------------------
%% @private
Expand Down

0 comments on commit ef67649

Please sign in to comment.