Microsoft Teams Emergency Calling Switzerland

Microsoft Teams Emergency Calling Switzerland

Hi All,

A few years ago, i’ve already covered Skype for Busines Location Information Service.

Now i have done some Testing with Microsoft Teams - Manage emergency calling in Switzerland. It is based on this Manual from Sunrise

Note from the Sunrise Manual: To make dynamic emergency call routing working, the correct “Housekey” is required for each of your location. The “Housekey” you can find in your Sunrise Business Portal, where you can manage your static emergency call routing (based on CallerID) or you search in the tables provided by Swiss Post Open Data Portal The “Housekey” is a unique identifier per building in Switzerland. This value must be added to your MS Teams Emergency Address in the attribute HNS (House Number Suffix).

So, in Switzerland you need to have a “Housekey” to configure Emergency Calling. That’s a unique Number associated to each Address in Switzerland maintained by the Swiss Post.

Examples:

  • Thurgauerstrasse 101B in 8152 Opfikon has “Housekey” 76516196
  • Zwingerstrasse 25, 4053 Basel has “Housekey” 40014653

It took me quite some time to Understand the Database and the API.

  • Table NEW_PLZ1:
    • you first need to search for the PLZ and get the ONRP ID
  • Table NEW_STR:
    • you then need to search for the StreetAdress (no House Number) and use the ONRP ID
  • Table NEW_GEB
    • you then search for the STR_ID and search for the HouseNumber (Nubmer only without A/B)
    • Example: Housenumber is “50B” you search for “50” and the Result will give a Selection with the HNR_A for each Building like “A”, “B”

Documentation

Here’s how you get the Hauskey.

Note it can give multiple results for PLZID, StreetID or Housekey

$CompanyName = "Icewolf"
$Streetname = "Robinsonweg"
$Housenumber = "50"
$City = "Bern"
$PLZ = "3006"

#PLZ
$URI = "https://swisspost.opendatasoft.com/api/records/1.0/search/?dataset=plz_verzeichnis_v2&q=&facet=postleitzahl&facet=plz_zz&facet=ortbez18&refine.postleitzahl=$PLZ"
$Result = Invoke-RestMethod -Method GET -Uri $URI
$PLZID  = $Result.records.fields.onrp
$PLZID

#Adresse ohne Hausnummer
$URI = "https://swisspost.opendatasoft.com/api/records/1.0/search/?dataset=strassenbezeichnungen_v2&q=$StreetName&facet=onrp&refine.onrp=$PLZID"
$Result = Invoke-RestMethod -Method GET -Uri $URI
$StreetID = $Result.records.Fields.strid
$StreetID

#Hauskey
$URI = "https://swisspost.opendatasoft.com/api/records/1.0/search/?dataset=hausnummer-und-hauskey_v2&q=&facet=hnr&facet=strid&refine.hnr=$Housenumber&refine.strid=$StreetID"
$Result = Invoke-RestMethod -Method GET -Uri $URI
$HausKey = $Result.records.Fields.hauskey
$HausKey

You can figure Out the Geo Cordinates of an Address with the Google Maps GeoCoding API

Note: You need to register and create your own API Key

$GoogleApiKey = "YourAPIKey"
$URLEncodedAddress = [System.Web.HttpUtility]::UrlEncode("$StreetName $HouseNumber $PLZ $City")
$URI = "https://maps.googleapis.com/maps/api/geocode/json?address=$URLEncodedAddress&key=$GoogleApiKey"
$Result = Invoke-RestMethod -Method GET -Uri $URI
$Result.results.Geometry.location
$Longitude = $Result.results.Geometry.location.lng
$Latitude = $Result.results.Geometry.location.lat

A simpler way is to search the Address in Google Maps and click on the Coordinates this will copy the Longitude and Latidude to the Clipboard.

Teams Emergency Address

Now you have all the Data to create a Teams Emergency Address with Powershell.

Sunrise expects you to store the “HausKey” in the HouseNumberSuffix Attribute. That can’t be managed with the GUI.

Swisscom expects the “HausKey” in the Company Attribute. This has the advantage, that it can be managed in the GUI.

#Create Emergency Address
Get-CsOnlineLisCivicAddress
Get-CsOnlineLisCivicAddress | ft StreetName, Housenumber, Housenumbersuffix, PostalCode, City, DefaultLocationID
New-CsOnlineLisCivicAddress -Description "BE HQ" -CountryOrRegion "CH" -PostalCode $PLZ -StreetName $StreetName -HouseNumber $Housenumber -City $City -HouseNumberSuffix $HausKey -CompanyName $CompanyName -Longitude $Longitude -Latitude $Latitude
New-CsOnlineLisCivicAddress -Description "ZH HQ" -CountryOrRegion "CH" -PostalCode $PLZ -StreetName $StreetName -HouseNumber $Housenumber -City $City -HouseNumberSuffix $HausKey -CompanyName $CompanyName -Longitude $Longitude -Latitude $Latitude

