diff --git a/applications/crossbar/doc/ref/users.md b/applications/crossbar/doc/ref/users.md index 2c902c46d30..519a036cf0b 100644 --- a/applications/crossbar/doc/ref/users.md +++ b/applications/crossbar/doc/ref/users.md @@ -60,7 +60,7 @@ Key | Description | Type | Default | Required | Support Level `ringtones.external` | The alert info SIP header added when the call is from internal sources | `string(0..256)` | | `false` | `ringtones.internal` | The alert info SIP header added when the call is from external sources | `string(0..256)` | | `false` | `ringtones` | Ringtone Parameters | `object()` | `{}` | `false` | -`should_create_caller_id_name_if_undefined` | Create the users caller id name from the first and last name fields if no caller id is defined | `boolean()` | | `false` | +`should_create_caller_id` | Create the users caller id name from the first and last name fields if no caller id is defined | `boolean()` | | `false` | `timezone` | User's timezone | `string()` | | `false` | `supported` `username` | The GUI login username - alpha-numeric, dashes, at symbol, periods, plusses, and underscores allowed | `string(1..256)` | | `false` | `supported` `verified` | Determines if the user has been verified | `boolean()` | `false` | `false` | diff --git a/applications/crossbar/doc/users.md b/applications/crossbar/doc/users.md index f2a3df687bf..bab30bcee56 100644 --- a/applications/crossbar/doc/users.md +++ b/applications/crossbar/doc/users.md @@ -62,7 +62,7 @@ Key | Description | Type | Default | Required | Support Level `ringtones.external` | The alert info SIP header added when the call is from internal sources | `string(0..256)` | | `false` | `ringtones.internal` | The alert info SIP header added when the call is from external sources | `string(0..256)` | | `false` | `ringtones` | Ringtone Parameters | `object()` | `{}` | `false` | -`should_create_caller_id_name_if_undefined` | Create the users caller id name from the first and last name fields if no caller id is defined | `boolean()` | | `false` | +`should_create_caller_id` | Create the users caller id name from the first and last name fields if no caller id is defined | `boolean()` | | `false` | `timezone` | User's timezone | `string()` | | `false` | `supported` `username` | The GUI login username - alpha-numeric, dashes, at symbol, periods, plusses, and underscores allowed | `string(1..256)` | | `false` | `supported` `verified` | Determines if the user has been verified | `boolean()` | `false` | `false` | diff --git a/applications/crossbar/priv/api/swagger.json b/applications/crossbar/priv/api/swagger.json index e29c549560f..80b1c4095e2 100644 --- a/applications/crossbar/priv/api/swagger.json +++ b/applications/crossbar/priv/api/swagger.json @@ -36933,7 +36933,7 @@ }, "type": "object" }, - "should_create_caller_id_name_if_undefined": { + "should_create_caller_id": { "description": "Create the users caller id name from the first and last name fields if no caller id is defined", "type": "boolean" }, diff --git a/applications/crossbar/priv/couchdb/schemas/users.json b/applications/crossbar/priv/couchdb/schemas/users.json index 4d33fc2dde0..5c5e8593092 100644 --- a/applications/crossbar/priv/couchdb/schemas/users.json +++ b/applications/crossbar/priv/couchdb/schemas/users.json @@ -284,7 +284,7 @@ }, "type": "object" }, - "should_create_caller_id_name_if_undefined": { + "should_create_caller_id": { "description": "Create the users caller id name from the first and last name fields if no caller id is defined", "type": "boolean" }, diff --git a/core/kazoo_documents/src/kzd_users.erl.src b/core/kazoo_documents/src/kzd_users.erl.src index f0a81718a9a..9de5881fdb8 100644 --- a/core/kazoo_documents/src/kzd_users.erl.src +++ b/core/kazoo_documents/src/kzd_users.erl.src @@ -55,7 +55,7 @@ -export([ringtones/1, ringtones/2, set_ringtones/2]). -export([ringtones_external/1, ringtones_external/2, set_ringtones_external/2]). -export([ringtones_internal/1, ringtones_internal/2, set_ringtones_internal/2]). --export([should_create_caller_id_name_if_undefined/1, should_create_caller_id_name_if_undefined/2, set_should_create_caller_id_name_if_undefined/2]). +-export([should_create_caller_id/1, should_create_caller_id/2, set_should_create_caller_id/2]). -export([timezone/1, timezone/2, set_timezone/2]). -export([username/1, username/2, set_username/2]). -export([verified/1, verified/2, set_verified/2]). @@ -664,17 +664,17 @@ ringtones_internal(Doc, Default) -> set_ringtones_internal(Doc, RingtonesInternal) -> kz_json:set_value([<<"ringtones">>, <<"internal">>], RingtonesInternal, Doc). --spec should_create_caller_id_name_if_undefined(doc()) -> kz_term:api_boolean(). -should_create_caller_id_name_if_undefined(Doc) -> - should_create_caller_id_name_if_undefined(Doc, 'undefined'). +-spec should_create_caller_id(doc()) -> kz_term:api_boolean(). +should_create_caller_id(Doc) -> + should_create_caller_id(Doc, 'undefined'). --spec should_create_caller_id_name_if_undefined(doc(), Default) -> boolean() | Default. -should_create_caller_id_name_if_undefined(Doc, Default) -> - kz_json:get_boolean_value([<<"should_create_caller_id_name_if_undefined">>], Doc, Default). +-spec should_create_caller_id(doc(), Default) -> boolean() | Default. +should_create_caller_id(Doc, Default) -> + kz_json:get_boolean_value([<<"should_create_caller_id">>], Doc, Default). --spec set_should_create_caller_id_name_if_undefined(doc(), boolean()) -> doc(). -set_should_create_caller_id_name_if_undefined(Doc, ShouldCreateCallerIdNameIfUndefined) -> - kz_json:set_value([<<"should_create_caller_id_name_if_undefined">>], ShouldCreateCallerIdNameIfUndefined, Doc). +-spec set_should_create_caller_id(doc(), boolean()) -> doc(). +set_should_create_caller_id(Doc, ShouldCreateCallerId) -> + kz_json:set_value([<<"should_create_caller_id">>], ShouldCreateCallerId, Doc). -spec timezone(doc()) -> kz_term:api_binary(). timezone(Doc) -> diff --git a/core/kazoo_endpoint/src/kz_endpoint.erl b/core/kazoo_endpoint/src/kz_endpoint.erl index b8b0fab6868..07f862e536c 100644 --- a/core/kazoo_endpoint/src/kz_endpoint.erl +++ b/core/kazoo_endpoint/src/kz_endpoint.erl @@ -84,7 +84,7 @@ -define(RECORDING_ARGS(Call, Data), [kapps_call:clear_helpers(Call), Data]). --define(SHOULD_CREATE_CALLER_ID_NAME_IF_UNDEFINED(UserJObj), kzd_users:should_create_caller_id_name_if_undefined(UserJObj, 'true')). +-define(SHOULD_CREATE_CALLER_ID(UserJObj), kzd_users:should_create_caller_id(UserJObj, 'true')). -type sms_route() :: {binary(), kz_term:proplist()}. -type sms_routes() :: [sms_route(), ...]. @@ -502,7 +502,7 @@ merge_value(Key, Account, Endpoint, Owner) -> caller_id_owner_attr(Owner) -> OwnerAttr = kz_json:get_json_value(<<"caller_id">>, Owner, kz_json:new()), L = [<<"internal">>, <<"name">>], - case ?SHOULD_CREATE_CALLER_ID_NAME_IF_UNDEFINED(Owner) + case ?SHOULD_CREATE_CALLER_ID(Owner) andalso not kz_json:is_defined(L, OwnerAttr) of 'true' -> lager:debug("creating caller id name from users first and last name"),