Do not deliver transcription if voicemail is less than 5 seconds

Stephen Paul Weber created

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.

Change summary

web.rb | 4 ++++
1 file changed, 4 insertions(+)

Detailed changes

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