Add queue timeout voicemail and Amazon SNS SMS provider support
This update adds two major features: 1. Queue Timeout Voicemail - Callers can now leave voicemail when queue timeout is reached - Configurable per-queue voicemail prompts with TTS support - Automatic transcription and urgent keyword detection - Admin setting to choose between voicemail or callback on timeout 2. Amazon SNS SMS Provider - Alternative SMS provider to Twilio for sending text messages - Useful when Twilio SMS approval is difficult to obtain - Provider abstraction layer allows switching between Twilio/SNS - Full AWS SNS configuration in admin settings - Supports custom sender IDs in compatible countries - Lower cost per SMS compared to Twilio New Files: - includes/class-twp-voicemail-handler.php - Voicemail recording handler - includes/interface-twp-sms-provider.php - SMS provider interface - includes/class-twp-sms-provider-twilio.php - Twilio SMS implementation - includes/class-twp-sms-provider-sns.php - Amazon SNS implementation - includes/class-twp-sms-manager.php - SMS provider abstraction manager - QUEUE_VOICEMAIL_SMS_FEATURES.md - Complete feature documentation Modified Files: - includes/class-twp-call-queue.php - Added voicemail option to timeout handler - includes/class-twp-twilio-api.php - Updated send_sms() to use provider abstraction - admin/class-twp-admin.php - Added SMS provider and timeout action settings - composer.json - Added AWS SDK dependency 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -553,7 +553,103 @@ class TWP_Admin {
|
||||
<p class="description">Default Twilio phone number to use as sender for SMS messages when not in a workflow context.</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<h2>SMS Provider Settings</h2>
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th scope="row">SMS Provider</th>
|
||||
<td>
|
||||
<?php $sms_provider = get_option('twp_sms_provider', 'twilio'); ?>
|
||||
<select name="twp_sms_provider" id="twp_sms_provider" class="regular-text">
|
||||
<option value="twilio" <?php selected($sms_provider, 'twilio'); ?>>Twilio (Default)</option>
|
||||
<option value="aws_sns" <?php selected($sms_provider, 'aws_sns'); ?>>Amazon SNS</option>
|
||||
</select>
|
||||
<p class="description">Choose which service to use for sending SMS messages. If you're having trouble getting Twilio SMS approved, Amazon SNS is an alternative.</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- Amazon SNS Settings -->
|
||||
<tr class="aws-sns-setting" style="<?php echo ($sms_provider !== 'aws_sns') ? 'display:none;' : ''; ?>">
|
||||
<th scope="row">AWS Access Key ID</th>
|
||||
<td>
|
||||
<input type="text" name="twp_aws_access_key"
|
||||
value="<?php echo esc_attr(get_option('twp_aws_access_key')); ?>"
|
||||
class="regular-text"
|
||||
placeholder="AKIAIOSFODNN7EXAMPLE" />
|
||||
<p class="description">Your AWS IAM access key with SNS permissions. <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html" target="_blank">How to create AWS access keys</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="aws-sns-setting" style="<?php echo ($sms_provider !== 'aws_sns') ? 'display:none;' : ''; ?>">
|
||||
<th scope="row">AWS Secret Access Key</th>
|
||||
<td>
|
||||
<input type="password" name="twp_aws_secret_key"
|
||||
value="<?php echo esc_attr(get_option('twp_aws_secret_key')); ?>"
|
||||
class="regular-text"
|
||||
placeholder="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" />
|
||||
<p class="description">Your AWS IAM secret key. Keep this secure.</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="aws-sns-setting" style="<?php echo ($sms_provider !== 'aws_sns') ? 'display:none;' : ''; ?>">
|
||||
<th scope="row">AWS Region</th>
|
||||
<td>
|
||||
<?php $aws_region = get_option('twp_aws_region', 'us-east-1'); ?>
|
||||
<select name="twp_aws_region" class="regular-text">
|
||||
<option value="us-east-1" <?php selected($aws_region, 'us-east-1'); ?>>US East (N. Virginia) - us-east-1</option>
|
||||
<option value="us-east-2" <?php selected($aws_region, 'us-east-2'); ?>>US East (Ohio) - us-east-2</option>
|
||||
<option value="us-west-1" <?php selected($aws_region, 'us-west-1'); ?>>US West (N. California) - us-west-1</option>
|
||||
<option value="us-west-2" <?php selected($aws_region, 'us-west-2'); ?>>US West (Oregon) - us-west-2</option>
|
||||
<option value="eu-west-1" <?php selected($aws_region, 'eu-west-1'); ?>>EU (Ireland) - eu-west-1</option>
|
||||
<option value="eu-central-1" <?php selected($aws_region, 'eu-central-1'); ?>>EU (Frankfurt) - eu-central-1</option>
|
||||
<option value="ap-southeast-1" <?php selected($aws_region, 'ap-southeast-1'); ?>>Asia Pacific (Singapore) - ap-southeast-1</option>
|
||||
<option value="ap-northeast-1" <?php selected($aws_region, 'ap-northeast-1'); ?>>Asia Pacific (Tokyo) - ap-northeast-1</option>
|
||||
</select>
|
||||
<p class="description">AWS region where your SNS service is configured.</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="aws-sns-setting" style="<?php echo ($sms_provider !== 'aws_sns') ? 'display:none;' : ''; ?>">
|
||||
<th scope="row">SMS Sender ID (Optional)</th>
|
||||
<td>
|
||||
<input type="text" name="twp_aws_sns_sender_id"
|
||||
value="<?php echo esc_attr(get_option('twp_aws_sns_sender_id')); ?>"
|
||||
class="regular-text"
|
||||
placeholder="MyCompany"
|
||||
maxlength="11" />
|
||||
<p class="description">Alphanumeric sender ID (3-11 characters). Supported in some countries. Leave blank to use default AWS number.</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">Queue Timeout Action</th>
|
||||
<td>
|
||||
<?php $timeout_action = get_option('twp_queue_timeout_action', 'voicemail'); ?>
|
||||
<select name="twp_queue_timeout_action" class="regular-text">
|
||||
<option value="voicemail" <?php selected($timeout_action, 'voicemail'); ?>>Take Voicemail</option>
|
||||
<option value="callback" <?php selected($timeout_action, 'callback'); ?>>Offer Callback</option>
|
||||
</select>
|
||||
<p class="description">What to do when a caller reaches the queue timeout limit. Voicemail is recommended for better caller experience.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
jQuery(document).ready(function($) {
|
||||
// Show/hide AWS SNS settings based on provider selection
|
||||
$('#twp_sms_provider').on('change', function() {
|
||||
if ($(this).val() === 'aws_sns') {
|
||||
$('.aws-sns-setting').show();
|
||||
} else {
|
||||
$('.aws-sns-setting').hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<h2>Voicemail & Notification Settings</h2>
|
||||
<table class="form-table">
|
||||
<!-- Discord/Slack Notifications Section -->
|
||||
<tr valign="top">
|
||||
<td colspan="2">
|
||||
@@ -3723,7 +3819,15 @@ class TWP_Admin {
|
||||
register_setting('twilio-wp-settings-group', 'twp_urgent_keywords');
|
||||
register_setting('twilio-wp-settings-group', 'twp_sms_notification_number');
|
||||
register_setting('twilio-wp-settings-group', 'twp_default_sms_number');
|
||||
|
||||
|
||||
// SMS Provider settings
|
||||
register_setting('twilio-wp-settings-group', 'twp_sms_provider');
|
||||
register_setting('twilio-wp-settings-group', 'twp_aws_access_key');
|
||||
register_setting('twilio-wp-settings-group', 'twp_aws_secret_key');
|
||||
register_setting('twilio-wp-settings-group', 'twp_aws_region');
|
||||
register_setting('twilio-wp-settings-group', 'twp_aws_sns_sender_id');
|
||||
register_setting('twilio-wp-settings-group', 'twp_queue_timeout_action');
|
||||
|
||||
// Discord/Slack notification settings
|
||||
register_setting('twilio-wp-settings-group', 'twp_discord_webhook_url');
|
||||
register_setting('twilio-wp-settings-group', 'twp_slack_webhook_url');
|
||||
|
||||
Reference in New Issue
Block a user