Permalink
Browse files

Merge branch 'v2.02'

Conflicts:
	lib/rabbitmq_server-2.8.6/deps.mk
  • Loading branch information...
2 parents d70091a + edc33f5 commit c1bc9085b31b158610ed43e9fbfc6b065a2cddc2 @jamesaimonetti jamesaimonetti committed Sep 24, 2012
Showing with 871 additions and 406 deletions.
  1. +1 −0 .gitignore
  2. +8 −8 ecallmgr/src/ecallmgr_authz.erl
  3. +10 −5 ecallmgr/src/ecallmgr_fs_node.erl
  4. +20 −11 ecallmgr/src/ecallmgr_fs_query.erl
  5. +0 −124 lib/rabbitmq_server-2.8.6/deps.mk
  6. +2 −2 lib/whistle-1.0.0/src/api/wapi_rate.erl
  7. +5 −1 lib/whistle-1.0.0/src/wh_json.erl
  8. +14 −6 lib/whistle-1.0.0/src/wh_util.erl
  9. +3 −1 lib/whistle_couch-1.0.0/Makefile
  10. +2 −7 lib/whistle_couch-1.0.0/src/couch_util.erl
  11. +6 −1 whistle_apps/apps/acdc/Makefile
  12. +26 −30 whistle_apps/apps/acdc/src/acdc_agent.erl
  13. +124 −25 whistle_apps/apps/acdc/src/acdc_agent_fsm.erl
  14. +18 −11 whistle_apps/apps/acdc/src/acdc_agent_handler.erl
  15. +8 −9 whistle_apps/apps/acdc/src/acdc_agent_manager.erl
  16. +6 −3 whistle_apps/apps/acdc/src/acdc_agents_sup.erl
  17. +50 −7 whistle_apps/apps/acdc/src/acdc_queue.erl
  18. +208 −20 whistle_apps/apps/acdc/src/acdc_queue_fsm.erl
  19. +60 −40 whistle_apps/apps/acdc/src/acdc_queue_handler.erl
  20. +1 −1 whistle_apps/apps/acdc/src/acdc_queue_manager.erl
  21. +1 −1 whistle_apps/apps/acdc/src/acdc_queues_sup.erl
  22. +115 −28 whistle_apps/apps/acdc/src/acdc_stats.erl
  23. +10 −4 whistle_apps/apps/acdc/src/acdc_util.erl
  24. +7 −8 whistle_apps/apps/acdc/src/wapi_acdc_agent.erl
  25. +84 −26 whistle_apps/apps/acdc/src/wapi_acdc_queue.erl
  26. +6 −4 whistle_apps/apps/callflow/src/module/cf_acdc_agent.erl
  27. +24 −10 whistle_apps/apps/callflow/src/module/cf_acdc_member.erl
  28. +1 −3 whistle_apps/apps/callflow/src/module/cf_voicemail.erl
  29. +5 −3 whistle_apps/apps/crossbar/src/modules/cb_agents.erl
  30. +46 −7 whistle_apps/apps/crossbar/src/modules/cb_queues.erl
