.. _run_the_directory_number_inventory_audit_tool:


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

Run the Directory Number Inventory Audit Tool
---------------------------------------------

When you run the Directory Number Inventory (DNI) Audit Tool, the tool checks and
updates your directory number inventory since the last data sync.  A sync of
``device/cucm/Line`` from the Unified CM will result in various line types being
brought in - including lines assigned to devices, CTI devices, and so on -
essentially anything that would be seen under Directory Numbers in Unified CM.

This will create a number inventory entry for all the ``device/cucm/Lines``
that are in the system and at the site level. Any lines not at the site level
will not be processed in the audit tool.

.. note::

   This can result in inventory entries being created for lines that are not just
   user device related, for example CTI ports, CTI route points, and so on.  The
   Audit will not remove number inventory entries if a corresponding ``device/cucm/Line``
   does not exist, for example if it is removed outside of VOSS-4-UC.


The Number Inventory audit then includes logic to then determine if a number is
used or not and to set the number inventory value accordingly. That logic handles the
following cases:

* If a line is assigned to at least one of: phone, device profile, or remote
  destination profile, then it will be marked used = true and available will be
  left as true.
* If a number is used as a Hunt Pilot - it will mark the number used = true and
  available = false.
* Any other usage of the line is not handled, for example CTI route point. So while
  these numbers are added to the inventory, they will not be marked used or unavailable
  through the audit process.

When you run the tool, it creates new DNs for lines that don't have them. 

You specify where you want the tool to run and create a new DN inventory:

* **Customer Create**

  * Always creates new DN Inventory at the customer hierarchy level.
  * This option is only available for non-SLC dial plans, for instance Type 4 or
    non-SLC shell dial plan.
  * The DN inventory will be created at Customer hierarchy if the line exists at
    the customer level or at a site. The reason is that even if the administrator
    moves the line to a site later, the DN inventory at the customer level still
    applies. If the DN inventory already exists, it will be updated.
  
* **Site Create**
  
  * Always creates new DN Inventory at the site hierarchy level.
  * This option applies to any type of dial plan.
  * The DN inventory is created at the first site the line is encountered. If
    more than one line with the same pattern but different partitions exist, the
    DN inventory will be created for the first line encountered with that pattern.
  * If the line exists at customer level, a warning message is logged and the DN
    inventory is not created. If the DN inventory already exists, it will be
    updated.    
  
* **Smart Create**
 
  * Create new DN Inventory at the site hierarchy level.
  * If the line exists at a site and is not used by a phone in another site, this
    option creates a new DN inventory at the hierarchy where the line exists.
  * If the line exists at a site, is referenced by one or more phones in other
    sites, and the dial plan type is non-SLC, thats is type 4, this option creates
    a new DN inventory at the Customer level.    
  * If the line exists at a site, is referenced by one or more phones in other
    sites, and the dial plan type is SLC, that is type 1-3, a new DN inventory is
    created at the site where the line exists.
  * If the line exists at customer level, a warning message is logged and the DN
    inventory is not created. If the DN inventory already exists, it will be
    updated.
    
For sites using Site Location Code-based dial plans, DN inventories can be created
only at the Site hierarchy. The option to create DN inventories at the Customer
hierarchy is unavailable in this case.

The DN Inventory Audit Tool will mark data/InternalNumberInventory instances as
Shared across sites if a line is associated with multiple devices.

From **Directory Number Inventory**, you can see a list of DNs and move, delete,
and export them as desired.

**Log Messages** provides information and warning messages generated by the Directory
Number Inventory Audit Tool.

.. note::
  
   You cannot run the Directory Number Inventory Audit Tool if number management
   has been disabled for the customer.


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

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

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

  Ensure phones are not duplicated across the clusters
* Same directory number in one or more clusters.

  Ensure directory numbers (even in different partitions) are not
  duplicated across clusters.
  
* Numbers that are in a Cooling state will not be audited.  

   
Procedure
.........

1. Log in to VOSS-4-UC as provider or reseller administrator.
#. Open the **Directory Number Inventory Audit Tool** form.
#. If prompted, choose the correct hierarchy and click **OK**.

   .. note::

      The tool can only be run from Customer hierarchies. If you run the tool from
      a hierarchy that is not of type Customer, the tool will automatically provide
      you with a valid Customer hierarchy choice.

#. From the **Directory Number Inventory Creation Policy** drop-down, choose an
   option.
   
   .. note::

      Customers with Site Location Code-based dial plans will not see the **Customer
      Create** option.

#. Click **Save**.

The DN inventory is updated at the hierarchy you specified and below.