In my last post, I reviewed the recent changes (approved pull requests) to the Amazon Connect Streams API (Streams). In this post, I’m taking a look at the open pull requests, i.e., changes suggested by Amazon and community members. As of June 1, 2018, there are four open pull requests:
Each pull request (PR) is identified by a unique number. I’ll use the PR number as I discuss these suggested changes below.
Documentation Updates (PR #21 and #39)
Community members Franco Lazzarino (https://github.com/flazz) and yours truly (https://github.com/phmiller) have open PR’s to update some confusing documentation around the Streams methods contact.getState and contact.getStateDuration. These methods are aliased as contact.getStatus and contact.getStatusDuration in the api.js file. Per the discussion in PR #39, either method should work, so it might be best to leave the documentation as is until one or the other is deprecated.
Franco Lazzarino’s PR #39 is at: https://github.com/aws/amazon-connect-streams/pull/21. My PR #21 is at: https://github.com/aws/amazon-connect-streams/pull/21 and also includes a change to the documentation to clarify the “user friendly name” you get from the agent.getConfiguration().name is the agent’s first name. As this change is still relevant, I will either amend my PR to only include this change or close this PR and open a new one.
TypeScript Tooling Support (PR #41)
Andy Hopper (https://github.com/andyhopp) from Amazon has an open PR to add better tooling support for using TypeScript with Streams. This PR adds a TypeScript declaration file for Streams. This declaration file describes the public interface of the Streams API. Programming editors like Visual Studio Code can use the declaration file to light up type checking and IntelliSense, making developers more productive. While developing a Streams powered Angular application recently, my team used this file and it was quite helpful.
Andy Hopper’s PR #41 is at: https://github.com/aws/amazon-connect-streams/pull/41. I am hopeful it can be approved and improved over time as more developers use it and refine the definition file.
Learn the six most common pitfalls when upgrading your contact center, and how Amazon Connect can help you avoid them.
WebRTC Media Info (PR #64)
Community member karthikbr82 (https://github.com/karthikbr82) has an open PR to surface real-time media data for every call from Streams. This data can then be analyzed and monitored by services such as callstats.io (https://www.callstats.io/).
Karthikbr82’s PR #64 is at: https://github.com/aws/amazon-connect-streams/pull/64.
Code Changes for PR #64
This PR is of particular interest to me, as in my post about implementing a mute button (https://blogs.perficient.com/2017/10/26/implementing-a-mute-button-in-amazon-connect/) I also made changes to Streams to get to the underlying real-time media.
I went into the SoftphoneManager class and saved the RTCSession object for the call as a property of the call (contact). The RTCSession object wraps a WebRTC RTCPeerConnection, providing access to real-time media to implement mute in application code.
PR #64 is more elegant than my hackery, as it adds a session event that is fired when a call is accepted. This event contains the RTCSession object for the call. The code to fire the session event is also in the SoftphoneManager class as shown below.
Application code can subscribe to this event by using the new contact.OnSession method.
I’m curious to see if this PR gets approved as it relies on some of the internal implementation details of Streams and Amazon Connect. I’m not sure if Amazon wants the RTCSession being used directly by integrating applications. On the other hand, this PR opens the door for partners, vendors, and community members to implement great features like real-time monitoring.
Thanks for reading. If you like these reviews of pull requests, let me know! Any questions, comments or corrections are greatly appreciated. To learn more about what we can do with Amazon Connect, check out Helping You Get the Most Out of Amazon Connect