Skip to content

Commit 477f272

Browse files
PISTON-1290 added the ability to be able to skip call recording for feature calls.
1 parent 70372ba commit 477f272

File tree

11 files changed

+41
-4
lines changed

11 files changed

+41
-4
lines changed

applications/crossbar/doc/accounts.md

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ Key | Description | Type | Default | Required | Support Level
8383
--- | ----------- | ---- | ------- | -------- | -------------
8484
`enabled` | is recording enabled | `boolean()` | | `false` |
8585
`format` | What format to store the recording on disk | `string('mp3' | 'wav')` | | `false` |
86+
`record_feature_code_calls` | Record calls to feature codes | `boolean()` | `true` | `false` |
8687
`record_min_sec` | The minimum length, in seconds, the recording must be to be considered successful. Otherwise it is deleted | `integer()` | | `false` |
8788
`record_on_answer` | Recording should start on answer | `boolean()` | | `false` |
8889
`record_on_bridge` | Recording should start on bridge | `boolean()` | | `false` |

applications/crossbar/doc/devices.md

+1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ Key | Description | Type | Default | Required | Support Level
105105
--- | ----------- | ---- | ------- | -------- | -------------
106106
`enabled` | is recording enabled | `boolean()` | | `false` |
107107
`format` | What format to store the recording on disk | `string('mp3' | 'wav')` | | `false` |
108+
`record_feature_code_calls` | Record calls to feature codes | `boolean()` | `true` | `false` |
108109
`record_min_sec` | The minimum length, in seconds, the recording must be to be considered successful. Otherwise it is deleted | `integer()` | | `false` |
109110
`record_on_answer` | Recording should start on answer | `boolean()` | | `false` |
110111
`record_on_bridge` | Recording should start on bridge | `boolean()` | | `false` |

applications/crossbar/doc/ref/accounts.md

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Key | Description | Type | Default | Required | Support Level
7575
--- | ----------- | ---- | ------- | -------- | -------------
7676
`enabled` | is recording enabled | `boolean()` | | `false` |
7777
`format` | What format to store the recording on disk | `string('mp3' | 'wav')` | | `false` |
78+
`record_feature_code_calls` | Record calls to feature codes | `boolean()` | `true` | `false` |
7879
`record_min_sec` | The minimum length, in seconds, the recording must be to be considered successful. Otherwise it is deleted | `integer()` | | `false` |
7980
`record_on_answer` | Recording should start on answer | `boolean()` | | `false` |
8081
`record_on_bridge` | Recording should start on bridge | `boolean()` | | `false` |

applications/crossbar/doc/ref/devices.md

+1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ Key | Description | Type | Default | Required | Support Level
102102
--- | ----------- | ---- | ------- | -------- | -------------
103103
`enabled` | is recording enabled | `boolean()` | | `false` |
104104
`format` | What format to store the recording on disk | `string('mp3' | 'wav')` | | `false` |
105+
`record_feature_code_calls` | Record calls to feature codes | `boolean()` | `true` | `false` |
105106
`record_min_sec` | The minimum length, in seconds, the recording must be to be considered successful. Otherwise it is deleted | `integer()` | | `false` |
106107
`record_on_answer` | Recording should start on answer | `boolean()` | | `false` |
107108
`record_on_bridge` | Recording should start on bridge | `boolean()` | | `false` |

applications/crossbar/doc/ref/users.md

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Key | Description | Type | Default | Required | Support Level
8686
--- | ----------- | ---- | ------- | -------- | -------------
8787
`enabled` | is recording enabled | `boolean()` | | `false` |
8888
`format` | What format to store the recording on disk | `string('mp3' | 'wav')` | | `false` |
89+
`record_feature_code_calls` | Record calls to feature codes | `boolean()` | `true` | `false` |
8990
`record_min_sec` | The minimum length, in seconds, the recording must be to be considered successful. Otherwise it is deleted | `integer()` | | `false` |
9091
`record_on_answer` | Recording should start on answer | `boolean()` | | `false` |
9192
`record_on_bridge` | Recording should start on bridge | `boolean()` | | `false` |

applications/crossbar/doc/users.md

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ Key | Description | Type | Default | Required | Support Level
8888
--- | ----------- | ---- | ------- | -------- | -------------
8989
`enabled` | is recording enabled | `boolean()` | | `false` |
9090
`format` | What format to store the recording on disk | `string('mp3' | 'wav')` | | `false` |
91+
`record_feature_code_calls` | Record calls to feature codes | `boolean()` | `true` | `false` |
9192
`record_min_sec` | The minimum length, in seconds, the recording must be to be considered successful. Otherwise it is deleted | `integer()` | | `false` |
9293
`record_on_answer` | Recording should start on answer | `boolean()` | | `false` |
9394
`record_on_bridge` | Recording should start on bridge | `boolean()` | | `false` |

applications/crossbar/priv/api/swagger.json

