Kazoo Number Manager maintenance
SUP-able functions
Function | Arguments | Description |
---|---|---|
add_allowed_feature_on_number/2 | (_,_) | |
add_allowed_feature_on_reseller_of/2 | (_,_) | |
add_allowed_feature_on_system_config/1 | (_) | |
add_denied_feature_on_number/2 | (_,_) | |
add_denied_feature_on_reseller_of/2 | (_,_) | |
all_features/0 | ||
app_using/2 | (Num,AccountDb) | |
carrier_module_usage/0 | ||
carrier_module_usage/1 | (Prefix) | |
convert_carrier_module/2 | (Source,Target) | |
convert_carrier_module/3 | (Source,Target,Prefix) | |
convert_carrier_module_number/2 | (Num,Target) | |
copy_accounts_to_number_dbs/0 | ||
copy_accounts_to_number_dbs/1 | (AccountIds) | |
copy_assigned_number_dbs_to_account/1 | (Account) | |
copy_number_dbs_to_accounts/0 | ||
copy_number_dbs_to_accounts/1 | (NumberDbs) | |
copy_number_from_accountdb_to_numbdb/2 | (Account,Number) | |
copy_number_from_db_to_assigned_account/1 | (Num) | |
copy_numbers_from_accountdb_to_numbdbs/2 | (Account,Numbers) | |
copy_numbers_from_dbs_to_assigned_accounts/1 | (Numbers) | |
copy_single_account_to_number_dbs/1 | (AccountId) | |
copy_single_assigned_number_db_to_account/2 | (Account,NumberDb) | |
copy_single_number_db_to_accounts/1 | (NumberDb) | |
copy_single_number_to_account_db/2 | (Num,Account) | |
delete/1 | (Num) | |
destructively_remove_from_account_db_if_not_in_numdb/0 | ||
destructively_remove_from_number_dbs_if_not_in_accountdb/0 | ||
destructively_remove_from_single_account_db_if_not_in_numdb/1 | (AccountDb) | |
destructively_remove_from_single_numdb_if_not_in_accountdb/1 | (NumberDb) | |
ensure_adminonly_features_are_reachable/0 | ||
feature_permissions_on_number/1 | (Num) | |
feature_permissions_on_reseller_of/1 | (_) | |
feature_permissions_on_system_config/0 | ||
fix_account_db_numbers/1 | (Account) | |
fix_apps_for_account_dbs/0 | ||
fix_apps_for_account_dbs/1 | (AccountDbs) | |
fix_apps_for_number_dbs/0 | ||
fix_apps_for_number_dbs/1 | (NumberDbs) | |
fix_apps_for_single_account_db/1 | (Account) | |
fix_apps_for_single_number_db/1 | (NumberDb) | |
fix_apps_in_number_dbs_for_accounts/1 | (Accounts) | |
fix_apps_in_number_dbs_for_single_account/1 | (Account) | |
fix_number/2 | (Account,Number) | |
fix_numbers/2 | (Account,Numbers) | |
fix_numbers_apps_in_accountdb/2 | (Account,Numbers) | |
fix_numbers_apps_in_numbdb/1 | (Numbers) | |
flush_number_from_cache/1 | (Number) | Removes the Number from the cache used by knm_numbers |
flush_numbers_cache/0 | Removes all numbers from the cache used by knm_numbers | |
generate_js_classifiers/1 | (FunMatchBlock) | |
generate_numbers/4 | (Type,AccountId,StartingNumber,Quantity) | |
init_dbs/0 | ||
migrate/0 | ||
migrate_port_requests/0 | ||
migrate_unassigned_numbers/0 | ||
migrate_unassigned_numbers/1 | `(Number) | (_)` |
purge_deleted/0 | ||
purge_deleted/1 | (Prefix) | |
purge_discovery/0 | ||
purge_discovery/1 | (Prefix) | |
refresh_numbers_db/1 | `(_) | (_Thing)` |
refresh_numbers_dbs/0 | ||
register_views/0 | ||
remove_allowed_feature_on_number/2 | (_,_) | |
remove_allowed_feature_on_reseller_of/2 | (_,_) | |
remove_allowed_feature_on_system_config/1 | (_) | |
remove_denied_feature_on_number/2 | (_,_) | |
remove_denied_feature_on_reseller_of/2 | (_,_) | |
remove_wrong_assigned_from_accounts/0 | ||
remove_wrong_assigned_from_single_accountdb/1 | (Account) | |
reset_allowed_features_to_defaults_on_system_config/0 | ||
update_number_services_view/1 | (_) |
carrier_module_usage Prefix
Prefix
: the first few characters of an E164 number
sup kazoo_numbers_maintenance carrier_module_usage +1555
numbers%2F%2B1555:
knm_local: 7
knm_managed: 14
Totals:
knm_local: 7
knm_managed: 14
carrier_module_usage
sup kazoo_numbers_maintenance carrier_module_usage
...snip...
Totals:
knm_local: 174
knm_managed: 34
knm_bandwidth2: 1
knm_telnyx: 10
knm_bandwidth: 3
knm_mdn: 1
convert_carrier_module_number {NUM} Target
{NUM}
: a phone number convertible to E164 formatTarget
: a valid carrier module name
sup kazoo_numbers_maintenance convert_carrier_module_number 4152266659 knm_bandwid
Bad carrier module: knm_bandwid
sup kazoo_numbers_maintenance convert_carrier_module_number 4152266659 knm_bandwidth2
updated carrier module to knm_bandwidth2 for 1:
+14152266659
updating carrier module failed for 0:
convert_carrier_module Source Target Prefix
Source
: the carrier to match with (does not need to be valid)Target
: a valid carrier module namePrefix
: the first few characters of an E164 number
sup kazoo_numbers_maintenance convert_carrier_module knm_band knm_bandwidth2 +1415
attempt to convert numbers with carrier module knm_band to knm_bandwidth2 in database numbers%2F%2B1415
updated carrier module to knm_bandwidth2 for 0:
updating carrier module failed for 0:
convert_carrier_module Source Target
Source
: the carrier to match with (does not need to be valid)Target
: a valid carrier module name
sup kazoo_numbers_maintenance convert_carrier_module knm_bandwidth knm_bandwidth2
attempt to convert numbers with carrier module knm_bandwidth to knm_bandwidth2 in database numbers%2F%2B1414
updated carrier module to knm_bandwidth2 for 0:
updating carrier module failed for 0:
attempt to convert numbers with carrier module knm_bandwidth to knm_bandwidth2 in database numbers%2F%2B1415
updated carrier module to knm_bandwidth2 for 2:
+14152338397
+14152338421
updating carrier module failed for 0:
reset_allowed_features_to_defaults_on_system_config
sup kazoo_numbers_maintenance reset_allowed_features_to_defaults_on_system_config
Features allowed on system config document:
carrier_name cnam e911 failover force_outbound inbound_cnam outbound_cnam port prepend ringback
Maintenance commands to bulk copying number documents
These are sets of function operating on all number documents in each database(s) to copy the docs from number databases to account databases or vice versa.
You usually want to run these commands when you’re importing account database from another to cluster into the current system and want to sync the numbers in account database to their corresponding number databases (or vice versa you want to enforce numbers from number databases to their assigned account databases).
Copy all numbers from account database(s) to their corresponding number database(s)
Commands to sync/import numbers from account databases to number databases.
sup kazoo_numbers_maintenance copy_accounts_to_number_dbs
: Copy all number docs from all account dbs to their corresponding number dbs.
kazoo_numbers_maintenance:copy_accounts_to_number_dbs(AccountDbsList)
: Copy all number docs from a list of account dbs to their corresponding number dbs (Can only be called from Erlang Shell).
sup kazoo_numbers_maintenance copy_single_account_to_number_dbs {ACCOUNT_DB}
: Copy all number docs from a single account db to their corresponding number dbs.
Copy all numbers from number database(s) to their assigned account database(s)
Commands to sync/enforce numbers from number databases to their assigned account databases.
sup kazoo_numbers_maintenance copy_number_dbs_to_accounts
: Copy all numbers from all number databases to their assigned account databases.
kazoo_numbers_maintenance:copy_number_dbs_to_accounts(NumberDbsList)
: Copy all numbers from a list of number databases to their assigned account databases (Can only be called from Erlang Shell).
sup kazoo_numbers_maintenance copy_single_number_db_to_accounts {NUMBERDB}
: Copy all numbers from a single number database to their assigned account databases.
Copy all numbers assigned to a specific account from number database(s) to their assigned account database
Commands to sync/enforce numbers assigned to a specific account.
sup kazoo_numbers_maintenance copy_assigned_number_dbs_to_account {ACCOUNT}
: Copy all number documents assigned to {ACCOUNT}
from all number databases to account database.
sup kazoo_numbers_maintenance copy_single_assigned_number_db_to_account {ACCOUNT} {NUMBERDB}
: Copy all number documents assigned to {ACCOUNT}
from a single number database to account database.
Copy documents for a list of numbers
These commands are their counterpart commands above, but instead of operating on whole documents from database(s) they just documents for specified list of numbers.
sup kazoo_numbers_maintenance copy_number_from_accountdb_to_numbdb {ACCOUNT} {NUMBER}
: Copy the document for a single {NUMBER}
from {ACCOUNT}
database to its corresponding number database.
kazoo_numbers_maintenance:copy_numbers_from_accountdb_to_numbdbs(Account, NumbersList)
: Copy documents for NumbersList
from Account
database to their corresponding number databases (Can only be called from Erlang Shell).
sup kazoo_numbers_maintenance copy_number_from_db_to_assigned_account {NUMBER}
: Copy the document for a single {NUMBER}
from its number database to its assigned account database.
kazoo_numbers_maintenance:copy_numbers_from_dbs_to_assigned_accounts(NumbersList)
: Copy documents for a list of numbers NumbersList
from their corresponding number databases to their assigned account databases (Can only be called from Erlang Shell).
sup kazoo_numbers_maintenance copy_single_number_to_account_db {Number} {Account}
: DANGER: Copy a single number from its number database to the {Account}
database without checking if the number is really assigned to that account.
Fix/Sync issues with number(s)
These commands are attempting to fix mosy common issues with out of sync numbers by doing a series fixes:
- Try to fix numbers assigned to the account in number databases which have wrong applications usage set (wrong
used_by
field), by looking for assigned numbers in account’s callflow and trunkstore documents and checkused_by
field of number docs and fix the disparity. - After fixing app usage, copy all numbers assigned to the account from number databases to the account’s database.
- Remove numbers from account daatasbe that are not belong to the account (have wrong
pvt_assigned_to
field). - Reconsile the services (to sync service doc if any number is removed from account database in previous step).
sup kazoo_numbers_maintenance fix_account_db_numbers {ACCOUNT}
: Try to fix all numbers assigned {ACCOUNT}
.
sup kazoo_numbers_maintenance fix_number {ACCOUNT} {NUMBER}
: Try to fix a single number assigned to account.
sup kazoo_numbers_maintenance fix_numbers(Account, NumbersList)
: Try to fix a list of numbers assigned to account (Can only be called from Erlang Shell).
Fix numbers application usage
These commands try to fix numbers in databases which have wrong applications usage set (wrong used_by
field), by looking for assigned numbers in assigned account’s callflow and trunkstore documents and check used_by
field of number docs and fix the disparity.
sup kazoo_numbers_maintenance fix_apps_for_account_dbs
: Fix apps for all numbers in all account databases.
kazoo_numbers_maintenance:fix_apps_for_account_dbs(AccountsList)
: Fix apps for all numbers for a list of account databases (Can only be called from Erlang Shell).
sup kazoo_numbers_maintenance fix_apps_for_single_account_db {ACCOUNT}
: Fix apps for all numbers in a single account database.
sup kazoo_numbers_maintenance fix_apps_for_number_dbs
: Fix apps for all assigned numbers in all number databases.
kazoo_numbers_maintenance:fix_apps_for_number_dbs(NumberDbsList)
: Fix apps for all assigned numbers in a list of number databases (Can only be called from Erlang Shell).
kazoo_numbers_maintenance:fix_apps_in_number_dbs_for_accounts(AccountsList)
: Fix apps for all numbers in number databases assigned to corsspanding account in AccountsList
(Can only be called from Erlang Shell).
sup kazoo_numbers_maintenance fix_apps_in_number_dbs_for_single_account {ACCOUNT}
: Fix apps for all numbers in number databases assigned to account ACCOUNT
.
sup kazoo_numbers_maintenance fix_apps_for_single_number_db {NUMBER_DB}
: Fix apps for all numbers in a single number databases.
kazoo_numbers_maintenance:fix_numbers_apps_in_accountdb(Account, NumbersList)
: Fix apps for a list of numbers in a single account database (Can only be called from Erlang Shell).
kazoo_numbers_maintenance:fix_numbers_apps_in_numbdb(NumbersList)
: Fix apps for a list of numbers in their corsspanding number databases (Can only be called from Erlang Shell).
Remove wrong assigned numbers from account database(s)
This check pvt_assigned_to
field of all numbers in account database(s) and if its is not equal to the account ID, will remove the ndocument(s).
sup kazoo_numbers_maintenance remove_wrong_assigned_from_accounts
: Remove numbers with wrong assignment from all account databases.
sup kazoo_numbers_maintenance remove_wrong_assigned_from_single_accountdb {Account}
: Remove numbers with wrong assignment from a single account database.
Commands to remove numbers if their won’t exists in their corsspanding databases
These are handy commands which removing number documents if their are missing from their corsspanding databases. These are intended to cleanup numbers after in your test environment or dev environment. DO NOT USE THESE COMMANDS IN PRODUCTION SERVERS.
!!! Caution Use these commands if you really understand what are you doing.
sup kazoo_numbers_maintenance destructively_remove_from_account_db_if_not_in_numdb/0
: Remove numbers from all account databases if they’re not exists in any number database.
sup kazoo_numbers_maintenance destructively_remove_from_number_dbs_if_not_in_accountdb/0
: Remove numbers from all number databases if they’re not exists in any account database.
sup kazoo_numbers_maintenance destructively_remove_from_single_account_db_if_not_in_numdb/1
: Remove numbers from a single account database if they’re not exists in any number database.
sup kazoo_numbers_maintenance destructively_remove_from_single_numdb_if_not_in_accountdb/1
: Remove numbers from all a single number database if they’re not exists in any account database.