jambonz / jambonz-api-server

jambones REST APIs
MIT License
8 stars 24 forks source link

createCall: add support for specifying speech settings #57

Closed davehorton closed 2 years ago

davehorton commented 2 years ago

Currently, in a createCall POST request if an application_sid is provided, we retrieve the speech credentials for that application (ie as configured via the portal). However, if no application_sid is provided (instead urls for call_hook and call_status_hook are provided) then we are simply defaulting to google and en-US for speech. Instead, the createCall API should allow the ability to specify settings for tts and stt.

planty commented 2 years ago

Hi @davehorton - we've just upgraded to 0.7.6 and the createCall api is now failing for us with this error:

{"level":30, "time": "2022-09-22T16:45:29.480Z","pid":958,"hostname":"ip-172-31-1-123","msg":"invalid client request","stack":"Error: either application_sid or set of speech_synthesis_vendor, speech_synthesis_language, speech_synthesis_voice, speech_recognizer_vendor, speech_recognizer_language required\n    at validateCreateCall (/home/admin/apps/jambonz-api-server/lib/routes/api/accounts.js:224:13)\n    at /home/admin/apps/jambonz-api-server/lib/routes/api/accounts.js:616:13\n    at runMicrotasks (<anonymous>)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)","type":"Error","v":1}

we're using the call hooks in the api, like so:

{
    call_hook: "<url>",
    call_status_hook: "<url>",
    from: "<number>",
    to: {
        type: "phone",
        number: "<number>"
    }
}

Looks like this is failing as a result of the changes here: https://github.com/jambonz/jambonz-api-server/pull/60

I can see the change listed in the changelog for 0.7.6 but it's obviously a breaking change so it would have been good if this was highlighted more clearly.

We have created a speech service which is used by "All accounts", so in this instance, it would be better if the createCall API would pick this account by default if the speech settings are not specified in the API request.

davehorton commented 2 years ago

yes you now need to provide these defaults.

davehorton commented 2 years ago

agree it was a breaking change, but it seemed necessary to fix this bug