With the Device::Gsm I can read the sms received on my umts-modem. Sometimes one message is divided in two or more sms because of the limitation of length of one sms. Is there a way to find out if a group of sms is a part of one message? Wammu for example shoes me sms that belong together as one text.
#!/usr/bin/perl
use warnings; use strict;
use Device::Gsm;
my $modem = new Device::Gsm( port => '/dev/ttyUSB0' );
if( $modem->connect() ) {
print "connected!\n";
}
else {
print "sorry, no connection with serial port!\n";
}
my @msg = $modem->messages;
if( @msg ) {
my $n = 0;
for( @msg ) {
my $sms = $_;
next unless defined $sms;
print "\nMESSAGE N. $n\n";
print 'Text [', $sms->text(), "]\n";
$n++;
}
}
else {
print "No message on SIM, or error during read!\n";
}
connected!
MESSAGE N. 0
Text [Message 1 Part 1]MESSAGE N. 1
Text [Message 1 Part 2]MESSAGE N. 2
Text [Message 1 Part 3]MESSAGE N. 3
Text [Message 2 ]MESSAGE N. 4
Text [Message 3]
I don’t think there is a way with Device::Gsm directly. However if you read the message in PDU mode (see https://metacpan.org/pod/Device::Gsm#mode ) you can then interpret the header appropriately to read out the multipart flags.
[Edited to add: this reference is a great overview of the SMS PDU headers:
http://www.spallared.com/old_nokia/nokia/smspdu/smspdu.htm ]