Skip to content

Commit

Permalink
Onnet vs on-net (2600hz#6027)
Browse files Browse the repository at this point in the history
* Unify code and docs to onnet/offnet

Also update tables in documentation

* add column row

* remove old matrix table
  • Loading branch information
jamesaimonetti authored and lazedo committed Sep 11, 2019
1 parent 13279cb commit bcf9431
Show file tree
Hide file tree
Showing 18 changed files with 41 additions and 54 deletions.
2 changes: 1 addition & 1 deletion applications/callflow/src/cf_exe.erl
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ log_call_information(Call) ->
lager:info("from ~s", [kapps_call:from(Call)]),
lager:info("CID ~s ~s", [kapps_call:caller_id_name(Call), kapps_call:caller_id_number(Call)]),
case kapps_call:inception(Call) of
'undefined' -> lager:info("inception on-net: using attributes for an internal call", []);
'undefined' -> lager:info("inception onnet: using attributes for an internal call", []);
_Else -> lager:info("inception ~s: using attributes for an external call", [_Else])
end,
lager:info("authorizing id ~s", [kapps_call:authorizing_id(Call)]).
Expand Down
16 changes: 8 additions & 8 deletions applications/crossbar/priv/api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -23907,8 +23907,8 @@
},
"Route-Type": {
"enum": [
"on-net",
"off-net"
"onnet",
"offnet"
],
"type": "string"
},
Expand Down Expand Up @@ -24121,8 +24121,8 @@
},
"Route-Type": {
"enum": [
"on-net",
"off-net"
"onnet",
"offnet"
],
"type": "string"
},
Expand Down Expand Up @@ -24443,8 +24443,8 @@
},
"Route-Type": {
"enum": [
"on-net",
"off-net"
"onnet",
"offnet"
],
"type": "string"
},
Expand Down Expand Up @@ -34488,7 +34488,7 @@
"type": "string"
},
"transfer_target": {
"description": "on-net phone number to transfer unconfigured numbers to",
"description": "onnet phone number to transfer unconfigured numbers to",
"type": "string"
}
},
Expand Down Expand Up @@ -34526,7 +34526,7 @@
"type": "string"
},
"transfer_target": {
"description": "on-net phone number to transfer unknown numbers to",
"description": "onnet phone number to transfer unknown numbers to",
"type": "string"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@
},
"Route-Type": {
"enum": [
"on-net",
"off-net"
"onnet",
"offnet"
],
"type": "string"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@
},
"Route-Type": {
"enum": [
"on-net",
"off-net"
"onnet",
"offnet"
],
"type": "string"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@
},
"Route-Type": {
"enum": [
"on-net",
"off-net"
"onnet",
"offnet"
],
"type": "string"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"type": "string"
},
"transfer_target": {
"description": "on-net phone number to transfer unconfigured numbers to",
"description": "onnet phone number to transfer unconfigured numbers to",
"type": "string"
}
},
Expand Down Expand Up @@ -78,7 +78,7 @@
"type": "string"
},
"transfer_target": {
"description": "on-net phone number to transfer unknown numbers to",
"description": "onnet phone number to transfer unknown numbers to",
"type": "string"
}
},
Expand Down
4 changes: 2 additions & 2 deletions applications/crossbar/priv/oas3/oas3-schemas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12699,7 +12699,7 @@
'description': reorder message for replies to unconfigured numbers
'type': string
'transfer_target':
'description': on-net phone number to transfer unconfigured numbers to
'description': onnet phone number to transfer unconfigured numbers to
'type': string
'type': object
'unknown_number':
Expand Down Expand Up @@ -12728,7 +12728,7 @@
'description': reorder message for replies to unknown numbers
'type': string
'transfer_target':
'description': on-net phone number to transfer unknown numbers to
'description': onnet phone number to transfer unknown numbers to
'type': string
'type': object
'type': object
Expand Down
2 changes: 1 addition & 1 deletion applications/doodle/src/doodle_exe.erl
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ log_call_information(Call) ->
lager:info("from ~s", [kapps_call:from(Call)]),
lager:info("CID ~s ~s", [kapps_call:caller_id_name(Call), kapps_call:caller_id_number(Call)]),
case kapps_call:inception(Call) of
'undefined' -> lager:info("inception on-net: using attributes for an internal call", []);
'undefined' -> lager:info("inception onnet: using attributes for an internal call", []);
_Else -> lager:info("inception ~s: using attributes for an external call", [_Else])
end,
lager:info("authorizing id ~s", [kapps_call:authorizing_id(Call)]).
2 changes: 1 addition & 1 deletion applications/doodle/src/doodle_inbound_handler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ account_from_number(Map) ->
Map.

