Skip to content

Commit

Permalink
KAZOO-5063 ensure to-did not being empty (2600hz#2623)
Browse files Browse the repository at this point in the history
* KAZOO-5063 ensure to-did not being empty

* KAZOO-5063 use is_ne_binary check

* KAZOO-5063 move is_ne_binary to kz_util
  • Loading branch information
jamhed authored and lazedo committed Oct 1, 2016
1 parent a29d754 commit 29a5fcd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions core/kazoo/src/kz_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
]).
-export([to_boolean/1, is_boolean/1
,is_true/1, is_false/1
,is_ne_binary/1
,is_empty/1, is_not_empty/1
,is_proplist/1
,identity/1
Expand Down Expand Up @@ -1141,6 +1142,11 @@ is_false(_) -> 'false'.
-spec always_false(any()) -> 'false'.
always_false(_) -> 'false'.

-spec is_ne_binary(binary()) -> boolean().
is_ne_binary(V) ->
is_binary(V)
andalso is_not_empty(V).

-spec is_boolean(binary() | string() | atom()) -> boolean().
is_boolean(<<"true">>) -> 'true';
is_boolean("true") -> 'true';
Expand Down
3 changes: 2 additions & 1 deletion core/kazoo_amqp/src/api/kapi_offnet_resource.erl
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
,{?KEY_FLAGS, fun is_list/1}
,{?KEY_FORCE_FAX, fun kz_util:is_boolean/1}
,{?KEY_FORCE_OUTBOUND, fun kz_util:is_boolean/1}
,{?KEY_TO_DID, fun is_binary/1}
,{?KEY_TO_DID, fun kz_util:is_ne_binary/1}
,{?KEY_BYPASS_E164, fun kz_util:is_boolean/1}
]).

Expand All @@ -170,6 +170,7 @@
]).
-define(OFFNET_RESOURCE_RESP_TYPES, []).


%%--------------------------------------------------------------------
%% @doc Offnet resource request - see wiki
%% Takes proplist, creates JSON string or error
Expand Down

0 comments on commit 29a5fcd

Please sign in to comment.