.. _run_the_directory_number_inventory_audit_tool:

.. rst-class:: chapter-with-expand

Audit Number Inventory
----------------------

.. note::
  
   You cannot run **Audit Number Inventory** if number management has been disabled
   for the customer (see *Create and Modify a Customer*). 


.. index:: Flowchart;Audit Number Inventory

This feature performs an audit of the number inventory and makes sure that the 
**Status** and **Usage** of each number aligns to the devices or services
configured with these matching numbers. See :ref:`concepts-number-status-usage`
for more details about these values.

The audit will create new numbers for devices or services that don't already exist,
as well as update existing number entries to make sure the **Status** and **Usage**
fields reflect the correct information at the time the audit is run.
Number entries **will not be deleted**.

.. uml::
 
   @startuml
   !include style.iuml

   start
   while (Number Management enabled for customer? [default] ) is (No)
     :[[../src/user/create-customer.html Enable Number Management]];
   endwhile (Yes)
   :Choose Audit Number Inventory option;
   note right
     Options: 
     * Customer (not available for customers with Site Location Code-based dial plans)
     * Site

   end note
   :Save;
   stop
   @enduml


Specify where you want to run and create a new number inventory:

* **Customer**

  * Running the number inventory audit at **Customer** level will add directory
    numbers at Customer level for services which exist at Site or Customer,
    **provided there is not** already a directory number for that service at Site
    level. If there are already directory numbers at the Site level then those
    will also get updated.
    
    This is a mixed mode of audit, which audits directory numbers at both Customer
    and Site level. For example, if directory numbers only exist at Customer level,
    then the audit will only add and update directory numbers that exist at the
    Customer. If there are directory numbers at Site level, the audit will still
    add new directory numbers at the Customer level, but will also update the
    existing directory numbers at Site level.

* **Site**
  
  * Running the number inventory audit at **Site** level will add directory numbers
    at site level, and update any existing directory numbers at site level only.
    No Customer level directory numbers will be audited and no directory numbers
    will be added to Customer level for Customer level services.
  * You can choose to audit either *All* the Sites for the Customer or selected 
    Sites. 

For sites using Site Location Code-based dial plans, number inventories can be
created only at the site hierarchy, the customer hierarchy will not be available.

From the **Number Inventory** form (default menu **Number Management > Number Inventory**),
you can see a list of internal numbers and move, delete, and export them as desired.


Common Errors and Caveats
.........................

* Error: Duplicate device profiles (same profile name) in different clusters.

  Resolution: Ensure device profiles are not duplicated across the sites.
* Error: Duplicate phones (same MAC) in different clusters.

  Resolution: Ensure phones are not duplicated across the clusters
* Error: Same internal number in one or more clusters.

  Resolution: Ensure internal numbers (even in different partitions) are not
  duplicated across clusters.
  
* Numbers that are in a Cooling or Reserved state will not be audited.

   
Run Audit Number Inventory
...........................

.. note::

   You can only run **Audit Number Inventory** from a customer hierarchy. If
   you try to run it from a hierarchy that is not of type Customer, you will
   be prompted to choose a valid customer hierarchy.


1. Log in to VOSS-4-UC as provider or reseller administrator.
#. Open the **Audit Number Inventory** form (default menu **Number Management >
   Audit Number Inventory**).
#. Browse to the customer hierarchy at which you want to run **Audit Number
   Inventory**.   
#. Choose either **Customer** or **Site** from the **Is Number Inventory deployed
   at Customer or Site Level ?** drop-down.
#. If you chose **Customer**, click **Save** to run **Audit Number Inventory** at
   all sites that are located under the selected customer.
#. If you chose **Site**, choose either **All** from the **Would you like to audit
   all sites or a subset of sites ?** to run **Audit Number Inventory** at
   all the sites under the selected customer, *or* choose **Specific** and specify
   the sites on which you want to run **Audit Number Inventory** (200 maximum). 

#. Click **Save**. The number inventory is updated at the hierarchy you specified
   and below.