Skip to content

Commit

Permalink
Twilio: use CDATA to encode message
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbs committed Mar 10, 2023
1 parent 9535f7f commit 3a95bf4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/Synergy/Channel/Twilio.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package Synergy::Channel::Twilio;

use Moose;
use experimental qw(signatures);
use HTML::Entities ();
use JSON::MaybeXS qw(encode_json decode_json);

use Synergy::Logger '$Logger';
Expand Down Expand Up @@ -149,11 +148,10 @@ sub send_message ($self, $target, $text, $alts = {}) {
my $res_f;

if ($alts->{voice}) {
my $encoded = HTML::Entities::encode_entities($alts->{voice});
my $language = $LANGUAGE_FOR{ $picked_code // 1 } // 'en-US';

my $language = HTML::Entities::encode_entities(
$LANGUAGE_FOR{ $picked_code // 1 } // 'en-US'
);
my $encoded = join q{},
map {; "<![CDATA[$_]]>" } split /(\]\])/, $alts->{voice};

$res_f = $self->http_post(
"https://api.twilio.com/2010-04-01/Accounts/$sid/Calls.json",
Expand Down

0 comments on commit 3a95bf4

Please sign in to comment.