From 829dbce72899743621ea4d6007b9eb4e5905c674 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Tue, 28 May 2024 13:35:17 -0500 Subject: [PATCH] Bandwidth calls from "Anonymous" are broken --- web.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/web.rb b/web.rb index c3ebae53ff5ee3f47c14fb1bd13c4e04a2824bb8..e8c3f75d1632f9416edb598790cf7b5afc454e45 100644 --- a/web.rb +++ b/web.rb @@ -235,6 +235,15 @@ class Web < Roda end end + def inbound_from + if params["from"] && params["from"] =~ /\A\+?\d+\Z/ + params["from"] + else + log.info "Inbound call with unusual from: #{params['from']}" + TEL_CANDIDATES.fetch(candidate, "19") + end + end + def hangup request.json { {}.to_json } @@ -397,7 +406,7 @@ class Web < Roda reach.filter(if_yes: ->(_) { hangup }) do create_call( customer, - params["from"], + inbound_from, params["callId"], params["applicationId"] ).then { |call|