~singpolyma/sgx-jmp

653ad29db2b6155d6c438294b5782549da499e28 — Stephen Paul Weber 3 months ago 2f58ccc
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.
1 files changed, 4 insertions(+), 0 deletions(-)

M web.rb
M web.rb => web.rb +4 -0
@@ 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