microsoftgraph / msgraph-sdk-java

Microsoft Graph SDK for Java
https://docs.microsoft.com/en-us/graph/sdks/sdks-overview
MIT License
373 stars 125 forks source link

sessionCollectionPage.getNextPage() always coming as null in CallRecord object even if the Get Call Record API returns sessions data with sessions@odata.nextLink #1746

Closed priya2395 closed 7 months ago

priya2395 commented 8 months ago

Expected behavior

sessionCollectionPage.getNextPage() should return the builder with nextPage Link

Actual behavior

sessionCollectionPage.getNextPage() coming as null

Steps to reproduce the behavior

Call below snippet for a callrecord with sessions data with sessions@odata.nextLink:

final CallRecord callRecord = graphServiceClient.communications() .callRecords(callRecordId) .buildRequest() .expand(EXPAND_SESSIONS_AND_SEGMENTS) .get();

priya2395 commented 8 months ago

@ramsessanchez

Did you get a chance to check this?

priya2395 commented 8 months ago

@baywet @ramsessanchez Did you get a chance to replicate this ?

ramsessanchez commented 8 months ago

Hi @priya2395 , would you mind sharing a larger code snippet as well as the error stack that you are running into? Also, if you could share the raw json of the response you are receiving, make sure to remove any sensitive info. At the moment I am unable to replicate the issue.

priya2395 commented 8 months ago

I am using below call to get callRecord and get nextPage for sessions from it. final CompletableFuture callRecordCompletableFuture = graphServiceClient.communications() .callRecords(callRecordId) .buildRequest() .expand(EXPAND_SESSIONS_AND_SEGMENTS) .getAsync(); final SessionCollectionPage sessionCollectionPage = callRecord.sessions; final List sessions = sessionCollectionPage.getCurrentPage(); // Get the next page final SessionCollectionRequestBuilder nextPage = sessionCollectionPage.getNextPage();

I have used wiremock to mock the response of the Get Call Record API and have provided the sample response from MS documentation as below:


