.. _internal-number-inventory-functions:
Internal Number Inventory Functions
-----------------------------------
.. _19.2.1|VOSS-542|EKB-2929:
.. _19.3.4-PB4|EKB-9330:
The ``fn.lines`` macro functions use the value of a
CUSTOMER_INI_ENABLED macro at the relevant hierarchy:
* If ``((True))``, then apply the function to the Internal Number Inventory
(INI) at the hierarchy: ``data.InternalNumberInventory.internal_number``.
* If ``((False))``, then apply the function to ``device.cucm.Line.pattern``,
optionally with a specified ``routePartitionName``.
All macros will check the CUSTOMER_INI_ENABLED macro first.
This macro should exist at the required hierarchy level and have a
value of ``((True))`` or ``((False))``.
* CUSTOMER_INI_ENABLED macro is ``((False))``:
Give the following patterns and route partition
on the Unified Communications Manager:
.. tabularcolumns:: |p{3cm}|p{11cm}|
+--------+----------------------+
| Number | Partition |
+========+======================+
| 1000 | |
+--------+----------------------+
| 2000 | Site-REL103-Customer |
+--------+----------------------+
| 3000 | |
+--------+----------------------+
| 4000 | Site-REL103-Customer |
+--------+----------------------+
| 5000 | Site-REL103-Customer |
+--------+----------------------+
| 6000 | |
+--------+----------------------+
* *fn.lines*: Return a list of lines. With no parameter, list all the lines on the associated
Unified Communications Manager. If the optional parameter is a route partition,
list the lines in the partition. If the optional parameter is ``custom``, show an empty list.
If an E164 number is associated with the INI number, then the E164 number is also shown.
Examples:
.. tabularcolumns:: |p{8cm}|p{7cm}|
+-------------------------------------+-------------------------------------------+
| Example | Output |
+=====================================+===========================================+
| :: | :: |
| | |
| {{fn.lines}} | [{u'value': u'1000', |
| | u'title': u'1000 +27826543001'}, |
| | {u'value': u'2000', |
| | u'title': u'2000'}, |
| | {u'value': u'3000', |
| | u'title': u'3000'}, |
| | {u'value': u'4000', |
| | u'title': u'4000 +27826543004'}, |
| | {u'value': u'5000', |
| | u'title': u'5000'}, |
| | {u'value': u'6000', |
| | u'title': u'6000'}] |
| | |
| | |
| {{fn.lines Site-REL103-Customer}} | [{u'value': u'2000', |
| | u'title': u'2000'}, |
| | {u'value': u'4000', |
| | u'title': u'4000'}, |
| | {u'value': u'5000', |
| | u'title': u'5000'}] |
| | |
| {{fn.lines custom}} | [] |
+-------------------------------------+-------------------------------------------+
* CUSTOMER_INI_ENABLED macro is ``((True))``:
Given the following properties of an example Internal Number Inventory:
.. tabularcolumns:: |p{6cm}|p{4cm}|p{4cm}|
+--------+--------+-----------+
| Number | In Use | Available |
+========+========+===========+
| 1000 | N | Y |
+--------+--------+-----------+
| 2000 | N | Y |
+--------+--------+-----------+
| 3000 | N | N |
+--------+--------+-----------+
| 4000 | Y | Y |
+--------+--------+-----------+
| 5000 | Y | Y |
+--------+--------+-----------+
| 6000 | Y | N |
+--------+--------+-----------+
.. index:: Macro function;fn.lines
* *fn.lines*: Return a list of available lines on the Internal Number Inventory, with used lines indicated as (used).
The E164 number associated with the INI is shown if available.
.. index:: Macro function;fn.lines_available_only
* *fn.lines_available_only*: Return a list of available lines from the Internal Number Inventory, with
in brackets after each.
.. index:: Macro function;fn.lines_used_only
* *fn.lines_used_only*: Return a list of used lines from the Internal Return a Number Inventory, with in brackets after each.
.. index:: Macro function;fn.lines_unavailable_only
* *fn.lines_unavailable_only*: Return a list of unavailable lines from the Internal Number Inventory, with in brackets after each.
.. index:: Macro function;fn.lines_unused_only
* *fn.lines_unused_only*: Return a list of unused lines from the Internal Number Inventory, with in brackets after each.
.. index:: Macro function;fn.lines_available_used
* *fn.lines_available_used*: Return a list of available and used lines from the Internal Number Inventory, with in brackets after each.
.. index:: Macro function;fn.lines_available_unused
* *fn.lines_available_unused*: Return a list of available and unused lines from the Internal Number Inventory, with in brackets after each.
.. index:: Macro function;fn.lines_unavailable_used
* *fn.lines_unavailable_used*: Return a list of unavailable, used lines from the Internal Number Inventory, with in brackets after each.
.. index:: Macro function;fn.lines_unavailable_unused
* *fn.lines_unavailable_unused*: Return a list of unavailable and unused lines from the Number Inventory, with in brackets after each.
Examples:
.. tabularcolumns:: |p{8cm}|p{7cm}|
+-------------------------------------+------------------------------------------------+
| Example | Output |
+=====================================+================================================+
| :: | :: |
| | |
| {{fn.lines}} | |
| | |
| | [{u'value': u'1000', |
| | u'title': u'1000 +27826543001', |
| | {u'value': u'2000', |
| | u'title': u'2000'}, |
| | {u'value': u'4000', |
| | u'title': u'4000 (used) +27826543004'}, |
| | {u'value': u'5000', |
| | u'title': u'5000 (used)'}] |
+-------------------------------------+------------------------------------------------+
| :: | :: |
| | |
| {{fn.lines_available_only avail}} | |
| | |
| | [{u'value': u'1000', |
| | u'title': u'1000 (avail)'}, |
| | {u'value': u'2000', |
| | u'title': u'2000 (avail)'}, |
| | {u'value': u'4000', |
| | u'title': u'4000 (avail)'}, |
| | {u'value': u'5000', |
| | u'title': u'5000 (avail)'}] |
+-------------------------------------+------------------------------------------------+
| :: | :: |
| | |
| {{fn.lines_used_only inuse}} | |
| | |
| | [{u'value': u'4000', |
| | u'title': u'4000 (inuse)'}, |
| | {u'value': u'5000', |
| | u'title': u'5000 (inuse)'}] |
+-------------------------------------+------------------------------------------------+
| :: | :: |
| | |
| {{fn.lines_unavailable_only}} | |
| | |
| | [{u'value': u'3000', |
| | u'title': u'3000'}, |
| | {u'value': u'6000', |
| | u'title': u'6000 (used)'}] |
+-------------------------------------+------------------------------------------------+
| :: | :: |
| | |
| {{fn.lines_unused_only}} | |
| | |
| | [{u'value': u'1000', |
| | u'title': u'1000'}, |
| | {u'value': u'2000', |
| | u'title': u'2000'}, |
| | {u'value': u'3000', |
| | u'title': u'3000'}] |
+-------------------------------------+------------------------------------------------+
| :: | :: |
| | |
| {{fn.lines_available_used}} | |
| | |
| | [{u'value': u'4000', |
| | u'title': u'4000 (used)'}, |
| | {u'value': u'5000', |
| | u'title': u'5000 (used)'}] |
+-------------------------------------+------------------------------------------------+
| :: | :: |
| | |
| {{fn.lines_available_unused}} | |
| | |
| | [{u'value': u'1000', |
| | u'title': u'1000'}, |
| | {u'value': u'2000', |
| | u'title': u'2000'}] |
+-------------------------------------+------------------------------------------------+
| :: | :: |
| | |
| {{fn.lines_unavailable_used}} | |
| | |
| | [{u'value': u'6000', |
| | u'title': u'6000'}] |
+-------------------------------------+------------------------------------------------+
| :: | :: |
| | |
| {{fn.lines_unavailable_unused}} | |
| | |
| | [{u'value': u'3000', |
| | u'title': u'3000'}] |
+-------------------------------------+------------------------------------------------+
.. index:: Macro function;fn.get_associated_lines
* *fn.get_associated_lines*: Return a list of lines associated with a given userid
from device.cucm.User.
Examples:
.. tabularcolumns:: |p{8cm}|p{7cm}|
+-----------------------------------------+-------------------------+
| Example | Output |
+=========================================+=========================+
| :: | :: |
| | |
| {{ fn.get_associated_lines jsmith }} | { "85089", "85090" } |
| | |
+-----------------------------------------+-------------------------+
.. index:: Macro function;fn.associated_dn_list
* *fn.associated_dn_list*: Return a list of directory numbers associated with
E164 numbers at the specified context hierarchy and lower. Two models are
queried. Results include the range: ``data/HcsDpDNE164AssociateDAT`` and
``data/HcsDpDNMultiE164AssociateDAT``.
Examples:
.. tabularcolumns:: |p{8cm}|p{7cm}|
+--------------------------------+----------------------+
| Example | Output |
+================================+======================+
| :: | :: |
| | |
| {# fn.associated_dn_list #} | [ |
| | "1015000", |
| | "81104600", |
| | "81104601", |
| | "81104602", |
| | "81104603" |
| | ] |
+--------------------------------+----------------------+
.. index:: Macro function;fn.get_dn_number
* *fn.get_dn_number*: Return the matching Directory Number (DN)
in a range given a E164 number as input.
The E164 ranges are of 1, 10, 100 and 1000.
Two models are queried. If no results are found in ``data/HcsDpDNE164AssociateDAT`` then
the ranges in ``data/HcsDpDNMultiE164AssociateDAT`` are queried.
Examples:
.. tabularcolumns:: |p{8cm}|p{7cm}|
+--------------------------+-------------+
| Example | Output |
+==========================+=============+
| hierarchy: | |
| | |
| sys.hcs.CS.Global.LOC002 | |
| | |
| | |
| :: | :: |
| | |
| {{ fn.get_dn_number | 82041000 |
| \+121000 }} | |
| | |
+--------------------------+-------------+
.. index:: Macro function;fn.get_e164_number
* *fn.get_e164_number*: Return the matching E164 number at the
specified context hierarchy; given a Directory Number (DN) range as input.
If not found, return a blank result.
Two models are queried. If no results are found in ``data/HcsDpDNE164AssociateDAT`` then the
ranges in ``data/HcsDpDNMultiE164AssociateDAT`` are queried. This means that a E164 range mapping to a
range of DNs including that DN would take precedence over a range of E164 mapped to a single DN if
both mappings existed for the DN. In the event of a match on a range of E164 numbers mapped to a Single DN,
the primary E164 configured is the E164 number returned.
If the primary is not configured then no E164 number is returned.
Examples:
.. tabularcolumns:: |p{8cm}|p{7cm}|
+--------------------------+--------------------+
| Example | Output |
+==========================+====================+
| hierarchy: | |
| | |
| sys.hcs.CS.Global.LOC002 | |
| | |
| | |
| :: | :: |
| | |
| {{ fn.get_e164_number | \+1555559712 |
| 82029712 }} | |
| | |
+--------------------------+--------------------+