I'm setting up call monitoring using Python and the RingCentral API.
As specified in the API documentation, I need the supervisors device ID, agents extension, and the telephony session ID to do this.
The supervisors device ID looked up using the following endpoint:
f'/restapi/v1.0/account/~/extension/{supervisor_extension_id}/device'
The supervisor is using a softphone and is registered as "Can Monitor" in the call monitoring group. I can successfully pull this ID.
The extensionNumber is the three digit extension number of the person I'm looking to monitor. They are added as "Can be monitored" to the same call monitoring group as the supervisor above. The extension number lookup is done by using the extensionId. I can successfully look up the extension ID.
f'/restapi/v1.0/account/~/extension/{ext_id}/phone-number')
Websockets are operating correctly. I can subscribe and act on telephony events in real-time. I'm pulling the telephony sessionId using websockets. The URL to initiate the supervise call is:
url = (f'/restapi/v1.0/account/~/telephony/sessions/{telephony_session_id}/supervise')
The final API call to start call monitoring is:
data = {'mode': 'Listen', 'deviceId': '############', 'extensionNumber': '###'}
url = (f'/restapi/v1.0/account/~/telephony/sessions/{telephony_session_id}/supervise')
response = platform_monitoring.post(url, data)
Where,
deviceId = 12-digit device ID of the softphone of the supervisor.
extensionNumber = 3-digit extension number of person to monitor
telephony_session_id = ID of the phone call (s-a0e7a....)
The response back is: ringcentral.http.api_exception.ApiException: HTTP409