At recent AstriDevCon meetings, we discussed the possibility of allowing an ARI application to capture or inject media into calls it controlled. With the release of Asterisk 16.6, that capability is now available. More information is available on the Asterisk Wiki External Media and ARI web page but let’s go over a simple scenario.
Let’s say your ARI application is managing a simple two-party call and you wish to send the audio off to a cloud speech recognition provider. Because of the large variation of providers and their interface requirements, interfacing with the cloud provider itself is beyond the scope of Asterisk but most of them have fairly simple requirements with plenty of examples. The hard part has been getting the media out of Asterisk in the first place. Now, with the External Media capability, you can use the
/channels/externalMedia REST interface, passing in parameters like destination host and port and format, to create a third channel you can add to any bridge. Once in the bridge, the new channel will stream any media passing through it to the destination host, and take any media from the destination host and inject it into the bridge. In this case, the destination host would be your “protocol converter” application that re-encapsulates the media to a format acceptable to the cloud provider. What you do with the text responses from the cloud provider is up to you. Maybe you email the transcription to the participants, or store it in a database for later retrieval and analysis, etc. With the first release of the capability, the media exchange with Asterisk must be RTP over UDP but more encapsulations are planned however like raw media over TLS or WebSockets.
Check out the External Media and ARI web page for more details and as always, feedback is welcomed.