Bandwidth calls from "Anonymous" are broken

Stephen Paul Weber created

Change summary

web.rb | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

Detailed changes

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|