GSM-SMS
view release on metacpan or search on metacpan
lib/GSM/SMS/NBS.pm view on Meta::CPAN
=back
=head1 METHODS
=over 4
=item B<sendto> - Send a message
This is a helper function. It'l take a message and tries to send it. This method
uses the GSM::SMS::NBS::* subclasses to split up the message in smaller fragments.
=cut
sub sendto {
my ($self, $msisdn, $message, $dport, $sport, $dcs ) = @_;
my $ret = 0;
my $transport = $self->{'__TRANSPORT__'};
my $nbs_message = GSM::SMS::NBS::Message->new();
$nbs_message->create($msisdn, $message, $dport, $sport, $dcs);
foreach my $frame ( @{$nbs_message->get_frames()} ) {
# transport->send returns -1 on failure.
$ret = -1 if $transport->send($msisdn, $frame);
}
return $ret;
}
=item B<sendRTTTL> - Send a ring tone in RTTTL format.
$nbs->sendRTTTL( $msisdn, $rtttlstring );
Send a ring tone ( $rtttlstring ) to the specified telephone number ( $msisdn ). The RTTTL ( Ringing Tone Tagged Text Language ) format is specified as described in the file docs/rtttlsyntax.txt.
You can find a lot of information about RTTTL ( and a lot of ringing tones ) on the internet. Just point your favourite browser to your favourite searchengine and look for ringing tones.
=cut
sub sendRTTTL {
my ($self, $msisdn, $rtttlstring) = @_;
if ( my $error = OTARTTTL_check($rtttlstring) ) {
return $error;
}
my $music = OTARTTTL_makestream($rtttlstring);
return $self->sendto( $msisdn, $music, OTARTTTL_PORT);
}
=item B<sendOperatorLogo_b64> - Send an operator logo
$nbs->sendOperatorLogo_b64( $msisdn, $country, $operator, $b64, $format);
An operator logo indicates the operator you are connected to for the moment.
This is used to have a nice logo on your telephone all of the time.
For this method you'll also need to provide a country code and an operator code.
I've assembled a list of country and operator codes for different mobile
operators in the file "I<docs/codes.txt>". For the moment there is no convenience class that implements the lookup of these code according to the mobile phone number. Due to the dynamic nature of these numbers - numbers can be kept when switching ope...
The method expects a base64 serialised image and the format of the image, 'gif', 'png'. The L<Image::Magick> package is used to process the image, this guarabntees a lot of supported formats. The image needs to be 71 by 14 pixels.
=cut
sub sendOperatorLogo_b64 {
my ($self, $msisdn, $country, $operator, $b64, $format) = @_;
my $ol = OTAOperatorlogo_fromb64( $country, $operator, $b64, $format );
return $self->sendto( $msisdn, $ol, OTAOperatorlogo_PORT);
}
=item B<sendOperatorLogo_file> - Send an operator logo
$nbs->sendOperatorLogo_file( $msisdn, $country, $operator, $file );
Send an operator logo to $msisdn, using the image in file $file. This method
does the same thing as C<sendOperatorLogo_b64>, but uses a file instead of a
base 64 encoded image.
=cut
sub sendOperatorLogo_file {
my ($self, $msisdn, $country, $operator, $file ) = @_;
my $ol = OTAOperatorlogo_fromfile( $country, $operator, $file );
return $self->sendto($msisdn, $ol, OTAOperatorlogo_PORT);
}
=item B<sendGroupGraphic_b64> - Send a group graphic
$nbs->sendGroupGraphic_b64( $msisdn, $b64, $format);
Send a group graphic, also called a Caller Line Identification icon ( CLIicon ),to the recipient indicated by the telephone number $msisdn. It expects a base 64 encoded image and the format the image is in, like 'gif', 'png'. To find out which image ...
=cut
sub sendGroupGraphic_b64 {
my ($self, $msisdn, $b64, $format) = @_;
my $gg = OTACLIicon_fromb64( $b64, $format );
return $self->sendto($msisdn, $gg, OTACLIicon_PORT);
}
=item B<sendGroupGraphic_file> - Send a group graphic
$nbs->sendGroupGraphic_file( $msisdn, $file);
Send a group graphic to $msisdn, use the image in file $file. The image must be 71x14 pixels.
=cut
sub sendGroupGraphic_file {
my ($self, $msisdn, $file) = @_;
my $gg = OTACLIicon_fromfile( $file );
return $self->sendto($msisdn, $gg, OTACLIicon_PORT);
}
=item B<sendVCard> - Send a VCard
$nbs->sendVCard( $msisdn, $lastname, $firstname, $telephone );
A VCard is a small business card, containing information about a person. It is not a GSM only standard, netscape uses vcards to identify the mail sender ( attach vcard option ). You can look at the complete VCard MIME specification in RFC 2425 and RF...
=cut
sub sendVCard {
my ($self, $msisdn, $lname, $fname, $phone) = @_;
my $vcard = OTAVcard_makestream( $last, $first, $phone );
return $self->sendto( $msisdn, $vcard, OTAVcard_PORT);
}
=item B<sendConfig> - Send WAP configuration settings
$nbs->sendConfig( $msisdn,
$bearer,
$connection,
$auth,
$type,
$speed,
$proxy,
$home,
$uid,
$pwd,
$phone,
$name
);
Send a WAP configuration to a WAP capable handset. It expects the following parameters:
The parameters in UPPERCASE are exported constants by the GSM::SMS::OTA::Config.
( run in 0.853 second using v1.01-cache-2.11-cpan-39bf76dae61 )