jambonz / jambonz-webapp

A simple provisioning web app for jambonz
MIT License
5 stars 20 forks source link

Recent Calls page breaking using the Call Recording feature and Custom Speech Provider #314

Closed guilherme-rauen closed 10 months ago

guilherme-rauen commented 11 months ago

I experienced the Recent Calls page crashing after I used a Custom Speech Provider as the STT of my Application. Looking into the errors that logged, I found out that the issue was with the Call Recording Player that was breaking to render (player.tsx).

Looking a bit more, I think the issue is happening when trying to render the modal that pops up with the STT details when clicking the audio waves. And this is due to the absence of the data.vendor.name property in the STT object, which is expected to exist in the WebApp. Refer to: https://github.com/jambonz/jambonz-webapp/blob/main/src/containers/internal/views/recent-calls/player.tsx#L142

As a quick workaround I could do:

vendor: data?.vendor?.name,

or

vendor: data?.vendor?.name || "custom",

The first one simply don't show the STT name in the modal. And the second one ends up showing "custom" as the name. For now I went with the second option here.

But I think maybe a better approach would be making the fix on the feature-server, where the object used by the WebApp is created. Note that differently from the other providers, i.e.: Google: { vendor: { name: 'google' } }, the custom provider does not include this vendor object, therefore no name will be send, even though is required in the WebApp. Custom, refer to: https://github.com/jambonz/jambonz-feature-server/blob/78fd4549af016c9dabce2dc52d06f5dbe686865e/lib/utils/transcription-utils.js#L228 Google, refer to: https://github.com/jambonz/jambonz-feature-server/blob/78fd4549af016c9dabce2dc52d06f5dbe686865e/lib/utils/transcription-utils.js#L221-L222

Please let me know which approach would be better, fixing here in the WebApp passing a fallback text when vendor.name does not exist (or when it is a Custom Speech Provider) or in the FeatureServer where we can try to find out what is the Custom Speech Name to pass it or already add there in the object a default name when using Custom Speech Provider. I think I already have both approaches ready here to open a PR.

Thanks :)

xquanluu commented 10 months ago

Thanks @guilherme-rauen for relaly helpful details.

I have done this PR and tested with my server, It's working well.

If you can help to test this, it's more than great.

xquanluu commented 10 months ago

closing this as PR merged