Skip to content

Commit

Permalink
added function for last user reg report. written by Brian Swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
gclark01 committed Sep 11, 2018
1 parent eafb4d6 commit 64d1682
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Modules/sessiondata.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function Get-QoEReport {
$AppShareRecords = Get-AppShareRecords -sessions $sessions -sipAddress $userHash.SipAddress.Split(":")[1]
$RMCRecords = Get-RMC -sessions $sessions -sipAddress $userHash.SipAddress.Split(":")[1]
$IMFEDRecords = Get-IMFederatedDomains -sessions $sessions -sipAddress $userHash.SipAddress.Split(":")[1]
$UserRegistration = Get-LastUserRegistration -sessions $sessions -sipAddress $userHash.SipAddress.Split(":")[1]

# Write out reports
if ($AudioRecords) {
Expand Down Expand Up @@ -47,6 +48,10 @@ function Get-QoEReport {
if ($IMFEDRecords) {
$IMFEDRecords | Export-Csv -Path $Global:IMFEDReports -NoTypeInformation -Append
}

if ($UserRegistration) {
$UserRegistration | Export-Csv -Path $Global:UserRegReports -NoTypeInformation -Append
}

}

Expand Down Expand Up @@ -1013,6 +1018,35 @@ function Get-RMC {

}

#This functions grabs the last user registration based on distinct FromUri and FromClientVersion Combination.
# Function written by Brian Swagger
function Get-LastUserRegistration {
[cmdletbinding()]
param (
[object]$sessions,
[string]$sipAddress
)

$sessions = $sessions | where {$_.MediaTypesDescription -eq "[RegisterEvent]" -and $_.FromClientVersion -ne ""} | Select FromUri,FromClientVersion,StartTime

#$sessions = $sessions | Where-Object {$_.FromClientVersion -ne ""}
$sessions | ForEach-Object {


[array]$Events += [PSCustomObject][ordered]@{
#SipAddress = $sipAddress
StartTime = $_.StartTime
CallerUri = $_.FromUri
FromClientVersion = $_.FromClientVersion

}
#}
}

$FinalEvents = $Events | Group-Object FromUri,FromClientVersion | Foreach-Object {$_.Group | Sort-Object StartTime | Select-Object -Last 1}
return $FinalEvents

}
function sessionmgmt {
param(
[string]$SipAddress,
Expand Down
3 changes: 3 additions & 0 deletions get-userstreams.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ $Global:RMCFileName = "rmc-records.csv"
$Global:RMCReports = $ReportPath + "\" + $Global:RMCFileName
$Global:IMFEDFileName = "imfed-records.csv"
$Global:IMFEDReports = $ReportPath + "\" + $Global:IMFEDFileName
$Global:UserRegFileName = "lastreg-records.csv"
$Global:UserRegReports = $Reportpath + "\" + $Global:UserRegFileName

$Global:LogPath = $env:TEMP + "\" + "Logs" + "\" + $Date

Expand Down Expand Up @@ -82,6 +84,7 @@ New-Item -Path $ReportPath -Name $Global:VideoFileName -ItemType File | Out-Null
New-Item -Path $ReportPath -Name $Global:AppShareFileName -ItemType File | Out-Null
New-Item -Path $ReportPath -Name $Global:RMCFileName -ItemType File | Out-Null
New-Item -Path $ReportPath -Name $Global:IMFEDFileName -ItemType File | Out-Null
New-Item -Path $ReportPath -Name $Global:UserRegFileName -ItemType File | Out-Null


<#
Expand Down

0 comments on commit 64d1682

Please sign in to comment.