Text messaging Receive only: database 4.3.6 adds sms_providers.sms_provider_send, and a provider set to Receive only in its window takes texts in as tickets, replies and codes and texts nothing out (no Text reply, ticket number, STOP or HELP answers, texts to clients or test texts), needs no SID or secret, cancels the texts waiting to go when switched, and is shown on Text Messaging, Text Messages, Notifications and Tickets settings and in the reply box of a ticket that came in by text, with the number to call; 26.12.3 changelog

This commit is contained in:
johnnyq
2026-12-01 12:42:51 -05:00
parent 89645add5e
commit abcd1a6fcf
11 changed files with 174 additions and 27 deletions

View File

@@ -45,10 +45,14 @@ if (isset($_POST['check_sms_provider']) || isset($_POST['add_sms_provider']) ||
$name = $after['sms_provider_name'];
$number = smsNumberText($after['sms_provider_number']);
$receive_only = isset($after['sms_provider_send']) && intval($after['sms_provider_send']) === 0;
if (!$before) {
$provider_id = smsProviderWrite($after);
logAudit("Text Message", "Create", "$session_name added texting provider " . escapeSql("$name, texting from $number"), 0, $provider_id);
flashAlert('<strong>' . escapeHtml($name) . '</strong> created, texting from <strong>' . escapeHtml($number) . '</strong> - paste the address texts come back to into its portal, then send a test text');
logAudit("Text Message", "Create", "$session_name added texting provider " . escapeSql("$name, " . ($receive_only ? "receive only, at $number" : "texting from $number")), 0, $provider_id);
flashAlert($receive_only
? '<strong>' . escapeHtml($name) . '</strong> created, receive only, at <strong>' . escapeHtml($number) . '</strong> - paste the address texts come back to into its portal, then text the number to try it'
: '<strong>' . escapeHtml($name) . '</strong> created, texting from <strong>' . escapeHtml($number) . '</strong> - paste the address texts come back to into its portal, then send a test text');
redirect('text_messaging.php');
}
@@ -58,8 +62,13 @@ if (isset($_POST['check_sms_provider']) || isset($_POST['add_sms_provider']) ||
redirect();
}
smsProviderWrite($after, $provider_id);
// Set to Receive only - texts waiting to go would go late, or never
$cancelled = $receive_only && smsSends($before) ? smsCancelWaiting("Texts don't go out - Text Messaging was set to Receive only") : 0;
if ($cancelled) {
$lines[] = "$cancelled text" . ($cancelled === 1 ? '' : 's') . " waiting to go cancelled";
}
logAudit("Text Message", "Edit", "$session_name changed texting provider " . escapeSql("$name: " . implode('; ', $lines)), 0, $provider_id);
flashAlert('<strong>' . escapeHtml($name) . '</strong> saved - ' . escapeHtml(count($lines) === 1 ? $lines[0] : count($lines) . ' changes'));
flashAlert('<strong>' . escapeHtml($name) . '</strong> saved - ' . escapeHtml(count($lines) === 1 ? $lines[0] : implode('; ', $lines)));
redirect();
}
@@ -136,6 +145,10 @@ if (isset($_POST['send_sms_test'])) {
flashAlert('Turn the texting provider on first.', 'error');
redirect();
}
if (!smsSends($row)) {
flashAlert('It is set to Receive only, so nothing is texted - text your number to try it instead.', 'error');
redirect();
}
$number = smsNumber((string) ($_POST['number'] ?? ''));
$text = trim((string) ($_POST['text'] ?? ''));
if ($number === '') {