Let’s set the Public IP Address

#TrustedIP / PublicIP
New-CsTenantTrustedIPAddress -IPAddress "95.143.60.18" -MaskBits 32 -Description "Internet GW BE"

Set the Network Region

#Region
Get-CsTenantNetworkRegion
New-CsTenantNetworkRegion -NetworkRegionID "Switzerland"

Create Network Sites and Assign IP Ranges

#Network Sites
Get-CsTenantNetworkSite
$NetworkSiteBE = New-CsTenantNetworkSite -Identity "Bern" -NetworkRegionID "Switzerland"
$NetworkSiteZH = New-CsTenantNetworkSite -Identity "Zuerich" -NetworkRegionID "Switzerland"

#Subnets
Get-CsTenantNetworkSubnet
New-CsTenantNetworkSubnet -SubnetID "172.21.175.0" -MaskBits 24 -NetworkSiteID $NetworkSiteBE.Identity -Description "BE Subnet 1"
New-CsTenantNetworkSubnet -SubnetID "172.21.176.0" -MaskBits 24 -NetworkSiteID $NetworkSiteBE.Identity -Description "BE Subnet 2"
New-CsTenantNetworkSubnet -SubnetID "10.10.0.0" -MaskBits 16 -NetworkSiteID $NetworkSiteZH.Identity -Description "ZH Subnet 1"

Assign the Network Subnets to the Emergency Location

#Assign Network to Location
$LocationBE = Get-CsOnlineLisCivicAddress -City Bern
$LocationZH = Get-CsOnlineLisCivicAddress -City Opfikon

Get-CsOnlineLisSubnet
Set-CsOnlineLisSubnet -Subnet "172.21.175.0" -LocationId $LocationBE.DefaultLocationId -Description "BE Subnet 1"
Set-CsOnlineLisSubnet -Subnet "172.21.176.0" -LocationId $LocationBE.DefaultLocationId -Description "BE Subnet 2"
Set-CsOnlineLisSubnet -Subnet "10.10.0.0" -LocationId $LocationZH.DefaultLocationId -Description "ZH Subnet 1"

Add Emergency Numbers and assign it to the Emergency Call Routing Policy

#EmergencyNumbers
$EmergencyNumberList = 112, 117, 118, 143, 144, 147
$OnlinePSTNUsage = (Get-CsOnlinePstnUsage).Usage
$EmergencyNumbers = [System.Collections.Generic.List[object]]::new()
Foreach ($Number in $EmergencyNumberList)
{
	$EmergencyNumber = New-CsTeamsEmergencyNumber -EmergencyDialString $Number -OnlinePSTNUsage $OnlinePSTNUsage
	$EmergencyNumbers.Add($EmergencyNumber)
}
Set-CsTeamsEmergencyCallRoutingPolicy -Identity Global -EmergencyNumbers @{add=$EmergencyNumbers} -AllowEnhancedEmergencyServices $True

For WLAN you need the BSSID of your WLAN Accesspoint. It’s basically the MAC Address of the Accesspoint. You can figure out the SSID and MAC Addresses with this Command while not beeing connected to one of the WLAN’s.

netsh wlan show network mode=bssid

Add WLAN AccessPoint and assight in to a Emergency Location

#WLAN Add BSSID
$LocationBE = Get-CsOnlineLisCivicAddress -City Bern
Set-CsOnlineLisWirelessAccessPoint -BSSID 00-24-B2-D6-F1-09 -LocationId $LocationBE.DefaultLocationId -Description "WLAN ICEWOLF"
Set-CsOnlineLisWirelessAccessPoint -BSSID 10-0D-7F-9B-15-36 -LocationId $LocationBE.DefaultLocationId -Description "WLAN ICEWOLF_EXT"
Set-CsOnlineLisWirelessAccessPoint -BSSID 64-7C-34-92-0A-f3 -LocationId $LocationBE.DefaultLocationId -Description "WLAN ICEWOLF UPC"
Get-CsOnlineLisWirelessAccessPoint

Teams Client

It takes a while (can be multiple Hours) until the Emergency Locations are availabe in Teams Client. You will need to Sign-out and Sign-in again.

Check Team Client Settings under Calls

You will also see the Emergency Location in the Calling Tab

That’s how it looks if you call one of the Emergency Numbers

Summary

It took me quite a while to figure it all out. Hope this Blog Article helps you to set up Microsoft Teams Emergency Calling with Sunrise in Switzerland.

Regards
Andres Bohren

Teams Logo