-spec set_inception(map()) -> map().
set_inception(#{inception := <<"off-net">>, request := JObj} = Map) ->
set_inception(#{inception := <<"offnet">>, request := JObj} = Map) ->
Request = kz_json:get_value(<<"From">>, JObj),
Map#{request => kz_json:set_value(?CCV(<<"Inception">>), Request, JObj)};
set_inception(#{request := JObj} = Map) ->
Expand Down
6 changes: 3 additions & 3 deletions applications/doodle/src/doodle_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
-define(SIP_ENDPOINT_KEY(Realm, User)
,{?MODULE, 'sip_endpoint', Realm, User}
).
-define(DEFAULT_INCEPTION, <<"off-net">>).
-define(DEFAULT_INCEPTION, <<"offnet">>).
-define(MDN_VIEW, <<"mobile/listing_by_mdn">>).
-define(CONVERT_MDN, 'true').

Expand Down Expand Up @@ -387,8 +387,8 @@ set_callee_id(EndpointId, Call) ->
-spec get_inbound_field(kz_term:ne_binary()) -> kz_term:ne_binaries().
get_inbound_field(Inception) ->
case Inception of
<<"on-net">> -> [<<"Caller-ID-Number">>, <<"From">>];
<<"off-net">> -> [<<"Callee-ID-Number">>, <<"To">>];
<<"onnet">> -> [<<"Caller-ID-Number">>, <<"From">>];
<<"offnet">> -> [<<"Callee-ID-Number">>, <<"To">>];
_ -> get_inbound_field(?DEFAULT_INCEPTION)
end.

Expand Down
4 changes: 2 additions & 2 deletions applications/trunkstore/src/trunkstore_sup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
-define(CACHE_PROPS, [{'origin_bindings', ?ORIGIN_BINDINGS}
]).

-define(CHILDREN, [?SUPER('ts_onnet_sup') %% handles calls originating on-net (customer)
,?WORKER('ts_offnet_sup') %% handles calls originating off-net (carrier)
-define(CHILDREN, [?SUPER('ts_onnet_sup') %% handles calls originating onnet (customer)
,?WORKER('ts_offnet_sup') %% handles calls originating offnet (carrier)
,?CACHE_ARGS(?CACHE_NAME, ?CACHE_PROPS)
,?WORKER('ts_responder')
,?WORKER('trunkstore_listener')
Expand Down
2 changes: 1 addition & 1 deletion applications/trunkstore/src/ts_callflow.erl
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ process_event_for_bridge(State, JObj, {<<"error">>, _, <<"bridge">>}) ->
{'error', State}
end;
process_event_for_bridge(_State, _JObj, {<<"call_event">>, <<"CHANNEL_EXECUTE_COMPLETE">>, <<"answer">>}) ->
%% support one legged bridges such as on-net conference
%% support one legged bridges such as onnet conference
lager:info("channel was answered"),
'ignore';
process_event_for_bridge(#ts_callflow_state{aleg_callid=ALeg}=State
Expand Down
2 changes: 1 addition & 1 deletion applications/trunkstore/src/ts_from_onnet.erl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ maybe_onnet_data(State) ->
ToDID = knm_converters:normalize(ToUser, AccountId),
FromUser = kz_json:get_ne_binary_value(<<"Caller-ID-Name">>, RouteReq),

lager:info("on-net request from ~s(~s) to ~s", [FromUser, AccountId, ToDID]),
lager:info("onnet request from ~s(~s) to ~s", [FromUser, AccountId, ToDID]),
Options =
case ts_util:lookup_did(FromUser, AccountId) of
{'ok', Opts} -> Opts;
Expand Down
4 changes: 2 additions & 2 deletions applications/trunkstore/src/ts_route_req.erl
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ maybe_handle(RouteReq, HandlerFun, {'ok', AMQPWorker}) ->

-spec handle_onnet_req(kapi_route:req(), pid()) -> any().
handle_onnet_req(RouteReq, AMQPWorker) ->
%% Coming from PBX (on-net); authed by Registrar or ts_auth
%% Coming from PBX (onnet); authed by Registrar or ts_auth
CallId = kapi_route:call_id(RouteReq),
lager:info("call with fetch-id ~s began on the network", [kapi_route:fetch_id(RouteReq)]),
ts_onnet_sup:start_handler(<<"onnet-", CallId/binary>>, RouteReq, AMQPWorker).

-spec handle_offnet_req(kapi_route:req(), pid()) -> any().
handle_offnet_req(RouteReq, AMQPWorker) ->
%% Coming from carrier (off-net)
%% Coming from carrier (offnet)
CallId = kapi_route:call_id(RouteReq),
lager:info("call with fetch-id ~s began from outside the network", [kapi_route:fetch_id(RouteReq)]),
ts_offnet_sup:start_handler(<<"offnet-", CallId/binary>>, RouteReq, AMQPWorker).
6 changes: 3 additions & 3 deletions core/kazoo_amqp/src/api/kapi_sms.erl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
,{<<"Dial-Endpoint-Method">>, [<<"single">>, <<"simultaneous">>]}
,{<<"SIP-Transport">>, [<<"udp">>, <<"tcp">>, <<"tls">>]}
,{<<"Application-Name">>, [<<"send">>]}
,{<<"Route-Type">>, [<<"on-net">>, <<"off-net">>]}
,{<<"Route-Type">>, [<<"onnet">>, <<"offnet">>]}
]).
-define(SMS_REQ_TYPES, [{<<"Endpoints">>, fun is_list/1}
,{<<"SIP-Headers">>, fun kz_json:is_json_object/1}
Expand Down Expand Up @@ -156,7 +156,7 @@
]).
-define(INBOUND_REQ_VALUES, [{<<"Event-Category">>, ?EVENT_CATEGORY}
,{<<"Event-Name">>, ?INBOUND_REQ_EVENT_NAME}
,{<<"Route-Type">>, [<<"on-net">>, <<"off-net">>]}
,{<<"Route-Type">>, [<<"onnet">>, <<"offnet">>]}
]).
-define(INBOUND_ROUTING_KEY(RouteId, CallId), <<"message.inbound."
,(kz_amqp_util:encode(?LOWER(RouteId)))/binary, "."
Expand Down Expand Up @@ -196,7 +196,7 @@
]).
-define(OUTBOUND_REQ_VALUES, [{<<"Event-Category">>, ?EVENT_CATEGORY}
,{<<"Event-Name">>, ?OUTBOUND_REQ_EVENT_NAME}
,{<<"Route-Type">>, [<<"on-net">>, <<"off-net">>]}
,{<<"Route-Type">>, [<<"onnet">>, <<"offnet">>]}
]).
-define(OUTBOUND_ROUTING_KEY(RouteId, CallId)
,list_to_binary(["message.outbound."
Expand Down
2 changes: 1 addition & 1 deletion core/kazoo_apps/src/kapps_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ account_ccvs_from_ip_auth(Doc) ->
[{<<"Account-ID">>, AccountId}
,{<<"Owner-ID">>, OwnerId}
,{<<"Authorizing-ID">>, kz_doc:id(Doc)}
,{<<"Inception">>, <<"on-net">>}
,{<<"Inception">>, <<"onnet">>}
,{<<"Authorizing-Type">>, AuthType}
])
end.
Expand Down
2 changes: 1 addition & 1 deletion doc/engineering/loopback.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

loopback creates a new channel and starts a route_req

## Hairpinning to stay on-net
## Hairpinning to stay onnet

used in clicktocall, quickcall, call forward, cell phone device types

Expand Down
25 changes: 6 additions & 19 deletions doc/user_guides/call_recording.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ The account's settings are considered independently of the endpoint's. So a user
When an onnet device makes an internal call:

| Setting | Source | Destination | Recording Started |
| ------- | ------ | ----------- | ----------------- |
| Account -> Inbound -> Onnet | onnet | onnet | yes |
| Account -> Inbound -> Offnet | onnet | onnet | no |
| Account -> Outbound -> Onnet | onnet | onnet | yes (if inbound -> onnet isn't configured) |
Expand All @@ -46,6 +47,7 @@ When an onnet device makes an internal call:
When an onnet device makes an external call:

| Setting | Source | Destination | Recording Started |
| ------- | ------ | ----------- | ----------------- |
| Account -> Inbound -> Onnet | onnet | offnet | yes |
| Account -> Inbound -> Offnet | onnet | offnet | no |
| Account -> Outbound -> Onnet | onnet | offnet | no |
Expand All @@ -54,6 +56,7 @@ When an onnet device makes an external call:
When an offnet device makes an internal call:

| Setting | Source | Destination | Recording Started |
| ------- | ------ | ----------- | ----------------- |
| Account -> Inbound -> Onnet | offnet | onnet | no |
| Account -> Inbound -> Offnet | offnet | onnet | yes |
| Account -> Outbound -> Onnet | offnet | onnet | yes (if inbound-offnet isn't configured) |
Expand All @@ -64,6 +67,7 @@ When an offnet device makes an internal call:
When an onnet device makes an internal call:

| Setting | Source | Destination | Recording Started |
| ------- | ------ | ----------- | ----------------- |
| Endpoint -> Inbound -> Onnet | onnet | onnet | yes¹ |
| Endpoint -> Inbound -> Offnet | onnet | onnet | no |
| Endpoint -> Outbound -> Onnet | onnet | onnet | yes |
Expand All @@ -72,6 +76,7 @@ When an onnet device makes an internal call:
When an onnet device makes an external call:

| Setting | Source | Destination | Recording Started |
| ------- | ------ | ----------- | ----------------- |
| Endpoint -> Inbound -> Onnet | onnet | offnet | no |
| Endpoint -> Inbound -> Offnet | onnet | offnet | no |
| Endpoint -> Outbound -> Onnet | onnet | offnet | no |
Expand All @@ -80,6 +85,7 @@ When an onnet device makes an external call:
When an offnet endpoint makes a call to an onnet device:

| Setting | Source | Destination | Recording Started |
| ------- | ------ | ----------- | ----------------- |
| Endpoint -> Inbound -> Onnet | offnet | onnet | no |
| Endpoint -> Inbound -> Offnet | offnet | onnet | yes |
| Endpoint -> Outbound -> Onnet | offnet | onnet | no |
Expand All @@ -99,25 +105,6 @@ curl -v -X PATCH \
http://{SERVER}:8000/v2/accounts/{ACCOUNT_ID}/users/{USER_ID}
```

### Call Recording Payload

The `call_recording` payload defines properties to be applied on `inbound` to, `outbound` from, or `any` calls involving the endpoint.

Each of those properties can then define what to do when the call comes from the `offnet`, `onnet`, or `any` network.

Effectively this gives you a matrix on the endpoint to control how call recording is initiated:

| `offnet` | `onnet`
`inbound` | [1] | [2]
`outbound` | [3] | [4]

1. `inbound` + `offnet`: Calls originating from offnet (upstream carriers typically) to the endpoint
2. `inbound` + `onnet`: Calls originating from onnet (typically another endpoint in the account) to the endpoint
3. `outbound` + `offnet`: Calls originating from the endpoint destined for the upstream carriers
4. `outbound` + `onnet`: Calls originating from the endpoint destined for another endpoint on the account

Using `any` for either setting will invoke recording for both options of that setting.

#### Concrete example

Sales wants calls to and from customers to be recorded but not calls within the account. The sales users would have their `call_recording` settings set as:
Expand Down

0 comments on commit bcf9431

Please sign in to comment.