View
@@ -30,3 +30,4 @@ utils/*/ebin/*.app
whistle_apps/erl_crash.dump
ecallmgr/erl_crash.dump
/utils/sup/deps/getopt/
+/lib/rabbitmq_server-2.8.6/deps.mk
@@ -1,10 +1,11 @@
%%%-------------------------------------------------------------------
-%%% @author James Aimonetti <james@2600hz.org>
-%%% @copyright (C) 2011, VoIP, INC
+%%% @copyright (C) 2011-2012, VoIP, INC
%%% @doc
%%% Make a request for authorization, and answer queries about the CallID
%%% @end
-%%% Created : 7 Jul 2011 by James Aimonetti <james@2600hz.org>
+%%% @contributors
+%%% James Aimonetti
+%%% Karl Anderson
%%%-------------------------------------------------------------------
-module(ecallmgr_authz).
@@ -151,12 +152,11 @@ rate_channel(Props) ->
ReqResp = wh_amqp_worker:call(?ECALLMGR_AMQP_POOL
,rating_req(CallId, Props)
,fun wapi_rate:publish_req/1
- ,fun wapi_rate:resp_v/1),
+ ,fun wapi_rate:resp_v/1
+ ),
case ReqResp of
- {error, _R} ->
- lager:debug("rate request lookup failed: ~p", [_R]);
- {ok, RespJObj} ->
- set_rating_ccvs(RespJObj)
+ {error, _R} -> lager:debug("rate request lookup failed: ~p", [_R]);
+ {ok, RespJObj} -> set_rating_ccvs(RespJObj)
end.
-spec kill_channel/2 :: (wh_proplist(), atom()) -> 'ok'.
@@ -401,8 +401,7 @@ run_start_cmds(Node) ->
Res = process_cmds(Node, Cmds),
case lists:filter(fun was_not_successful_cmd/1, Res) of
[] -> ok;
- Errs ->
- print_api_responses(Errs)
+ Errs -> print_api_responses(Errs)
end
end).
@@ -429,16 +428,22 @@ process_cmd(Node, JObj, Acc0) ->
process_cmd(Node, ApiCmd, ApiArg, Acc)
end, Acc0, wh_json:to_proplist(JObj)).
-process_cmd(Node, ApiCmd0, ApiArg0, Acc) ->
+process_cmd(Node, ApiCmd0, ApiArg, Acc) ->
+ process_cmd(Node, ApiCmd0, ApiArg, Acc, list).
+process_cmd(Node, ApiCmd0, ApiArg, Acc, ArgFormat) ->
ApiCmd = wh_util:to_atom(wh_util:to_binary(ApiCmd0), ?FS_CMD_SAFELIST),
- ApiArg = wh_util:to_list(ApiArg0),
- case freeswitch:api(Node, ApiCmd, wh_util:to_list(ApiArg)) of
+ case freeswitch:api(Node, ApiCmd, format_args(ArgFormat, ApiArg)) of
{ok, FSResp} ->
process_resp(ApiCmd, ApiArg, binary:split(FSResp, <<"\n">>, [global]), Acc);
+ {error, badarg} when ArgFormat =:= list ->
+ process_cmd(Node, ApiCmd0, ApiArg, Acc, binary);
{error, _}=E -> [E|Acc];
timeout -> [{timeout, {ApiCmd, ApiArg}} | Acc]
end.
+format_args(list, Args) -> wh_util:to_list(Args);
+format_args(binary, Args) -> wh_util:to_binary(Args).
+
process_resp(ApiCmd, ApiArg, [<<>>|Resps], Acc) ->
process_resp(ApiCmd, ApiArg, Resps, Acc);
process_resp(ApiCmd, ApiArg, [<<"+OK Reloading XML">>|Resps], Acc) ->
@@ -118,7 +118,7 @@ handle_call_status(JObj, _Props) ->
{error, not_found} ->
lager:debug("no node found with channel ~s, but we are not authoritative", [CallID]);
{ok, Channel} ->
- Node = wh_json:get_binary_value(<<"node">>, Channel),
+ Node = wh_json:get_atom_value(<<"node">>, Channel),
case uuid_dump(Node, CallID) of
error ->
lager:debug("failed to get channel info for ~s", [CallID]),
@@ -259,16 +259,18 @@ code_change(_OldVsn, State, _Extra) ->
%%%===================================================================
%%% Internal functions
%%%===================================================================
--spec create_call_status_resp/2 :: (proplist(), boolean()) -> proplist().
+-spec create_call_status_resp/2 :: (wh_proplist(), boolean()) -> wh_proplist().
create_call_status_resp(Props, true) ->
{OLCIName, OLCINum} = case props:get_value(<<"Other-Leg-Direction">>, Props) of
<<"outbound">> ->
{props:get_value(<<"Other-Leg-Callee-ID-Name">>, Props)
,props:get_value(<<"Other-Leg-Callee-ID-Number">>, Props)};
<<"inbound">> ->
{props:get_value(<<"Other-Leg-Caller-ID-Name">>, Props)
- ,props:get_value(<<"Other-Leg-Caller-ID-Number">>, Props)}
- end,
+ ,props:get_value(<<"Other-Leg-Caller-ID-Number">>, Props)};
+ undefined ->
+ {undefined, undefined}
+ end,
[{<<"Msg-ID">>, props:get_value(<<"Event-Date-Timestamp">>, Props)}
,{<<"Status">>, <<"active">>}
,{<<"Timestamp">>, props:get_value(<<"Event-Date-Timestamp">>, Props)}
@@ -292,8 +294,10 @@ create_call_status_resp(Props, false) ->
,props:get_value(<<"Caller-Callee-ID-Number">>, Props)};
<<"inbound">> ->
{props:get_value(<<"Caller-Caller-ID-Name">>, Props)
- ,props:get_value(<<"Caller-Caller-ID-Number">>, Props)}
- end,
+ ,props:get_value(<<"Caller-Caller-ID-Number">>, Props)};
+ undefined ->
+ {undefined, undefined}
+ end,
[{<<"Msg-ID">>, props:get_value(<<"Event-Date-Timestamp">>, Props)}
,{<<"Status">>, <<"active">>}
,{<<"Timestamp">>, props:get_value(<<"Event-Date-Timestamp">>, Props)}
@@ -311,14 +315,19 @@ create_call_status_resp(Props, false) ->
,{<<"Presence-ID">>, props:get_value(<<"variable_presence_id">>, Props)}
| wh_api:default_headers(?APP_NAME, ?APP_VERSION)].
--spec uuid_dump/2 :: (atom(), string() | binary()) -> {'ok', proplist()} |
- 'error'.
+-spec uuid_dump/2 :: (atom(), string() | binary()) ->
+ {'ok', wh_proplist()} |
+ 'error'.
uuid_dump(Node, UUID) ->
- case catch(freeswitch:api(Node, uuid_dump, wh_util:to_list(UUID))) of
+ uuid_dump(Node, UUID, wh_util:to_list(UUID)).
+uuid_dump(Node, UUID, ID) ->
+ case catch freeswitch:api(Node, 'uuid_dump', ID) of
{'ok', Result} ->
Props = ecallmgr_util:eventstr_to_proplist(Result),
{ok, Props};
+ {'EXIT', {'badarg', _}} when is_list(ID) ->
+ uuid_dump(Node, UUID, wh_util:to_binary(UUID));
_Else ->
- lager:debug("failed to get result from uuid_dump(~s): ~p", [UUID, _Else]),
- error
+ lager:debug("failed to get result from uuid_dump(~p) on ~p: ~p", [UUID, Node, _Else]),
+ 'error'
end.
@@ -1,124 +0,0 @@
-ebin/rabbit_access_control.beam: src/rabbit_access_control.erl include/rabbit.hrl
-ebin/gm_soak_test.beam: src/gm_soak_test.erl include/gm_specs.hrl ebin/gm.beam
-ebin/gm_speed_test.beam: src/gm_speed_test.erl include/gm_specs.hrl ebin/gm.beam
-ebin/rabbit_channel_sup.beam: src/rabbit_channel_sup.erl ebin/supervisor2.beam include/rabbit.hrl
-ebin/rabbit_amqqueue_sup.beam: src/rabbit_amqqueue_sup.erl ebin/supervisor2.beam include/rabbit.hrl
-ebin/rabbit_backing_queue.beam: src/rabbit_backing_queue.erl
-ebin/rabbit_parameter_validation.beam: src/rabbit_parameter_validation.erl
-ebin/rabbit_queue_collector.beam: src/rabbit_queue_collector.erl include/rabbit.hrl
-ebin/rabbit_tests.beam: src/rabbit_tests.erl include/rabbit.hrl include/rabbit_framing.hrl
-ebin/rabbit_auth_mechanism_cr_demo.beam: src/rabbit_auth_mechanism_cr_demo.erl ebin/rabbit_auth_mechanism.beam include/rabbit.hrl
-ebin/rabbit_backing_queue_qc.beam: src/rabbit_backing_queue_qc.erl
-ebin/rabbit_limiter.beam: src/rabbit_limiter.erl ebin/gen_server2.beam
-ebin/rabbit_plugins_main.beam: src/rabbit_plugins_main.erl include/rabbit.hrl
-ebin/rabbit_version.beam: src/rabbit_version.erl
-ebin/rabbit_channel.beam: src/rabbit_channel.erl include/rabbit.hrl ebin/gen_server2.beam include/rabbit_framing.hrl
-ebin/rabbit_error_logger.beam: src/rabbit_error_logger.erl include/rabbit.hrl include/rabbit_framing.hrl
-ebin/supervisor2.beam: src/supervisor2.erl
-ebin/rabbit_amqqueue.beam: src/rabbit_amqqueue.erl include/rabbit.hrl
-ebin/rabbit_sasl_report_file_h.beam: src/rabbit_sasl_report_file_h.erl
-ebin/delegate_sup.beam: src/delegate_sup.erl
-ebin/rabbit_trace.beam: src/rabbit_trace.erl include/rabbit.hrl include/rabbit_framing.hrl
-ebin/worker_pool_sup.beam: src/worker_pool_sup.erl
-ebin/mirrored_supervisor.beam: src/mirrored_supervisor.erl ebin/supervisor2.beam ebin/gen_server2.beam
-ebin/rabbit_disk_monitor.beam: src/rabbit_disk_monitor.erl
-ebin/rabbit_exchange_type_invalid.beam: src/rabbit_exchange_type_invalid.erl ebin/rabbit_exchange_type.beam include/rabbit.hrl
-ebin/rabbit_msg_store_index.beam: src/rabbit_msg_store_index.erl include/rabbit_msg_store.hrl include/rabbit.hrl
-ebin/rabbit_plugins.beam: src/rabbit_plugins.erl include/rabbit.hrl
-ebin/pg2_fixed.beam: src/pg2_fixed.erl
-ebin/rabbit_alarm.beam: src/rabbit_alarm.erl
-ebin/rabbit_auth_backend_internal.beam: src/rabbit_auth_backend_internal.erl ebin/rabbit_auth_backend.beam include/rabbit.hrl
-ebin/rabbit_control_main.beam: src/rabbit_control_main.erl include/rabbit.hrl
-ebin/rabbit_exchange_decorator.beam: src/rabbit_exchange_decorator.erl
-ebin/rabbit_msg_store_ets_index.beam: src/rabbit_msg_store_ets_index.erl ebin/rabbit_msg_store_index.beam include/rabbit_msg_store.hrl include/rabbit.hrl
-ebin/rabbit_node_monitor.beam: src/rabbit_node_monitor.erl
-ebin/delegate.beam: src/delegate.erl ebin/gen_server2.beam
-ebin/rabbit_auth_mechanism_amqplain.beam: src/rabbit_auth_mechanism_amqplain.erl ebin/rabbit_auth_mechanism.beam include/rabbit.hrl
-ebin/rabbit_exchange_type_fanout.beam: src/rabbit_exchange_type_fanout.erl ebin/rabbit_exchange_type.beam include/rabbit.hrl
-ebin/rabbit_file.beam: src/rabbit_file.erl
-ebin/rabbit_framing_amqp_0_8.beam: src/rabbit_framing_amqp_0_8.erl include/rabbit_framing.hrl
-ebin/rabbit_heartbeat.beam: src/rabbit_heartbeat.erl include/rabbit.hrl
-ebin/rabbit_memory_monitor.beam: src/rabbit_memory_monitor.erl ebin/gen_server2.beam
-ebin/rabbit_mirror_queue_slave_sup.beam: src/rabbit_mirror_queue_slave_sup.erl ebin/supervisor2.beam include/rabbit.hrl
-ebin/rabbit_restartable_sup.beam: src/rabbit_restartable_sup.erl include/rabbit.hrl
-ebin/rabbit_sup.beam: src/rabbit_sup.erl include/rabbit.hrl
-ebin/rabbit_tests_event_receiver.beam: src/rabbit_tests_event_receiver.erl include/rabbit.hrl
-ebin/rabbit_upgrade_functions.beam: src/rabbit_upgrade_functions.erl
-ebin/worker_pool.beam: src/worker_pool.erl ebin/gen_server2.beam
-ebin/file_handle_cache.beam: src/file_handle_cache.erl ebin/gen_server2.beam
-ebin/priority_queue.beam: src/priority_queue.erl
-ebin/rabbit_binary_generator.beam: src/rabbit_binary_generator.erl include/rabbit.hrl include/rabbit_framing.hrl
-ebin/rabbit_binding.beam: src/rabbit_binding.erl include/rabbit.hrl
-ebin/rabbit_direct.beam: src/rabbit_direct.erl include/rabbit.hrl
-ebin/rabbit_exchange.beam: src/rabbit_exchange.erl include/rabbit.hrl include/rabbit_framing.hrl
-ebin/rabbit_msg_store.beam: src/rabbit_msg_store.erl include/rabbit_msg_store.hrl include/rabbit.hrl ebin/gen_server2.beam
-ebin/rabbit_reader.beam: src/rabbit_reader.erl include/rabbit.hrl include/rabbit_framing.hrl
-ebin/supervisor2_tests.beam: src/supervisor2_tests.erl ebin/supervisor2.beam
-ebin/tcp_acceptor_sup.beam: src/tcp_acceptor_sup.erl
-ebin/mnesia_sync.beam: src/mnesia_sync.erl
-ebin/pg_local.beam: src/pg_local.erl
-ebin/rabbit_auth_mechanism.beam: src/rabbit_auth_mechanism.erl
-ebin/rabbit_client_sup.beam: src/rabbit_client_sup.erl ebin/supervisor2.beam include/rabbit.hrl
-ebin/rabbit_msg_file.beam: src/rabbit_msg_file.erl include/rabbit_msg_store.hrl include/rabbit.hrl
-ebin/rabbit_plugins_usage.beam: src/rabbit_plugins_usage.erl
-ebin/gm.beam: src/gm.erl ebin/gen_server2.beam
-ebin/rabbit_auth_backend.beam: src/rabbit_auth_backend.erl
-ebin/rabbit_auth_mechanism_plain.beam: src/rabbit_auth_mechanism_plain.erl ebin/rabbit_auth_mechanism.beam include/rabbit.hrl
-ebin/rabbit.beam: src/rabbit.erl include/rabbit.hrl include/rabbit_framing.hrl
-ebin/rabbit_framing_amqp_0_9_1.beam: src/rabbit_framing_amqp_0_9_1.erl include/rabbit_framing.hrl
-ebin/rabbit_guid.beam: src/rabbit_guid.erl
-ebin/rabbit_mirror_queue_slave.beam: src/rabbit_mirror_queue_slave.erl include/gm_specs.hrl ebin/gm.beam include/rabbit.hrl ebin/gen_server2.beam
-ebin/rabbit_nodes.beam: src/rabbit_nodes.erl
-ebin/rabbit_registry.beam: src/rabbit_registry.erl
-ebin/worker_pool_worker.beam: src/worker_pool_worker.erl ebin/gen_server2.beam
-ebin/mirrored_supervisor_tests.beam: src/mirrored_supervisor_tests.erl ebin/mirrored_supervisor.beam
-ebin/rabbit_command_assembler.beam: src/rabbit_command_assembler.erl include/rabbit.hrl include/rabbit_framing.hrl
-ebin/rabbit_exchange_type.beam: src/rabbit_exchange_type.erl
-ebin/rabbit_framing.beam: src/rabbit_framing.erl
-ebin/rabbit_misc.beam: src/rabbit_misc.erl include/rabbit.hrl include/rabbit_framing.hrl
-ebin/rabbit_msg_store_gc.beam: src/rabbit_msg_store_gc.erl include/rabbit.hrl ebin/gen_server2.beam
-ebin/rabbit_queue_index.beam: src/rabbit_queue_index.erl include/rabbit.hrl
-ebin/rabbit_runtime_parameter.beam: src/rabbit_runtime_parameter.erl
-ebin/rabbit_vhost.beam: src/rabbit_vhost.erl include/rabbit.hrl
-ebin/tcp_acceptor.beam: src/tcp_acceptor.erl
-ebin/test_sup.beam: src/test_sup.erl ebin/supervisor2.beam
-ebin/credit_flow.beam: src/credit_flow.erl
-ebin/gen_server2.beam: src/gen_server2.erl
-ebin/pmon.beam: src/pmon.erl
-ebin/rabbit_channel_sup_sup.beam: src/rabbit_channel_sup_sup.erl ebin/supervisor2.beam
-ebin/rabbit_connection_sup.beam: src/rabbit_connection_sup.erl ebin/supervisor2.beam include/rabbit.hrl
-ebin/rabbit_ctl_usage.beam: src/rabbit_ctl_usage.erl
-ebin/rabbit_net.beam: src/rabbit_net.erl include/rabbit.hrl
-ebin/rabbit_runtime_parameters.beam: src/rabbit_runtime_parameters.erl include/rabbit.hrl
-ebin/vm_memory_monitor.beam: src/vm_memory_monitor.erl
-ebin/rabbit_basic.beam: src/rabbit_basic.erl include/rabbit.hrl include/rabbit_framing.hrl
-ebin/rabbit_event.beam: src/rabbit_event.erl include/rabbit.hrl
-ebin/rabbit_exchange_type_topic.beam: src/rabbit_exchange_type_topic.erl ebin/rabbit_exchange_type.beam include/rabbit.hrl
-ebin/rabbit_mirror_queue_coordinator.beam: src/rabbit_mirror_queue_coordinator.erl include/gm_specs.hrl ebin/gm.beam include/rabbit.hrl ebin/gen_server2.beam
-ebin/rabbit_mirror_queue_master.beam: src/rabbit_mirror_queue_master.erl include/rabbit.hrl ebin/rabbit_backing_queue.beam
-ebin/rabbit_prelaunch.beam: src/rabbit_prelaunch.erl include/rabbit.hrl
-ebin/rabbit_mnesia.beam: src/rabbit_mnesia.erl include/rabbit.hrl
-ebin/rabbit_types.beam: src/rabbit_types.erl include/rabbit.hrl
-ebin/rabbit_writer.beam: src/rabbit_writer.erl include/rabbit.hrl include/rabbit_framing.hrl
-ebin/rabbit_networking.beam: src/rabbit_networking.erl include/rabbit.hrl
-ebin/rabbit_policy.beam: src/rabbit_policy.erl include/rabbit.hrl ebin/rabbit_runtime_parameter.beam
-ebin/rabbit_upgrade.beam: src/rabbit_upgrade.erl include/rabbit.hrl
-ebin/tcp_listener_sup.beam: src/tcp_listener_sup.erl
-ebin/gm_tests.beam: src/gm_tests.erl include/gm_specs.hrl ebin/gm.beam
-ebin/app_utils.beam: src/app_utils.erl
-ebin/lqueue.beam: src/lqueue.erl
-ebin/rabbit_exchange_type_direct.beam: src/rabbit_exchange_type_direct.erl ebin/rabbit_exchange_type.beam include/rabbit.hrl
-ebin/rabbit_runtime_parameters_test.beam: src/rabbit_runtime_parameters_test.erl ebin/rabbit_runtime_parameter.beam
-ebin/dtree.beam: src/dtree.erl
-ebin/rabbit_binary_parser.beam: src/rabbit_binary_parser.erl include/rabbit.hrl
-ebin/rabbit_router.beam: src/rabbit_router.erl include/rabbit.hrl
-ebin/tcp_listener.beam: src/tcp_listener.erl
-ebin/gatherer.beam: src/gatherer.erl ebin/gen_server2.beam
-ebin/rabbit_error_logger_file_h.beam: src/rabbit_error_logger_file_h.erl
-ebin/rabbit_exchange_type_headers.beam: src/rabbit_exchange_type_headers.erl ebin/rabbit_exchange_type.beam include/rabbit.hrl include/rabbit_framing.hrl
-ebin/rabbit_amqqueue_process.beam: src/rabbit_amqqueue_process.erl include/rabbit.hrl ebin/gen_server2.beam include/rabbit_framing.hrl
-ebin/rabbit_log.beam: src/rabbit_log.erl
-ebin/rabbit_mirror_queue_misc.beam: src/rabbit_mirror_queue_misc.erl include/rabbit.hrl
-ebin/rabbit_ssl.beam: src/rabbit_ssl.erl include/rabbit.hrl
-ebin/rabbit_variable_queue.beam: src/rabbit_variable_queue.erl include/rabbit.hrl ebin/rabbit_backing_queue.beam
-deps.mk: generate_deps
@@ -94,7 +94,7 @@ bind_q(Queue, Props) ->
bind_to_q(Queue, props:get_value(restrict_to, Props)).
bind_to_q(Q, undefined) ->
- ok = amqp_util:bind_q_to_callmgr(Q, <<"rate.*">>);
+ ok = amqp_util:bind_q_to_callmgr(Q, ?KEY_RATE_REQ);
bind_to_q(Q, [req|T]) ->
ok = amqp_util:bind_q_to_callmgr(Q, ?KEY_RATE_REQ),
bind_to_q(Q, T);
@@ -106,7 +106,7 @@ unbind_q(Q, Props) ->
unbind_q_from(Q, props:get_value(restrict_to, Props)).
unbind_q_from(Q, undefined) ->
- ok = amqp_util:unbind_q_from_callmgr(Q, <<"rate.*">>);
+ ok = amqp_util:unbind_q_from_callmgr(Q, ?KEY_RATE_REQ);
unbind_q_from(Q, [reqs|T]) ->
ok = amqp_util:unbind_q_from_callmgr(Q, ?KEY_RATE_REQ),
unbind_q_from(Q, T);
@@ -12,6 +12,7 @@
-export([to_proplist/1, to_proplist/2]).
-export([to_querystring/1]).
-export([recursive_to_proplist/1]).
+
-export([get_binary_boolean/2, get_binary_boolean/3]).
-export([get_integer_value/2, get_integer_value/3]).
-export([get_number_value/2, get_number_value/3]).
@@ -39,7 +40,10 @@
,is_valid_json_object/1
,is_json_term/1
]).
--export([public_fields/1, private_fields/1, is_private_key/1]).
+-export([public_fields/1
+ ,private_fields/1
+ ,is_private_key/1
+ ]).
-export([encode/1]).
-export([decode/1, decode/2]).
@@ -752,15 +752,23 @@ is_ipv6(Address) when is_list(Address) ->
{error, _} -> false
end.
--spec elapsed_s/1 :: (wh_now()) -> integer().
--spec elapsed_ms/1 :: (wh_now()) -> integer().
--spec elapsed_us/1 :: (wh_now()) -> integer().
+-spec elapsed_s/1 :: (wh_now() | pos_integer()) -> pos_integer().
+-spec elapsed_ms/1 :: (wh_now() | pos_integer()) -> pos_integer().
+-spec elapsed_us/1 :: (wh_now() | pos_integer()) -> pos_integer().
elapsed_s({_,_,_}=Start) ->
- timer:now_diff(erlang:now(), Start) div 1000000.
+ timer:now_diff(erlang:now(), Start) div 1000000;
+elapsed_s(Start) when is_integer(Start) ->
+ current_tstamp() - Start.
+
elapsed_ms({_,_,_}=Start) ->
- timer:now_diff(erlang:now(), Start) div 1000.
+ timer:now_diff(erlang:now(), Start) div 1000;
+elapsed_ms(Start) when is_integer(Start) ->
+ current_tstamp() - Start * 1000.
+
elapsed_us({_,_,_}=Start) ->
- timer:now_diff(erlang:now(), Start).
+ timer:now_diff(erlang:now(), Start);
+elapsed_us(Start) when is_integer(Start) ->
+ current_tstamp() - Start * 1000000.
-spec now_s/1 :: (wh_now()) -> integer().
-spec now_ms/1 :: (wh_now()) -> integer().
@@ -2,7 +2,9 @@ ROOT = ../..
DIALYZER = dialyzer
REBAR = $(ROOT)/bin/rebar
-DIRS = $(ROOT)/lib/whistle-1.0.0 .
+DIRS = . \
+ $(ROOT)/lib/whistle-1.0.0 \
+ $(ROOT)/lib/couchbeam-0.8.0
all: app
@@ -230,13 +230,8 @@ get_results(#server{}=Conn, DbName, DesignDoc, ViewOptions) ->
couchbeam_error().
do_fetch_results(Db, DesignDoc, Options) ->
?RETRY_504(case couchbeam_view:fetch(Db, DesignDoc, Options) of
- {'ok', JObj} ->
- Rows = wh_json:get_value(<<"rows">>, JObj, JObj),
- {'ok', Rows};
- {'error', _, E} ->
- {'error', E};
- Other ->
- Other
+ {'ok', JObj} -> {'ok', wh_json:get_value(<<"rows">>, JObj, JObj)};
+ Other -> Other
end
).
Oops, something went wrong.

0 comments on commit c1bc908

Please sign in to comment.