From 8d5d02ea972bbaa6d2e7bc445a8b902f94953e8c Mon Sep 17 00:00:00 2001 From: Tanmay Deep Sharma <32020192+tds-1@users.noreply.github.com> Date: Thu, 11 Jun 2026 14:22:44 +0530 Subject: [PATCH] feat: add per-inbox toggle to disable incoming calls (#14645) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Adds a per-inbox "Allow incoming calls" toggle for voice-enabled WhatsApp and Twilio inboxes. When turned off, the setting is persisted on the channel; actually rejecting inbound calls is handled in a follow-up PR. ## Type of change - [ ] New feature (non-breaking change which adds functionality) ## Screenshot Screenshot 2026-06-04 at 11 44 07 AM ## Checklist: - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules --- app/javascript/dashboard/api/inboxes.js | 6 +++ .../dashboard/i18n/locale/en/inboxMgmt.json | 4 ++ .../settingsPage/VoiceConfigurationPage.vue | 42 +++++++++++++++ .../settingsPage/WhatsappCallingPage.vue | 41 ++++++++++++++ app/models/channel/twilio_sms.rb | 6 +++ app/models/channel/whatsapp.rb | 5 ++ app/policies/inbox_policy.rb | 4 ++ app/views/api/v1/models/_inbox.json.jbuilder | 6 ++- config/routes.rb | 1 + ...d_provider_config_to_channel_twilio_sms.rb | 5 ++ db/schema.rb | 3 +- .../api/v1/accounts/inboxes_controller.rb | 28 ++++++++++ .../controllers/twilio/voice_controller.rb | 12 +++++ .../whatsapp/incoming_call_service.rb | 6 +++ .../v1/accounts/inboxes_controller_spec.rb | 53 +++++++++++++++++++ .../twilio/voice_controller_spec.rb | 17 ++++++ .../models/channel/twilio_sms_voice_spec.rb | 13 +++++ .../whatsapp/incoming_call_service_spec.rb | 14 +++++ spec/models/channel/whatsapp_spec.rb | 18 +++++++ 19 files changed, 282 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20260604000000_add_provider_config_to_channel_twilio_sms.rb diff --git a/app/javascript/dashboard/api/inboxes.js b/app/javascript/dashboard/api/inboxes.js index 114dbb6f4..3c1d17fc8 100644 --- a/app/javascript/dashboard/api/inboxes.js +++ b/app/javascript/dashboard/api/inboxes.js @@ -60,6 +60,12 @@ class Inboxes extends CacheEnabledApiClient { disableWhatsappCalling(inboxId) { return axios.post(`${this.url}/${inboxId}/disable_whatsapp_calling`); } + + setInboundCalls(inboxId, enabled) { + return axios.post(`${this.url}/${inboxId}/set_inbound_calls`, { + inbound_calls_enabled: enabled, + }); + } } export default new Inboxes(); diff --git a/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json b/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json index cd7e46330..574cf5b9b 100644 --- a/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json +++ b/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json @@ -653,6 +653,10 @@ }, "CREDENTIALS": { "DESCRIPTION": "Voice calling requires Twilio API Key credentials. These are used to generate tokens for agent voice connections." + }, + "INBOUND": { + "LABEL": "Allow incoming calls", + "DESCRIPTION": "Let customers call this number. When turned off, incoming calls are declined automatically — agents aren't notified and no conversation is created. Agents can still place outgoing calls." } }, "WHATSAPP_CALLING": { diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/settingsPage/VoiceConfigurationPage.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/settingsPage/VoiceConfigurationPage.vue index b0fe858e5..b5f3183f1 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/inbox/settingsPage/VoiceConfigurationPage.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/settingsPage/VoiceConfigurationPage.vue @@ -1,9 +1,11 @@