Class: Twilio::Rails::Phone::Twiml::GreetingOperation

Inherits:
BaseOperation show all
Defined in:
app/operations/twilio/rails/phone/twiml/greeting_operation.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



9
10
11
12
13
14
15
16
17
# File 'app/operations/twilio/rails/phone/twiml/greeting_operation.rb', line 9

def execute
  if !phone_caller.valid_north_american_phone_number? && tree.config[:invalid_phone_number]
    Twilio::Rails::Phone::Twiml::InvalidPhoneNumberOperation.call(phone_call_id: phone_call.id, tree: tree)
  else
    after = tree.greeting
    after = Twilio::Rails::Phone::Tree::After.new(after.proc.call(phone_call.responses.build)) if after.proc
    Twilio::Rails::Phone::Twiml::AfterOperation.call(phone_call_id: phone_call.id, tree: tree, after: after)
  end
end