arnonym / ha-plugins

Home-Assistant SIP Gateway
Apache License 2.0
157 stars 19 forks source link

add-on hanging if dtmf input is entered before message has finished playing #108

Open newpond opened 1 month ago

newpond commented 1 month ago

I am still having problems with the add-on hanging randomly when you press a key entry before the message has completed. unfortunately the "running" status does not change when this happens, however I have noticed that the cpu goes down to 0.3% when it hangs so I have automation to restart it through that. although sadly a restart doesn't necessarily fix it as can hang again on the first call after. changing from piper tts to a mp3 media file seams to make it a bit better but for some reason it still reprocesses the file before it plays it for some reason. im guesing ti could be to do with this file conversion, but if I'm using a static mp3 (although not through choice, it just seem to improve it a bit), can this not just be stored as the converted version? (im guessing it is via the cache) but im using this as an emergency alert system so it shouldn't go off very often by which time the cache will have expired. is there a way to ignore any key presses until after the message has been read?

I was using Vonage and now using Linphone sip if that makes any difference any help appreciated

arnonym commented 3 weeks ago

I've added the possibility to cache the converted audio. Please see the docs for details. Please report back if that's working for you.

newpond commented 3 weeks ago

Wow that’s freaky I pressed the install button on the update one second before your email came in!!!

I trust you had a good holiday!

I have this in my configuration.yaml tts: platform: wyoming cache: true cache_dir: /config/tts.piper time_memory: 3000 service_name: tts.piper base_url: http://192.168.1.43:8123 http://192.168.1.43:8123/

Is that not doing the same thing?

Also how long do the files stay in your new cache and do mp3 files get converted into another format first?

cheers

On 12 Jun 2024, at 12:52, Arne Gellhaus @.***> wrote:

I've added the possibility to cache the converted audio. Please see the docs for details. Please report back if that's working for you.

— Reply to this email directly, view it on GitHub https://github.com/arnonym/ha-plugins/issues/108#issuecomment-2162815304, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWEXOYVW2HGFE6UEXUKIHZLZHAZBVAVCNFSM6AAAAABIGHZMHSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRSHAYTKMZQGQ. You are receiving this because you authored the thread.

arnonym commented 3 weeks ago

the cache_dir is set in the config of ha-sip. It's independent of the tts configuration. You also need to set cache_audio: true on every message or audio_file you want to cache.

The MP3s and also WAV files are converted into a WAV file with a specific number of channels, sample frequency, etc to make them compatible with pjsip. And they will stay forever. So it's not exactly the same thing.

newpond commented 3 weeks ago

Great thanks Ill. give it a go!!

On 12 Jun 2024, at 13:20, Arne Gellhaus @.***> wrote:

the cache_dir is set in the config of ha-sip. It's independent of the tts configuration. You also need to set cache_audio: true on every message or audio_file you want to cache.

The MP3s and also WAV files are converted into a WAV file with a specific number of channels, sample frequency, etc to make them compatible with pjsip. And they will stay forever. So it's not exactly the same thing.

— Reply to this email directly, view it on GitHub https://github.com/arnonym/ha-plugins/issues/108#issuecomment-2162870248, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWEXOYQLIDFUR7EVXCKBJ43ZHA4KRAVCNFSM6AAAAABIGHZMHSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRSHA3TAMRUHA. You are receiving this because you authored the thread.

newpond commented 2 weeks ago

Sorry when you say this, " You also need to set cache_audio: true on every message or audio_file you want to cache.” Do you mean in the automaton script etc?

On 12 Jun 2024, at 13:20, Arne Gellhaus @.***> wrote:

You also need to set cache_audio: true on every message or audio_file you want to cache.

arnonym commented 2 weeks ago

Yes, for the play_message command see: https://github.com/arnonym/ha-plugins?tab=readme-ov-file#to-play-a-message-through-tts

or if you're using some kind of menu see: https://github.com/arnonym/ha-plugins?tab=readme-ov-file#call-menu-definition

look for cache_audio in the examples.

newpond commented 2 weeks ago

So… I notice you mention dynamic messages but couldn’t see anything in the GitHub relating to . What are they exactly?

Also with the settle_time: 1 , used to set time to wait for playing the message/actions/etc. after call was established, Could this be split into to 2 commands, 1 to settle the line, 2 waait for the message to play

As the s coudlbe a work around for the problem the s case is about. (By not letting people press a button before the message has finish)

Cheers

On 12 Jun 2024, at 13:20, Arne Gellhaus @.***> wrote:

You also need to set cache_audio: true on every message or audio_file you want to cache.

arnonym commented 2 weeks ago

With dynamic message I mean a message that is played via the play_message command and uses variable content in the data template (e.g. sensor data). As the message is cached by the content, this will create a cache file for every new value.

You're right about the "wait for message to play until keypresses are allowed". This is not implemented yet, I'll do that for the next release.

Is this release running stable, or do you still have hangs? If yes, could you describe in more detail when this is happening?

newpond commented 2 weeks ago

Ah ok understood.

When’s the next release?? :-)

The problem is I can never get it to fail when I want it to so I will just carry on trying.

So if I take the wav files stored in the cache, and use that as the audio file I call will it still re-encode?

On 13 Jun 2024, at 10:54, Arne Gellhaus @.***> wrote:

With dynamic message I mean a message that is played via the play_message command and uses variable content in the data template (e.g. sensor data). As the message is cached by the content, this will create a cache file for every new value.

You're right about the "wait for message to play until keypresses are allowed". This is not implemented yet, I'll do that for the next release.

Is this release running stable, or do you still have hangs? If yes, could you describe in more detail when this is happening?

— Reply to this email directly, view it on GitHub https://github.com/arnonym/ha-plugins/issues/108#issuecomment-2165174268, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWEXOYX7SFVHBST74QAKHG3ZHFT63AVCNFSM6AAAAABIGHZMHSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRVGE3TIMRWHA. You are receiving this because you authored the thread.

arnonym commented 2 weeks ago

Release: I'll do this in my free time, so the answer must be: when it's done.

Re-encode: yes, it will.

arnonym commented 2 weeks ago

Release: released :-)

newpond commented 2 weeks ago

excellent...you found some free time!! :-) Loading it now, will keep testing and see if the problem comes back.

cheers Arne

reds Jon