.. _assoc-disas-sip-local-gw-to-site:

Associate or disassociate SIP local gateway to a site 
------------------------------------------------------

.. _24.1|EKB-18884:


:bdg-secondary:`provider-only`

.. tip:: 

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



Overview 
..........

Associating a SIP local gateway to a site triggers registered IOS Builder events and triggers 
registered dial plan schema group custom workflows. Only SIP local gateways that share a common 
Cisco UCM cluster as specified in the site NDL and have the same country as the site can be associated 
with a site hierarchy node.

.. note:: 

   * Sites with the same area code(s)

     In this scenario, there are two possibilities: 
     
     * All sites share the same TDM trunks to the provider -- this is supported with the 
       default IOS Command Builder templates 
     * Each site has its own TDM trunk to the provider -- this is not supported with the default 
       IOS Command Builder templates

   * Sites with different area codes

     In this scenario, it is unlikely the sites will be sharing the same TDM trunks. However even if they do 
     share the same TDM trunks, it is not currently supported without having to manually modify the default 
     IOS Command Builder templates. If the admin does deploy a shared LBO gateway to two or more sites with 
     different area codes using the default IOS Command Builder templates, calls from one of these sites 
     to a number that is in the same area code as another site sharing the same trunk will be treated as a 
     local/subscriber call.

     A site with its own trunk is also not supported without modifying the default IOS Command Builder templates.


Associate a SIP local gateway to a site
.........................................

This procedure associates a SIP local gateway with a site.

**Prerequisites**:

* The SIP local gateway and the target site must be in the same country.
* The SIP local gateway and the target site must have the same CUCM Publisher.
* The target site must have a site dial plan deployed.



.. note::

   * A SIP local gateway can be associated with multiple sites given the
     prerequisite conditions are met.
   * A site can be associated with multiple SIP local gateways given the
     prerequisite conditions are met.
   * If a SIP local gateway is deleted, all existing site associations are
     disassociated.
   * If a site is deleted via the **Delete Site** page and at
     least \"Remove Dial Plan Items\" is selected, all SIP local gateway
     associations for that site are disassociated.
   * If a site dial plan is deleted, all SIP local gateway associations are
     disassociated.


**Perform these steps**:

1. Log in as provider, reseller, or customer administrator.
2. Set the hierarchy to the site for which you want to associate a
   SIP local gateway.

   If you do not have the path set to a site, you are prompted to select
   the site.

3. Go to **Associate SIP Local Gateway**. 
4. Click the Plus icon (+) to add a record.
5. Select the SIP local gateway you want to associate with the site from
   the menu.

   Only SIP local gateways that have the same country and CUCM Publisher
   configuration as the site are available to be selected.

6. Click **Save**. View transaction progress and details in the Transaction Logs. 
   See :ref:`transaction-logging-and-audit`
   
   * The SIP local gateway appears in the **Associate SIP Local Gateway** list view.
   * The HcsSipLocalGwAddSitePstnEVT event is generated. If enabled, the IOS
     Command Builder generates the default IOS commands associated with the event.
   * For each Area Code defined on the target site's dial plan, the
     HcsSipLocalGwAddSiteAreaCodeEVT event is generated. If enabled, the
     IOS Command Builder generates the default IOS commands associated with
     the event.
   * If the site has an existing E.164 to DN Association (N to N), either
     the HcsSipLocalGwAddE164AssociationEVT (for N to N) or the
     HcsSipLocalGwAddMultiE164AssociationEVT event (for N to 1) is
     generated. If enabled, the IOS Command Builder generates the default
     IOS commands associated with the event.
   * If the site has an existing Voice Mail Pilot Number Association, the
     HcsSipLocalGwAddVoiceMailPilotNumberEVT event is generated. If
     enabled, the IOS Command Builder generates the default IOS commands
     associated with the event.
   * If the Dial Plan Schema Group that is associated with the customer
     dial plan has the associateLboGateway custom workflow provisioned, the
     associateLboGateway custom workflow is executed.
   * The Site association to the SIP local gateway creates a Route Group
     with the SIP Trunk created and associated to the SIP local gateway.




Disassociate a SIP local gateway from a site
...................................................

This procedure disassociates a SIP local gateway from a site.

.. note::

   Prior to Automate, IOS commands generated at a site were lost when the site
   was deleted.


**Perform these steps**:

1. Log in as provider, reseller, or customer administrator.
2. Go to **Associate SIP Local Gateway**. 
3. Select the checkbox adjacent to the SIP local gateway you want to disassociate,
   then click **Delete**.

   * The SIP local gateway association is removed from the **Associate SIP
     Local Gateway** list view.
   * The HcsSipLocalGwDelSitePstnEVT event is generated. If enabled, the
     IOS Command Builder generates the default IOS commands associated with
     the event.
   * For each Area Code defined on the site's dial plan, the
     HcsSipLocalGwDelSiteAreaCodeEVT event is generated. If enabled, the
     IOS Command Builder generates the default IOS commands associated with
     the event. If Area Codes are shared across multiple sites and
     associated with the same gateway, the commands are generated only when
     the gateway is disassociated from the last site that shares the Area
     Code.
   * If the site has an existing E.164 to DN Association, either the
     HcsSipLocalGwDelE164AssociationEVT (for N to N) or
     HcsSipLocalGwDelMultiE164AssociationEVT (for N to 1) event is
     generated. If enabled, the IOS Command Builder generates the default
     IOS commands associated with the event.
   * If the site has an existing Voice Mail Pilot Number Association, the
     HcsSipLocalGwDelVoiceMailPilotNumberEVT event is generated. If
     enabled, the IOS Command Builder generates the default IOS commands
     associated with the event.
   * If the Dial Plan Schema Group that is associated with the customer
     dial plan has the unassociateLboGateway custom workflow provisioned,
     the unassociateLboGateway custom workflow is executed.

.. note::

   When a SIP local gateway is disassociated from a site because the
   site is deleted, IOS commands are copied from the site to the customer
   level before the site is deleted. Use the Action search to go to the IOS **Commands** page to 
   view copied IOS commands. 
