@Override
    public void publish() throws Throwable {
        val sms = casProperties.getAuthn().getAdaptive().getRisk().getResponse().getSms();
        val principal = authentication.getPrincipal();

        if (StringUtils.isBlank(sms.getText()) || StringUtils.isBlank(sms.getFrom())) {
            LOGGER.debug("Could not send sms [{}] because either no phones could be found or sms settings are not configured.", principal.getId());
        } else {
            val verificationUrl = buildRiskVerificationUrl();
            val parameters = CollectionUtils.<String, Object>wrap(
                "verificationUrl", verificationUrl,
                "registeredService", registeredService,
                "authentication", authentication);
            val text = SmsBodyBuilder.builder()
                .properties(sms)
                .parameters(parameters)
                .build()
                .get();
            val recipients = sms.getAttributeName().stream().map(attribute -> {
                val values = principal.getAttributes().get(SpringExpressionLanguageValueResolver.getInstance().resolve(attribute));
                return CollectionUtils.firstElement(values).orElse(StringUtils.EMPTY).toString();
            }).toList();
            val smsRequest = SmsRequest.builder().from(sms.getFrom()).to(recipients).text(text).build();
            communicationsManager.sms(smsRequest);
        }
    }
This is {@link AuthenticationRiskSmsNotifier}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-electrofence/src/main/java/org/apereo/cas/impl/notify/AuthenticationRiskSmsNotifier.java