+5
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,11 @@
10871087
],
10881088
"type": "string"
10891089
},
1090+
"record_feature_code_calls": {
1091+
"default": true,
1092+
"description": "Record calls to feature codes",
1093+
"type": "boolean"
1094+
},
10901095
"record_min_sec": {
10911096
"description": "The minimum length, in seconds, the recording must be to be considered successful. Otherwise it is deleted",
10921097
"type": "integer"

applications/crossbar/priv/couchdb/schemas/call_recording.parameters.json

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
],
1616
"type": "string"
1717
},
18+
"record_feature_code_calls": {
19+
"default": true,
20+
"description": "Record calls to feature codes",
21+
"type": "boolean"
22+
},
1823
"record_min_sec": {
1924
"description": "The minimum length, in seconds, the recording must be to be considered successful. Otherwise it is deleted",
2025
"type": "integer"

core/kazoo_call/src/kapps_call.erl

+17
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@
136136
,mask_recording/1, mask_recording/2
137137
,unmask_recording/1, unmask_recording/2
138138
,stop_recording/1
139+
,should_skip_feature_calls_recording/2
139140
]).
140141

141142
-export([is_recording/1, set_is_recording/2]).
@@ -1609,6 +1610,22 @@ get_recordings(Call) ->
16091610
Q -> Q
16101611
end.
16111612

1613+
%%------------------------------------------------------------------------------
1614+
%% @doc Check if we should record calls to feature codes.
1615+
%% First, we check if the callee number starts with * and then check
1616+
%% if the `record_feature_code_calls' param is set.
1617+
%% If the call is a feature call and record feature code calls is false,
1618+
%% then we skip the call recording.
1619+
%% @end
1620+
%%------------------------------------------------------------------------------
1621+
-spec should_skip_feature_calls_recording(call(), kz_term:api_object()) -> boolean().
1622+
should_skip_feature_calls_recording(Call, Data) ->
1623+
try binary:first(request_user(Call)) == $*
1624+
andalso not kz_json:is_true(<<"record_feature_code_calls">>, Data, 'true')
1625+
catch
1626+
_:_ -> 'false'
1627+
end.
1628+
16121629
-spec inception_type(call()) -> kz_term:ne_binary().
16131630
inception_type(#kapps_call{inception='undefined'}) -> <<"onnet">>;
16141631
inception_type(#kapps_call{}) -> <<"offnet">>.

core/kazoo_endpoint/src/kz_account_recording.erl

+4-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ maybe_record_inbound(FromNetwork, Endpoint, Call) ->
2727
{'true', kapps_call:call()} | 'false'.
2828
maybe_record_inbound(_FromNetwork, _Endpoint, _Call, 'undefined') -> 'false';
2929
maybe_record_inbound(FromNetwork, _Endpoint, Call, Data) ->
30-
case kz_json:is_true(<<"enabled">>, Data) of
30+
case kz_json:is_true(<<"enabled">>, Data)
31+
andalso not kapps_call:should_skip_feature_calls_recording(Call, Data) of
3132
'false' -> 'false';
3233
'true' ->
3334
LabeledData = kz_json:set_value(<<"origin">>, ?ACCOUNT_INBOUND_RECORDING_LABEL(FromNetwork), Data),
@@ -46,7 +47,8 @@ maybe_record_outbound(ToNetwork, Endpoint, Call) ->
4647
{'true', kapps_call:call()} | 'false'.
4748
maybe_record_outbound(_ToNetwork, _Endpoint, _Call, 'undefined') -> 'false';
4849
maybe_record_outbound(ToNetwork, _Endpoint, Call, Data) ->
49-
case kz_json:is_true(<<"enabled">>, Data) of
50+
case kz_json:is_true(<<"enabled">>, Data)
51+
andalso not kapps_call:should_skip_feature_calls_recording(Call, Data) of
5052
'false' -> 'false';
5153
'true' ->
5254
LabeledData = kz_json:set_value(<<"origin">>, ?ACCOUNT_OUTBOUND_RECORDING_LABEL(ToNetwork), Data),

core/kazoo_endpoint/src/kz_endpoint_recording.erl

+4-2
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,8 @@ maybe_record_inbound(FromNetwork, Endpoint, Call) ->
532532
{'true', {kz_json:path(), kz_json:object()}} | 'false'.
533533
maybe_record_inbound(_FromNetwork, _Endpoint, _Call, 'undefined') -> 'false';
534534
maybe_record_inbound(FromNetwork, Endpoint, Call, Data) ->
535-
case kz_json:is_true(<<"enabled">>, Data) of
535+
case kz_json:is_true(<<"enabled">>, Data)
536+
andalso not kapps_call:should_skip_feature_calls_recording(Call, Data) of
536537
'false' -> 'false';
537538
'true' ->
538539
Values = [{<<"origin">>, <<"inbound from ", FromNetwork/binary, " to endpoint">>}],
@@ -551,7 +552,8 @@ maybe_record_outbound(ToNetwork, Endpoint, Call) ->
551552
{'true', kapps_call:call()} | 'false'.
552553
maybe_record_outbound(_ToNetwork, _Endpoint, _Call, 'undefined') -> 'false';
553554
maybe_record_outbound(ToNetwork, _Endpoint, Call, Data) ->
554-
case kz_json:is_true(<<"enabled">>, Data) of
555+
case kz_json:is_true(<<"enabled">>, Data)
556+
andalso not kapps_call:should_skip_feature_calls_recording(Call, Data) of
555557
'false' -> 'false';
556558
'true' ->
557559
LabeledData = kz_json:set_value(<<"origin">>, ?ENDPOINT_OUTBOUND_RECORDING_LABEL(ToNetwork), Data),

0 commit comments

Comments
 (0)