aws / connect-rtc-js

Provide softphone support to AmazonConnect customers when they choose to directly integrate with our API and not using our web app.
Apache License 2.0
80 stars 63 forks source link

Add close method to peer connection factory #113

Closed gitanjam closed 4 months ago

gitanjam commented 5 months ago

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Testing: Setup CCP locally. Verified that using chrome://webrtc-internals that idle peer connection is spun up every minute and existing open one gets cleaned up.

Then invoked connect.core.softphoneManager.rtcPeerConnectionFactory.close() via browser console and verified that instead of refreshing idle peer connection, open one is closed and then no idle peer connection is spun up next minute.

connect.core.softphoneManager.rtcPeerConnectionFactory.close()
connect-streams-min.js:1 [2024-06-11T21:24:16.710Z] [LOG] [2a3eb537-57d5-412e-895b-86eff33cc2bf]:  close method invoked. Clear timer and close idle peer connection 1718139646463-j8beuivgtbg

Regression testing notes are here: https://quip-amazon.com/pYToAkumdjgq/RtcJs-ACGR-Testing. I will be working to prioritize automated testing as well as unit test coverage improvements for this repo.

Additional verification will be done via softphone manager where this will eventually be used. Those softphone manager changes are work in progress by another developer.

gitanjam commented 4 months ago

I pulled #114 in and tried to cherry-pick my changes on top, there's probably a better way to do that.