In a previous blog post we talked about using Asterisk’s uni-cast functionality as a bridge between the PSTN and an external service. This post entails a deeper look at how that could be implemented.
The model discussed today is based on the assumption that the running service is intended for a specific user and not for all participants in a call. Think more of a voice-based ai assistant rather than diarized call transcription. In this model we want the service to be available to the initial caller/callee but not to the other participants.
That model would look something like this:
This call model is essentially two calls, each with it’s own bridge. An audiohook off of the user channel links the two together. This has a number of practical advantages:
- Only the User’s voice will be sent to the service (if so configured.) This keeps other callers from hijacking control of the service and prevents us from having to use diarization to preclude input from other participants. It also generally leads to much better speech-to-text results as there is only one input stream to the service.
- We can control the bridges independently. This means we can mute or put “the call” on hold while still being connected to the external service, and vice versa. This can even be used to create a “smart transfer” where the other participants can remain in a call after the initial user leaves.
- Each bridge has it’s own setup and tear down. The user can detach from or attach to a user to user call while remaining connected to the service. The user could initially check voicemail, see that it was from another user and then make a call to them directly via voice control without having to hang up and place a second call.
- The snoop channel can use the audiohook to whisper directly to the user channel, so feedback from the external service could not be heard by other participants (again, based on configuration.)
Each participant in the call can potentially have it’s own attached service via audiohook. If Amy uses the service to call Ben, both of them can have their own attached service that they interact with independently. If they want to add Carl, he can be added to the call bridge with his own service as well. If they want to call someone externally that can also be added, with or without an attached service.
Are there disadvantages of building the services this way? Yes, but it’s more of a trade-off. If we were to bridge the external media channel directly into the call bridge we could avoid some complexity and overhead which may make a difference in the aggregate. If all we are looking to do is transcribe the call it would be simpler.
Hopefully this gives some insight in how to use the wide range of features in Asterisk to build your services!