From 653ad29db2b6155d6c438294b5782549da499e28 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Tue, 18 Jan 2022 12:39:13 -0500 Subject: [PATCH] Do not deliver transcription if voicemail is less than 5 seconds Will suppress bogus messages transcribed from silence or a click, and in general getting a transciption without getting a recording is just odd. If we decided the recording is not worth sending, the transcript certainly isn't. --- web.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web.rb b/web.rb index 5da7aa5943d78f5057ce3e52069b46a2916ac696..2681a3b5817f115426022e089f7cbf914933abec 100644 --- a/web.rb +++ b/web.rb @@ -200,6 +200,10 @@ class Web < Roda end r.post "transcription" do + duration = Time.parse(params["endTime"]) - + Time.parse(params["startTime"]) + next "OK<5" unless duration > 5 + CustomerRepo.new.find_by_tel(params["to"]).then do |customer| m = Blather::Stanza::Message.new m.chat_state = nil