日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Teams数据统计 - 通话记录

發布時間:2023/12/9 编程问答 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Teams数据统计 - 通话记录 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

上篇文章介紹了如何獲取用戶的在線狀態,這篇文章我們記錄介紹如何統計用戶通話記錄。

首先,Teams為了安全,它要求 app 要有?CallRecords.Read.All?權限。然后就可以通過這個api來獲取 call record。

GET /communications/callRecords/{id}

這個接口會返回類似如下的數據:

{"@odata.context": "https://graph.microsoft.com/beta/$metadata#communications/callRecords/$entity","version": 1,"type": "groupCall","modalities": ["audio"],"lastModifiedDateTime": "2020-12-25T19:00:24.582757Z","startDateTime": "2020-12-25T18:52:21.321Z","endDateTime": "2020-12-25T19:52:46.123Z","id": "e523d2ed-1111-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"}},...] }

可以看到,我們能通過?organizer?和?participants?來找到參與這個通過的參與人,我們可以記錄下用戶的 user id,同時我們還可以通過?startDateTime?和?endDateTime?來取得這次 call 的開始和結束時間。

實際上 Teams 里的 call record 比我們想象的復雜很多,一個call里可能有多個 session 組成,我們用一張官方的數據模型圖看一下。

?

我們可以給上面這個 api 加上參數來獲取 session。

GET https://graph.microsoft.com/beta/communications/callRecords/{id}?$expand=sessions {"@odata.context": "https://graph.microsoft.com/beta/$metadata#communications/callRecords(sessions(segments()))/$entity","startDateTime": "2020-02-25T18:52:21.2169889Z","endDateTime": "2020-02-25T18:52:46.7640013Z","organizer": { ... },"participants": [ ... ],"sessions": [{"modalities": ["audio"],"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","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","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}}}}] }

從上面返回的json可以看到,session里有?startDateTime?和?endDateTime。還有?caller?和?callee,我們用這些數據來進行進一步的深入統計,而且可以看到里面還有每個用戶參與這個通話是使用的設備(userAgent.platform),更有意思的是,這里面還有?feedback,里面有這個用戶這次通話中音質是好還是差,有沒有噪音等等。有了這些信息,相信大家腦海里已經有了大量的可以統計的點了。

各位看到這里,可能會問,上面的接口是獲取某一次 call record 的,那我如何獲取所有的記錄呢?

這里就需要用到 graph api 的訂閱功能。

POST https://graph.microsoft.com/beta/subscriptions {"changeType": "created","notificationUrl": "https://<<your api url>>","resource": "/communications/callRecords","expirationDateTime":"2016-11-20T18:23:45.9356913Z","clientState": "secretClientValue","latestSupportedTlsVersion": "v1_2" }

上面的?resource?是?/communications/callRecords,表明如果有任何一個call發生,graph api會回調我們的接口。上面的?"notificationUrl": "https://<<your api url>>"?是你的服務的回調 url,我們可以在這個接口里得到相應的 call record id,并且記錄下來,等一段時間call 結束后,就可以獲取整個call的信息了。

?

總結

以上是生活随笔為你收集整理的Teams数据统计 - 通话记录的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。