forked from gildas/posh-ic
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Set-ICDnisMapping.ps1
39 lines (34 loc) · 1.07 KB
/
Set-ICDnisMapping.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<#
# AUTHOR : Paul McGurn
#>
function Set-ICDnisMapping() {
<#
.SYNOPSIS
Creates or updates a DNIS mapping
.DESCRIPTION
Creates or updates a DNIS mapping
.PARAMETER ICSession
The Interaction Center Session
.PARAMETER DNISTable
The DNIS table, with updated values, based on Get-ICDnisMappings
#>
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)] [Alias("Session", "Id")] [PSObject] $ICSession,
[Parameter(Mandatory = $true)] [Alias("RoutingTable")] $DNISTable
)
$body = @{
"routingTable" = @(
)
}
$body.routingTable = $DNISTable
$headers = @{
"Accept-Language" = $ICSession.language;
"ININ-ICWS-CSRF-Token" = $ICSession.token;
}
$json = ConvertTo-Json $body -Depth 10
Write-Verbose "Set DNIS Mappings payload:"
Write-Verbose "$($json)"
$response = Invoke-RestMethod -Uri "$($ICsession.baseURL)/$($ICSession.id)/configuration/dnis-mappings" -Body $json -Method PUT -Headers $headers -WebSession $ICSession.webSession -ErrorAction Stop
Return [PSCustomObject]$response
}