Merge branch 'feat/voice-as-twilio-capability' into feat/voice-call-model-twilio

This commit is contained in:
Muhsin Keloth
2026-04-14 15:30:06 +04:00
committed by GitHub
2 changed files with 5 additions and 2 deletions
@@ -4,8 +4,6 @@ class Twilio::VoiceTeardownService
def perform
delete_twiml_app if channel.twiml_app_sid.present?
clear_number_webhooks
rescue StandardError => e
Rails.logger.error("TWILIO_VOICE_TEARDOWN_ERROR: #{e.class} #{e.message} phone=#{channel.phone_number} account=#{channel.account_id}")
ensure
clear_voice_credentials
end
@@ -14,6 +12,8 @@ class Twilio::VoiceTeardownService
def delete_twiml_app
twilio_client.applications(channel.twiml_app_sid).delete
rescue StandardError => e
Rails.logger.error("TWILIO_VOICE_TEARDOWN_ERROR: #{e.class} #{e.message} phone=#{channel.phone_number} account=#{channel.account_id}")
end
def clear_number_webhooks
@@ -69,11 +69,14 @@ RSpec.describe Channel::TwilioSms do
let(:channel) { create(:channel_twilio_sms, :with_voice, account: account) }
let(:app_context) { instance_double(Twilio::REST::Api::V2010::AccountContext::ApplicationContext) }
let(:twilio_client) { instance_double(Twilio::REST::Client) }
let(:numbers_list) { instance_double(Twilio::REST::Api::V2010::AccountContext::IncomingPhoneNumberList) }
before do
allow(Twilio::REST::Client).to receive(:new).and_return(twilio_client)
allow(twilio_client).to receive(:applications).with(channel.twiml_app_sid).and_return(app_context)
allow(app_context).to receive(:delete)
allow(twilio_client).to receive(:incoming_phone_numbers).and_return(numbers_list)
allow(numbers_list).to receive(:list).with(phone_number: channel.phone_number).and_return([])
end
it 'deletes the TwiML app and clears twiml_app_sid' do