Content-type: application/json

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#communications/callRecords(sessions(segments()))/$entity",
    "version": 1,
    "type": "peerToPeer",
    "modalities": [
        "audio"
    ],
    "lastModifiedDateTime": "2020-02-25T19:00:24.582757Z",
    "startDateTime": "2020-02-25T18:52:21.2169889Z",
    "endDateTime": "2020-02-25T18:52:46.7640013Z",
    "id": "e523d2ed-2966-4b6b-925b-754a88034cc5",
    "organizer": {
        "user": {
            "id": "821809f5-0000-0000-0000-3b5136c0e777",
            "displayName": "Abbie Wilkins",
            "tenantId": "dc368399-474c-4d40-900c-6265431fd81f"
        }
    },
    "participants": [
        {
            "user": {
                "id": "821809f5-0000-0000-0000-3b5136c0e777",
                "displayName": "Abbie Wilkins",
                "tenantId": "dc368399-474c-4d40-900c-6265431fd81f"
            }
        },
        {
            "user": {
                "id": "f69e2c00-0000-0000-0000-185e5f5f5d8a",
                "displayName": "Owen Franklin",
                "tenantId": "dc368399-474c-4d40-900c-6265431fd81f"
            }
        }
    ],
    "sessions": [
        {
            "modalities": [
                "audio"
            ],
            "startDateTime": "2020-02-25T18:52:21.2169889Z",
            "endDateTime": "2020-02-25T18:52:46.7640013Z",
            "id": "e523d2ed-2966-4b6b-925b-754a88034cc5",
            "isTest": false,
            "caller": {
                "@odata.type": "#microsoft.graph.callRecords.participantEndpoint",
                "name": "machineName_2",
                "cpuName": "Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz",
                "cpuCoresCount": 2,
                "cpuProcessorSpeedInMhz": 2594,
                "userAgent": {
                    "@odata.type": "#microsoft.graph.callRecords.clientUserAgent",
                    "headerValue": "RTCC/7.0.0.0 UCWA/7.0.0.0 AndroidLync/6.25.0.27 (SM-G930U Android 8.0.0)",
                    "platform": "android",
                    "productFamily": "skypeForBusiness"
                },
                "identity": {
                    "@odata.type": "#microsoft.graph.identitySet",
                    "user": {
                        "id": "821809f5-0000-0000-0000-3b5136c0e777",
                        "displayName": "Abbie Wilkins",
                        "tenantId": "dc368399-474c-4d40-900c-6265431fd81f"
                    }
                }
            },
            "callee": {
                "@odata.type": "#microsoft.graph.callRecords.participantEndpoint",
                "name": "machineName_4",
                "cpuName": "Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz",
                "cpuCoresCount": 8,
                "cpuProcessorSpeedInMhz": 2295,
                "userAgent": {
                    "@odata.type": "#microsoft.graph.callRecords.clientUserAgent",
                    "headerValue": "UCCAPI/16.0.12527.20122 OC/16.0.12527.20194 (Skype for Business)",
                    "platform": "windows",
                    "productFamily": "skypeForBusiness"
                },
                "identity": {
                    "user": {
                        "id": "f69e2c00-0000-0000-0000-185e5f5f5d8a",
                        "displayName": "Owen Franklin",
                        "tenantId": "dc368399-474c-4d40-900c-6265431fd81f"
                    }
                },
                "feedback": {
                    "rating": "poor",
                    "tokens": {
                        "NoSound": false,
                        "OtherNoSound": false,
                        "Echo": false,
                        "Noisy": true,
                        "LowVolume": false,
                        "Stopped": false,
                        "DistortedSound": false,
                        "Interruptions": false
                    }
                }
            },
            "segments": [
                {
                    "startDateTime": "2020-02-25T18:52:21.2169889Z",
                    "endDateTime": "2020-02-25T18:52:46.7640013Z",
                    "id": "e523d2ed-2966-4b6b-925b-754a88034cc5",
                    "caller": {
                        "@odata.type": "#microsoft.graph.callRecords.participantEndpoint",
                        "name": "machineName_4",
                        "cpuName": "Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz",
                        "cpuCoresCount": 8,
                        "cpuProcessorSpeedInMhz": 2295,
                        "userAgent": {
                            "@odata.type": "#microsoft.graph.callRecords.clientUserAgent",
                            "headerValue": "RTCC/7.0.0.0 UCWA/7.0.0.0 AndroidLync/6.25.0.27 (SM-G930U Android 8.0.0)",
                            "platform": "android",
                            "productFamily": "skypeForBusiness"
                        },
                        "identity": {
                            "user": {
                                "id": "821809f5-0000-0000-0000-3b5136c0e777",
                                "displayName": "Abbie Wilkins",
                                "tenantId": "dc368399-474c-4d40-900c-6265431fd81f"
                            }
                        }
                    },
                    "callee": {
                        "@odata.type": "#microsoft.graph.callRecords.participantEndpoint",
                        "name": "machineName_6",
                        "cpuName": "Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz",
                        "cpuCoresCount": 8,
                        "cpuProcessorSpeedInMhz": 2295,
                        "userAgent": {
                            "@odata.type": "#microsoft.graph.callRecords.clientUserAgent",
                            "headerValue": "UCCAPI/16.0.12527.20122 OC/16.0.12527.20194 (Skype for Business)",
                            "platform": "windows",
                            "productFamily": "skypeForBusiness"
                        },
                        "identity": {
                            "user": {
                                "id": "f69e2c00-0000-0000-0000-185e5f5f5d8a",
                                "displayName": "Owen Franklin",
                                "tenantId": "dc368399-474c-4d40-900c-6265431fd81f"
                            }
                        }
                    },
                    "media": [
                        {
                            "label": "main-audio",
                            "callerNetwork": {
                                "ipAddress": "10.150.0.2",
                                "subnet": "10.150.0.0",
                                "linkSpeed": 54000000,
                                "connectionType": "wifi",
                                "port": 27288,
                                "reflexiveIPAddress": "127.0.0.2",
                                "relayIPAddress": "52.114.188.32",
                                "relayPort": 53889,
                                "macAddress": "00-00-00-00-00-00",
                                "dnsSuffix": null,
                                "sentQualityEventRatio": 0,
                                "receivedQualityEventRatio": 0.27,
                                "delayEventRatio": 0,
                                "bandwidthLowEventRatio": 0
                            },
                            "calleeNetwork": {
                                "ipAddress": "10.139.0.12",
                                "subnet": "10.139.80.0",
                                "linkSpeed": 4294967295,
                                "connectionType": "wired",
                                "port": 50011,
                                "reflexiveIPAddress": "127.0.0.2",
                                "relayIPAddress": "52.114.188.102",
                                "relayPort": 52810,
                                "macAddress": "00-00-00-00-00-00-00-00",
                                "dnsSuffix": null,
                                "sentQualityEventRatio": 0.31,
                                "receivedQualityEventRatio": 0,
                                "delayEventRatio": 0,
                                "bandwidthLowEventRatio": 0
                            },
                            "callerDevice": {
                                "captureDeviceName": "Default input device",
                                "renderDeviceName": "Default output device",
                                "receivedSignalLevel": -10,
                                "receivedNoiseLevel": -68,
                                "initialSignalLevelRootMeanSquare": 60.25816,
                                "renderZeroVolumeEventRatio": 1,
                                "renderMuteEventRatio": 1,
                                "micGlitchRate": 23,
                                "speakerGlitchRate": 3830
                            },
                            "calleeDevice": {
                                "captureDeviceName": "Microphone (Microsoft Virtual Audio Device (Simple) (WDM))",
                                "captureDeviceDriver": "Microsoft: 5.0.8638.1100",
                                "renderDeviceName": "Speakers (Microsoft Virtual Audio Device (Simple) (WDM))",
                                "renderDeviceDriver": "Microsoft: 5.0.8638.1100",
                                "receivedSignalLevel": -14,
                                "receivedNoiseLevel": -86,
                                "initialSignalLevelRootMeanSquare": 146.7885,
                                "micGlitchRate": 143,
                                "speakerGlitchRate": 182
                            },
                            "streams": [
                                {
                                    "streamId": "1504545584",
                                    "streamDirection": "callerToCallee",
                                    "averageAudioDegradation": null,
                                    "averageJitter": "PT0.016S",
                                    "maxJitter": "PT0.021S",
                                    "averagePacketLossRate": 0,
                                    "maxPacketLossRate": 0,
                                    "averageRatioOfConcealedSamples": null,
                                    "maxRatioOfConcealedSamples": null,
                                    "averageRoundTripTime": "PT0.061S",
                                    "maxRoundTripTime": "PT0.079S",
                                    "packetUtilization": 67,
                                    "averageBandwidthEstimate": 9965083,
                                    "wasMediaBypassed": false,
                                    "averageAudioNetworkJitter": "PT0.043S",
                                    "maxAudioNetworkJitter": "PT0.046S",
                                    "rmsFreezeDuration": null,
                                    "averageFreezeDuration": null,
                                    "isAudioForwardErrorCorrectionUsed": false
                                },
                                {
                                    "streamId": "1785122252",
                                    "streamDirection": "calleeToCaller",
                                    "averageAudioDegradation": 1.160898,
                                    "averageJitter": "PT0.007S",
                                    "maxJitter": "PT0.012S",
                                    "averagePacketLossRate": 0.01381693,
                                    "maxPacketLossRate": 0.03738318,
                                    "averageRatioOfConcealedSamples": 0.06233422,
                                    "maxRatioOfConcealedSamples": 0.07192807,
                                    "averageRoundTripTime": "PT0.064S",
                                    "maxRoundTripTime": "PT0.106S",
                                    "packetUtilization": 709,
                                    "averageBandwidthEstimate": 15644878,
                                    "wasMediaBypassed": false,
                                    "averageAudioNetworkJitter": "PT0.266S",
                                    "maxAudioNetworkJitter": "PT0.474S",
                                    "rmsFreezeDuration": null,
                                    "averageFreezeDuration": null,
                                    "isAudioForwardErrorCorrectionUsed": null
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ],
    "sessions@odata.nextLink": "https://graph.microsoft.com/v1.0/$metadata#communications/callRecords('e523d2ed-2966-4b6b-925b-754a88034cc5')/sessions?$expand=segments&$skiptoken=abc"
}```

I am getting all details correct in callRecord Object returned by graphClient. The SessionCollectionPage is having correct list of sessions for current Page. However, the nextPage is always coming as null in the callRecord Object returned by graph client.
priya2395 commented 8 months ago

@ramsessanchez I have used sample response from MS documentation in wiremock: https://learn.microsoft.com/en-us/graph/api/callrecords-callrecord-get?view=graph-rest-1.0&tabs=http

Is there anything missing in the sample response due to which nextPage might be coming as null ?

priya2395 commented 8 months ago

@ramsessanchez Can you please share a valid sample paginated response for the callRecord API which I can use as mock response ?

baywet commented 7 months ago

Sorry for the late reply, we've been working hard to release a new major version of the SDK Since this is an issue with the older version, we'll be closing it for now. Please go ahead and try with this new version, if you're still facing issues, feel free to open a new issue.

priya2395 commented 7 months ago

@baywet Do we need to make a separate call for getting paginated list of sesssions in a call record. Can't see any way to get it from callRecord response.

com.microsoft.graph.models.callrecords.CallRecord result = graphClient.communications().callRecords().byCallRecordId("{callRecord-id}").get();  -- to get call record basic data

com.microsoft.graph.models.callrecords.SessionCollectionResponse result = graphClient.communications().callRecords().byCallRecordId("{callRecord-id}").sessions().get(requestConfiguration -> {
    requestConfiguration.queryParameters.expand = new String []{"segments"};
});  // to get sessions data

Or can we get it using below call?

com.microsoft.graph.models.callrecords.CallRecord result = graphClient.communications().callRecords().byCallRecordId("{callRecord-id}").get(requestConfiguration -> {
    requestConfiguration.queryParameters.expand = new String []{"sessions($expand=segments)"};
});

I can see the nextPageLink for sessions coming in additionalDataManager in callRecord response.

baywet commented 7 months ago

Thanks for the additional information. I'm not clear on what you're trying to achieve here? Are you trying to list out all the sessions for a call record? Or are you trying to list out all the segments for a call record (which means listing out all the sessions) ?

baywet commented 7 months ago

(please follow up on the other issue since you've opened a new one)