Skip to content

Commit

Permalink
HELP-11566: clarify precedence of call forward vs failover (2600hz#6307)
Browse files Browse the repository at this point in the history
* HELP-11566: clarify precedence of call forward vs failover

The `call_forward` object handles configuration for both call
forwarding and for failover. In its current implementation, only one
of those features can be "active".

Prior to this change, if `call_forward.failover` was `true` it would
be included on the endpoint object and ecallmgr would treat the
`call_forward` settings as a failover endpoint, regardless of the
`call_forward.enabled` flag's setting.

This change clarifies that if `call_forward.enabled` is `true`, the
settings should only be considered for call forwarding. If the setting
is `false` *and* `call_forward.failover` is `true` then consider the
settings as a failover endpoint.

* fmt
  • Loading branch information
jamesaimonetti authored Feb 12, 2020
1 parent 2432993 commit 00a52be
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
4 changes: 4 additions & 0 deletions applications/crossbar/doc/devices.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ Key | Description | Type | Default | Required | Support Level



### Call forwarding

Currently the `call_forward` object allows you to define call forwarding *or* failover but not both. If `call_forward.enabled` is `true` it will take precedence and settings will be used only for call forwarding. If `call_forward.enabled` is `false` *and* `call_forward.failover` is `true`, failover settings will be used.

## Fetch

> GET /v2/accounts/{ACCOUNT_ID}/devices
Expand Down
3 changes: 0 additions & 3 deletions core/kazoo_endpoint/src/kz_endpoint.erl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ get(EndpointId, _Call) -> ?MOD:get(EndpointId, _Call).


-ifdef(TEST).

attributes_keys() -> ?MOD:attributes_keys().

-spec merge_attribute(kz_term:ne_binary(), kz_term:api_object(), kz_term:api_object(), kz_term:api_object()) -> kz_json:object().
Expand Down Expand Up @@ -116,7 +115,6 @@ maybe_start_metaflow(Call, Endpoint) -> ?MOD:maybe_start_metaflow(Call, Endpoint
kz_json:object().
create_sip_endpoint(Endpoint, Properties, Call) -> ?MOD:create_sip_endpoint(Endpoint, Properties, Call).


%%------------------------------------------------------------------------------
%% @doc Creates the Kazoo API endpoint for a bridge call command when
%% the device (or owner) has forwarded their phone. This endpoint
Expand All @@ -129,7 +127,6 @@ create_sip_endpoint(Endpoint, Properties, Call) -> ?MOD:create_sip_endpoint(Endp
kz_json:object().
create_call_fwd_endpoint(Endpoint, Properties, Call) -> ?MOD:create_call_fwd_endpoint(Endpoint, Properties, Call).


-spec encryption_method_map(kz_term:api_object(), kz_term:api_binaries() | kz_json:object()) -> kz_term:api_object().
encryption_method_map(CCVs, Methods) -> ?MOD:encryption_method_map(CCVs, Methods).

Expand Down
7 changes: 6 additions & 1 deletion core/kazoo_endpoint/src/kz_endpoint_v4.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1775,7 +1775,12 @@ maybe_set_call_forward({Endpoint, Call, CallFwd, CCVs}) ->

-spec is_failover(kz_json:object()) -> 'true' | 'undefined'.
is_failover(CallFwd) ->
case kz_json:is_true(<<"failover">>, CallFwd) of
IsFailover = kz_json:is_true(<<"failover">>, CallFwd),
IsCallFwdEnabled = kz_json:is_true(<<"enabled">>, CallFwd),

case (not IsCallFwdEnabled)
andalso IsFailover
of
'true' -> 'true';
'false' -> 'undefined'
end.
Expand Down
7 changes: 6 additions & 1 deletion core/kazoo_endpoint/src/kz_endpoint_v5.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1715,7 +1715,12 @@ maybe_set_call_forward({Endpoint, Call, CallFwd, CCVs}) ->

-spec is_failover(kz_json:object()) -> 'true' | 'undefined'.
is_failover(CallFwd) ->
case kz_json:is_true(<<"failover">>, CallFwd) of
IsFailover = kz_json:is_true(<<"failover">>, CallFwd),
IsCallFwdEnabled = kz_json:is_true(<<"enabled">>, CallFwd),

case (not IsCallFwdEnabled)
andalso IsFailover
of
'true' -> 'true';
'false' -> 'undefined'
end.
Expand Down

0 comments on commit 00a52be

Please sign in to comment.