Skip to content

Commit

Permalink
Skip phone messages if patron has no phone number to call
Browse files Browse the repository at this point in the history
  • Loading branch information
kylemhall committed Aug 21, 2023
1 parent eb40751 commit 050716a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Koha/Plugin/Com/ByWaterSolutions/TwilioVoice.pm
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ sub before_send_messages {
if ($other_messages->count) {
$m->status('deleted'); # As close a status to 'skipped' as we have
$m->update();

next;
}
}
Expand All @@ -109,6 +108,12 @@ sub before_send_messages {

my $phone = $patron->phone || $patron->mobile;

unless ( $phone ) {
$m->status('failed');
$m->update();
next;
}

# Normalize the phone number to E.164 format, Twilio has a convenient ( and free ) API for this.
my $ua = LWP::UserAgent->new;
my $request = HTTP::Request->new(GET => "https://lookups.twilio.com/v1/PhoneNumbers/$phone?CountryCode=US");
Expand Down

0 comments on commit 050716a

Please sign in to comment.