diff --git a/applications/crossbar/doc/accounts.md b/applications/crossbar/doc/accounts.md index 6fb7e8b0a65..46cf75f5564 100644 --- a/applications/crossbar/doc/accounts.md +++ b/applications/crossbar/doc/accounts.md @@ -83,6 +83,7 @@ Key | Description | Type | Default | Required | Support Level --- | ----------- | ---- | ------- | -------- | ------------- `enabled` | is recording enabled | `boolean()` | | `false` | `format` | What format to store the recording on disk | `string('mp3' | 'wav')` | | `false` | +`record_feature_code_calls` | Record calls to feature codes | `boolean()` | `true` | `false` | `record_min_sec` | The minimum length, in seconds, the recording must be to be considered successful. Otherwise it is deleted | `integer()` | | `false` | `record_on_answer` | Recording should start on answer | `boolean()` | | `false` | `record_on_bridge` | Recording should start on bridge | `boolean()` | | `false` | diff --git a/applications/crossbar/doc/devices.md b/applications/crossbar/doc/devices.md index ccdd579994f..6bb76b73468 100644 --- a/applications/crossbar/doc/devices.md +++ b/applications/crossbar/doc/devices.md @@ -105,6 +105,7 @@ Key | Description | Type | Default | Required | Support Level --- | ----------- | ---- | ------- | -------- | ------------- `enabled` | is recording enabled | `boolean()` | | `false` | `format` | What format to store the recording on disk | `string('mp3' | 'wav')` | | `false` | +`record_feature_code_calls` | Record calls to feature codes | `boolean()` | `true` | `false` | `record_min_sec` | The minimum length, in seconds, the recording must be to be considered successful. Otherwise it is deleted | `integer()` | | `false` | `record_on_answer` | Recording should start on answer | `boolean()` | | `false` | `record_on_bridge` | Recording should start on bridge | `boolean()` | | `false` | diff --git a/applications/crossbar/doc/ref/accounts.md b/applications/crossbar/doc/ref/accounts.md index 8da3db51cfb..aa65b5f7c80 100644 --- a/applications/crossbar/doc/ref/accounts.md +++ b/applications/crossbar/doc/ref/accounts.md @@ -75,6 +75,7 @@ Key | Description | Type | Default | Required | Support Level --- | ----------- | ---- | ------- | -------- | ------------- `enabled` | is recording enabled | `boolean()` | | `false` | `format` | What format to store the recording on disk | `string('mp3' | 'wav')` | | `false` | +`record_feature_code_calls` | Record calls to feature codes | `boolean()` | `true` | `false` | `record_min_sec` | The minimum length, in seconds, the recording must be to be considered successful. Otherwise it is deleted | `integer()` | | `false` | `record_on_answer` | Recording should start on answer | `boolean()` | | `false` | `record_on_bridge` | Recording should start on bridge | `boolean()` | | `false` | diff --git a/applications/crossbar/doc/ref/devices.md b/applications/crossbar/doc/ref/devices.md index 8d8b618b587..e30af48c0c8 100644 --- a/applications/crossbar/doc/ref/devices.md +++ b/applications/crossbar/doc/ref/devices.md @@ -102,6 +102,7 @@ Key | Description | Type | Default | Required | Support Level --- | ----------- | ---- | ------- | -------- | ------------- `enabled` | is recording enabled | `boolean()` | | `false` | `format` | What format to store the recording on disk | `string('mp3' | 'wav')` | | `false` | +`record_feature_code_calls` | Record calls to feature codes | `boolean()` | `true` | `false` | `record_min_sec` | The minimum length, in seconds, the recording must be to be considered successful. Otherwise it is deleted | `integer()` | | `false` | `record_on_answer` | Recording should start on answer | `boolean()` | | `false` | `record_on_bridge` | Recording should start on bridge | `boolean()` | | `false` | diff --git a/applications/crossbar/doc/ref/users.md b/applications/crossbar/doc/ref/users.md index 186e6384b91..a21a463fd07 100644 --- a/applications/crossbar/doc/ref/users.md +++ b/applications/crossbar/doc/ref/users.md @@ -86,6 +86,7 @@ Key | Description | Type | Default | Required | Support Level --- | ----------- | ---- | ------- | -------- | ------------- `enabled` | is recording enabled | `boolean()` | | `false` | `format` | What format to store the recording on disk | `string('mp3' | 'wav')` | | `false` | +`record_feature_code_calls` | Record calls to feature codes | `boolean()` | `true` | `false` | `record_min_sec` | The minimum length, in seconds, the recording must be to be considered successful. Otherwise it is deleted | `integer()` | | `false` | `record_on_answer` | Recording should start on answer | `boolean()` | | `false` | `record_on_bridge` | Recording should start on bridge | `boolean()` | | `false` | diff --git a/applications/crossbar/doc/users.md b/applications/crossbar/doc/users.md index 15359d600d7..27a7af9ec32 100644 --- a/applications/crossbar/doc/users.md +++ b/applications/crossbar/doc/users.md @@ -88,6 +88,7 @@ Key | Description | Type | Default | Required | Support Level --- | ----------- | ---- | ------- | -------- | ------------- `enabled` | is recording enabled | `boolean()` | | `false` | `format` | What format to store the recording on disk | `string('mp3' | 'wav')` | | `false` | +`record_feature_code_calls` | Record calls to feature codes | `boolean()` | `true` | `false` | `record_min_sec` | The minimum length, in seconds, the recording must be to be considered successful. Otherwise it is deleted | `integer()` | | `false` | `record_on_answer` | Recording should start on answer | `boolean()` | | `false` | `record_on_bridge` | Recording should start on bridge | `boolean()` | | `false` | diff --git a/applications/crossbar/priv/api/swagger.json b/applications/crossbar/priv/api/swagger.json index f7d200f5744..13f281ef7c3 100644 --- a/applications/crossbar/priv/api/swagger.json +++ b/applications/crossbar/priv/api/swagger.json @@ -1087,6 +1087,11 @@ ], "type": "string" }, + "record_feature_code_calls": { + "default": true, + "description": "Record calls to feature codes", + "type": "boolean" + }, "record_min_sec": { "description": "The minimum length, in seconds, the recording must be to be considered successful. Otherwise it is deleted", "type": "integer" diff --git a/applications/crossbar/priv/couchdb/schemas/call_recording.parameters.json b/applications/crossbar/priv/couchdb/schemas/call_recording.parameters.json index a71bf74b424..1ed1af6e13c 100644 --- a/applications/crossbar/priv/couchdb/schemas/call_recording.parameters.json +++ b/applications/crossbar/priv/couchdb/schemas/call_recording.parameters.json @@ -15,6 +15,11 @@ ], "type": "string" }, + "record_feature_code_calls": { + "default": true, + "description": "Record calls to feature codes", + "type": "boolean" + }, "record_min_sec": { "description": "The minimum length, in seconds, the recording must be to be considered successful. Otherwise it is deleted", "type": "integer" diff --git a/core/kazoo_call/src/kapps_call.erl b/core/kazoo_call/src/kapps_call.erl index 35c645cf7cd..a165653d1e2 100644 --- a/core/kazoo_call/src/kapps_call.erl +++ b/core/kazoo_call/src/kapps_call.erl @@ -136,6 +136,7 @@ ,mask_recording/1, mask_recording/2 ,unmask_recording/1, unmask_recording/2 ,stop_recording/1 + ,maybe_skip_feature_calls_recording/2 ]). -export([is_recording/1, set_is_recording/2]). @@ -1609,6 +1610,22 @@ get_recordings(Call) -> Q -> Q end. +%%------------------------------------------------------------------------------ +%% @doc Check if we should record calls to feature codes. +%% First, we check if the callee number starts with * and then check +%% if the `record_feature_code_calls' param is set. +%% If the call is a feature call and record feature code calls is false, +%% then we skip the call recording. +%% @end +%%------------------------------------------------------------------------------ +-spec maybe_skip_feature_calls_recording(call(), kz_term:api_object()) -> boolean(). +maybe_skip_feature_calls_recording(Call, Data) -> + try binary:first(callee_id_number(Call)) == 42 + andalso not kz_json:is_true(<<"record_feature_code_calls">>, Data, 'true') + catch + _:_ -> 'false' + end. + -spec inception_type(call()) -> kz_term:ne_binary(). inception_type(#kapps_call{inception='undefined'}) -> <<"onnet">>; inception_type(#kapps_call{}) -> <<"offnet">>. diff --git a/core/kazoo_endpoint/src/kz_account_recording.erl b/core/kazoo_endpoint/src/kz_account_recording.erl index 046cec94edb..69b49f560ad 100644 --- a/core/kazoo_endpoint/src/kz_account_recording.erl +++ b/core/kazoo_endpoint/src/kz_account_recording.erl @@ -27,7 +27,8 @@ maybe_record_inbound(FromNetwork, Endpoint, Call) -> {'true', kapps_call:call()} | 'false'. maybe_record_inbound(_FromNetwork, _Endpoint, _Call, 'undefined') -> 'false'; maybe_record_inbound(FromNetwork, _Endpoint, Call, Data) -> - case kz_json:is_true(<<"enabled">>, Data) of + case kz_json:is_true(<<"enabled">>, Data) + andalso not kapps_call:maybe_skip_feature_calls_recording(Call, Data) of 'false' -> 'false'; 'true' -> LabeledData = kz_json:set_value(<<"origin">>, ?ACCOUNT_INBOUND_RECORDING_LABEL(FromNetwork), Data), @@ -46,7 +47,8 @@ maybe_record_outbound(ToNetwork, Endpoint, Call) -> {'true', kapps_call:call()} | 'false'. maybe_record_outbound(_ToNetwork, _Endpoint, _Call, 'undefined') -> 'false'; maybe_record_outbound(ToNetwork, _Endpoint, Call, Data) -> - case kz_json:is_true(<<"enabled">>, Data) of + case kz_json:is_true(<<"enabled">>, Data) + andalso not kapps_call:maybe_skip_feature_calls_recording(Call, Data) of 'false' -> 'false'; 'true' -> LabeledData = kz_json:set_value(<<"origin">>, ?ACCOUNT_OUTBOUND_RECORDING_LABEL(ToNetwork), Data), diff --git a/core/kazoo_endpoint/src/kz_endpoint_recording.erl b/core/kazoo_endpoint/src/kz_endpoint_recording.erl index 651fb776f10..7f33d8e51c8 100644 --- a/core/kazoo_endpoint/src/kz_endpoint_recording.erl +++ b/core/kazoo_endpoint/src/kz_endpoint_recording.erl @@ -532,7 +532,8 @@ maybe_record_inbound(FromNetwork, Endpoint, Call) -> {'true', {kz_json:path(), kz_json:object()}} | 'false'. maybe_record_inbound(_FromNetwork, _Endpoint, _Call, 'undefined') -> 'false'; maybe_record_inbound(FromNetwork, Endpoint, Call, Data) -> - case kz_json:is_true(<<"enabled">>, Data) of + case kz_json:is_true(<<"enabled">>, Data) + andalso not kapps_call:maybe_skip_feature_calls_recording(Call, Data) of 'false' -> 'false'; 'true' -> Values = [{<<"origin">>, <<"inbound from ", FromNetwork/binary, " to endpoint">>}], @@ -551,7 +552,8 @@ maybe_record_outbound(ToNetwork, Endpoint, Call) -> {'true', kapps_call:call()} | 'false'. maybe_record_outbound(_ToNetwork, _Endpoint, _Call, 'undefined') -> 'false'; maybe_record_outbound(ToNetwork, _Endpoint, Call, Data) -> - case kz_json:is_true(<<"enabled">>, Data) of + case kz_json:is_true(<<"enabled">>, Data) + andalso not kapps_call:maybe_skip_feature_calls_recording(Call, Data) of 'false' -> 'false'; 'true' -> LabeledData = kz_json:set_value(<<"origin">>, ?ENDPOINT_OUTBOUND_RECORDING_LABEL(ToNetwork), Data),