Skip to content

Commit

Permalink
Merge pull request #31 from 2600hz/KAZOO-874
Browse files Browse the repository at this point in the history
Kazoo 874 - TTS audit
Put this in v2.13 anyway, so merging it in myself. Don't like it? Blame Canada!
  • Loading branch information
James Aimonetti committed May 2, 2013
2 parents 7d123bc + e1280af commit 2474ca7
Show file tree
Hide file tree
Showing 24 changed files with 918 additions and 822 deletions.
1 change: 1 addition & 0 deletions ecallmgr/src/ecallmgr.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
%% Dialplan-related applications
%% convert from FS-named applications to Kazoo-named Dialplan applications
-define(FS_APPLICATION_NAMES, [{<<"playback">>, <<"play">>}
,{<<"playback">>, <<"tts">>}
,{<<"play-file">>, <<"play">>}
,{<<"play-file-done">>, <<"play">>}
,{<<"play-file-member">>, <<"play">>}
Expand Down
11 changes: 3 additions & 8 deletions ecallmgr/src/ecallmgr_call_command.erl
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,10 @@ get_fs_app(Node, UUID, JObj, <<"tts">>) ->

case wh_json:get_value(<<"Engine">>, JObj, <<"flite">>) of
<<"flite">> -> ecallmgr_fs_flite:call_command(Node, UUID, JObj);
_E ->
lager:debug("engine to use: '~p'", [_E]),
_Engine ->
SayMe = wh_json:get_value(<<"Text">>, JObj),
lager:debug("tts to say: ~s", [SayMe]),
App = play(Node, UUID, wh_json:set_value(<<"Media-Name">>, <<"tts://", SayMe/binary>>, JObj)),
lager:debug("app to use: ~p", [App]),
[App
,{"event", ecallmgr_util:create_masquerade_event(<<"tts">>, <<"CHANNEL_EXECUTE_COMPLETE">>, 'false')}
]
lager:debug("using engine ~s to say: ~s", [_Engine, SayMe]),
play(Node, UUID, wh_json:set_value(<<"Media-Name">>, <<"tts://", SayMe/binary>>, JObj))
end
end;

Expand Down
5 changes: 2 additions & 3 deletions ecallmgr/src/ecallmgr_call_events.erl
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
%%%-------------------------------------------------------------------
%%% @copyright (C) 2010-2013, VoIP INC
%%% @copyright (C) 2010-2013, 2600Hz
%%% @doc
%%% Receive call events from freeSWITCH, publish to the call's event
%%% queue
%%% Receive call events from freeSWITCH, publish to the call's event queue
%%% @end
%%%
%%% @contributors
Expand Down
16 changes: 8 additions & 8 deletions ecallmgr/src/ecallmgr_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
%% send the SendMsg proplist to the freeswitch node
%% @end
%%--------------------------------------------------------------------
-spec send_cmd(atom(), ne_binary(), ne_binary() | string(), ne_binary() | string()) -> send_cmd_ret().
-spec send_cmd(atom(), ne_binary(), text(), text()) -> send_cmd_ret().
send_cmd(Node, UUID, App, Args) when not is_list(App) ->
send_cmd(Node, UUID, wh_util:to_list(App), Args);
send_cmd(Node, UUID, "xferext", Dialplan) ->
Expand Down Expand Up @@ -101,21 +101,21 @@ send_cmd(Node, UUID, "record_call", Args) ->
end;
send_cmd(Node, UUID, "playstop", _Args) ->
lager:debug("execute on node ~s: uuid_break(~s all)", [Node, UUID]),
freeswitch:api(Node, uuid_break, wh_util:to_list(<<UUID/binary, " all">>));
freeswitch:api(Node, 'uuid_break', wh_util:to_list(<<UUID/binary, " all">>));
send_cmd(Node, UUID, "unbridge", _) ->
lager:debug("execute on node ~s: uuid_park(~s)", [Node, UUID]),
freeswitch:api(Node, uuid_park, wh_util:to_list(UUID));
freeswitch:api(Node, 'uuid_park', wh_util:to_list(UUID));
send_cmd(Node, _UUID, "broadcast", Args) ->
lager:debug("execute on node ~s: uuid_broadcast(~s)", [Node, Args]),
Resp = freeswitch:api(Node, uuid_broadcast, wh_util:to_list(iolist_to_binary(Args))),
Resp = freeswitch:api(Node, 'uuid_broadcast', wh_util:to_list(iolist_to_binary(Args))),
lager:debug("broadcast resulted in: ~p", [Resp]),
Resp;
send_cmd(Node, _UUID, "call_pickup", Args) ->
lager:debug("execute on node ~s: uuid_bridge(~s)", [Node, Args]),
freeswitch:api(Node, uuid_bridge, wh_util:to_list(Args));
freeswitch:api(Node, 'uuid_bridge', wh_util:to_list(Args));
send_cmd(Node, UUID, "hangup", _) ->
lager:debug("terminate call on node ~s", [Node]),
freeswitch:api(Node, uuid_kill, wh_util:to_list(UUID));
freeswitch:api(Node, 'uuid_kill', wh_util:to_list(UUID));
send_cmd(Node, UUID, "set", "ecallmgr_Account-ID=" ++ _ = Args) ->
_ = maybe_update_channel_cache(Args, UUID),
send_cmd(Node, UUID, "export", Args);
Expand All @@ -125,7 +125,7 @@ send_cmd(Node, UUID, "set", "ecallmgr_Precedence=" ++ _ = Args) ->
send_cmd(Node, UUID, "conference", Args) ->
Args1 = iolist_to_binary([UUID, " conference:", Args, ",park inline"]),
lager:debug("starting conference on ~s: ~s", [Node, Args1]),
freeswitch:api(Node, uuid_transfer, wh_util:to_list(Args1));
freeswitch:api(Node, 'uuid_transfer', wh_util:to_list(Args1));
send_cmd(Node, UUID, AppName, Args) ->
_ = maybe_update_channel_cache(Args, UUID),
Result = freeswitch:sendmsg(Node, UUID, [{"call-command", "execute"}
Expand Down Expand Up @@ -159,7 +159,7 @@ maybe_update_channel_cache("ecallmgr_Presence-ID=" ++ Value, UUID) ->
maybe_update_channel_cache("ecallmgr_Precedence=" ++ Value, UUID) ->
ecallmgr_fs_channel:set_precedence(UUID, Value);
maybe_update_channel_cache(_, _) ->
ok.
'ok'.

-spec get_expires(wh_proplist()) -> integer().
get_expires(Props) ->
Expand Down
3 changes: 3 additions & 0 deletions lib/whistle-1.0.0/include/wh_types.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
-type api_object() :: wh_json:object() | 'undefined'.
-type api_objects() :: wh_json:objects() | 'undefined'.
-type api_boolean() :: boolean() | 'undefined'.
-type api_atom() :: atom() | 'undefined'.
-type api_string() :: string() | 'undefined'.

-type api_number() :: number() | 'undefined'.
-type api_integer() :: integer() | 'undefined'.
Expand All @@ -39,6 +41,7 @@
-define(NE_BINARY, <<_:8,_/binary>>).
-type ne_binary() :: <<_:8,_:_*8>>.
-type ne_binaries() :: [ne_binary(),...] | [].
-type binaries() :: [binary(),...] | [].

%% when using gen_smtp to send emails, it takes a 5-tuple for a message-body part
-type mail_message_body() :: {ne_binary(), ne_binary(), proplist(), proplist(), ne_binary() | iolist()}.
Expand Down
Loading

0 comments on commit 2474ca7

Please sign in to comment.