MayamaTakeshi / sip-lab

A node module that helps to write SIP functional tests
3 stars 2 forks source link

Add support for websocket server to start_speech_synth #79

Closed MayamaTakeshi closed 1 month ago

MayamaTakeshi commented 3 months ago

Sometimes we might need to interact with production system and speech synth from flite (English only) will not fit. So we could implement support for google tts, amazon polly etc but this would complicate development of the tool so instead of adding support for a multitude of TTS engines in sip-lab we could just establish a WebSocket connection to a Speech Server and that Speech Server would take care to talk with TTS engines. This would also avoid things like having to store credentials in the machine where sip-lab runs and the server can control usage limits etc. The function call would be like this:

sip.call.start_speech_synth(call_id, {
  text: 'hello world',
  server_url: 'ws://127.0.0.1/speech_synth',
  engine: 'gss',
  voice: 'en-US-Standard-A',
  language: 'en-US',
  times: 1, // number of times the text should be played
  media_id: 0, // optional
})
MayamaTakeshi commented 3 months ago

Check Issue 3239 from pjproject:

_Is pjproject plan to support websocket transport? Mybe we can firstly write the websocket library. I have written some code, maybe give some help. Here is my test code project: pjwebsock which is based on pjlib. The Code has been tested good as client and server on linux x8664 But the code is ugly, should continue develop: independent http layer (http encode/decode) transport layer should more general (not only for websocket) thread safe

I forked pjwebsock: https://github.com/MayamaTakeshi/pjwebsock