M lib/call_attempt.rb => lib/call_attempt.rb +32 -0
@@ 66,6 66,38 @@ class CallAttempt
as_json.to_json(*args)
end
+ class Expired
+ CallAttempt.register do |customer:, direction:, **|
+ new(direction: direction) if customer.plan_name && !customer.active?
+ end
+
+ value_semantics do
+ direction Either(:inbound, :outbound)
+ end
+
+ def view
+ "#{direction}/expired"
+ end
+
+ def tts
+ TTSTemplate.new(view).tts(self)
+ end
+
+ def to_render
+ [view]
+ end
+
+ def create_call(*); end
+
+ def as_json(*)
+ { tts: tts }
+ end
+
+ def to_json(*args)
+ as_json.to_json(*args)
+ end
+ end
+
class Unsupported
CallAttempt.register do |supported:, direction:, **|
new(direction: direction) unless supported
A views/inbound/expired.slim => views/inbound/expired.slim +3 -0
@@ 0,0 1,3 @@
+doctype xml
+Response
+ Hangup /
A views/outbound/expired.slim => views/outbound/expired.slim +3 -0
@@ 0,0 1,3 @@
+doctype xml
+Response
+ SpeakSentence Your account is expired, please top up soon to keep your number.