.. _emergency-and-cli-settings:


Emergency and CLI settings
--------------------------

.. _19.2.1|VOSS-611:


.. tip:: 

   :ref:`use-action-search-to-navigate-automate`


Overview 
..........


Emergency and CLI settings provides a facility for mapping a site-specific CLI (Calling Line Identity) for emergency and non-emergency calls. This
allows users to roam using extension mobility and still provide a site-specific 
emergency number appropriate to the site they have visited.

.. note:: 
   
   To access this feature, go to **Emergency and CLI Settings**.

When deploying a Cisco HCS site dialplan, a site-specific emergency number is configured
as a default emergency number for all devices at that site. This feature allows
users making an emergency call from within their own site to present a CLI of their
own individual DDI (Direct Dial In) instead of the site wide emergency CLI.

A CLI mapping and secondary CLI mapping can also be created using this feature.
The behavior is controlled through settings that can exist at any hierarchy.

This feature allows a Provider administrator (or higher) to add up to three (3)
new calling party transformation patterns to provide specific translation to a DDI
for those DNs having a DDI mapping. The transformations are created and deleted
when either '1 to 1' or '1 to N' number associations are created and deleted. See
:ref:`assoc-set-e164-numbers-to-one-dir-number` and :ref:`assoc-range-e164-numbers-to-range-dir-numbers`   

Using the HCS dialplan schema, site wide mapping is provided using a wildcard match
to a site specific prefix used only for emergency calls. An example is '**\*156*!**'.
This feature may be used to add more specific patterns such as '**\*156*81214000**'
in order that transformations to the E164 can take place. DNs that do not have a
mode specific match fall back to the wildcard match as previously set, and therefore
use the site wide emergency CLI.

.. note::

   There is no requirement to use any schema. This feature can be used wherever
   transformations are required as part of DN association.
	
The supported transformation patterns are:

* **Emergency CLI** transformation
* **CLI** transformation
* **Secondary CLI** transformation

A data model contains settings for this feature. A default set of settings is
created at the ``sys.hcs`` hierarchy, which disables all 3 patterns. These settings
must be cloned and used at a lower hierarchy to provide the settings required
for each hierarchy, that is clone them to the provider level for platform wide
settings, or customer level for customer specific settings.

Each of the 3 patterns can be enabled or disabled independently. The following
additional controls are available:

* Macro for defining the partition
* Macro for defining the E164 number format
* Macro for defining the DN (pattern) format

The following macros can be used as part of these settings:

* EmergencyAndCLITransformations_SiteCountryCode - returns the country code, e.g. 44
* EmergencyAndCLITransformations_SiteCountryCodeWithPlus - returns the country code
  with a plus, e.g. +44
* EmergencyAndCLITransformations_NationalTrunkPrefix - returns the trunk prefix,
  e.g. 0

Each of these macros is country aware and returns the settings appropriate to the
site where the DN association is performed.

In addition to these macros, there is a set of pwf context variables that can be
used in the settings macros:

* pwf.e164_number - the E164 number from the mapping transaction
* pwf.dn_number - the directory number from the transaction
* pwf.sitePrefix - the site prefix number as used for HCS emergency calling

.. note::

   Only site level associations are supported, no support is provided for linked
   sites.


Emergency handling
...................

Emergency handling is device-based. It uses the device pool local route
group to handle call routing. When a phone has no Direct Inward Dial (DDI)
or the phone has DDI but it is in a remote location, emergency handling
uses the site's emergency number.

The implementation is as follows:

* An Emergency partition is created for each site.
* For Device-Based Routing (DBR), a DeviceDBR CSS is created and for
  Line Based Routing (LBR) an EmerCSS is created. Both CSSs are country
  and site specific and they contains the Emergency partition.
* Emergency Number translation patterns are added to the emergency
  partition when a site dial plan is added. This translation pattern
  leverages the UseOriginatingCSS, prefixes the called number with \**104
  and the calling number is prefixed with \*1\*LRID* to uniquely identify
  the calling site.
* An Emergency route pattern matching \**104 is added to the emergency
  partition with the route list set to use the Device Pool Emergency
  Local Route Group.


The image illustrates Emergency Calling.

.. image:: /src/images/emergency-calling.png



Provisioning emergency calls
...............................

Additional provisioning is not required for emergency calls since Automate provisions 
911 as part of the United States country scheme, and 999/112 is provisioned as part of the 
United Kingdom country scheme. For more information, see "Emergency Handling".



1. When creating a site dial plan, enter the emergency number in the **Emergency Number** field. 
   
   This is the Site Emergency Published Number; it is sent if the line that makes the emergency call 
   does not have DDI. Then, if there is a callback, the Site Emergency Published Number
   is dialed.

2. Ensure that a Local Route group is set up with SLRG-Emer set to the
   Route group. Refer to "Associate Local Route Groups to a Device Pool".
