NAME
SMS::MT - send mobile terminated SMS messages.
SYNOPSIS
use SMS::MT;
my $sm = new SMS::MT('UID' => 'joeblow',
'PWD' => 'secret',
'PLUGIN' => 'WirelessServices');
# Send text message
unless($sm->send_text('Hello world!',
'+31611112222',
{'FROM' => 'Joe'})) {
die "Failed to send SMS.\n" .
'Error code: ' . $sm->get_last_error_code() . "\n" .
'Error msg: ' . $sm->get_last_error_message() . "\n";
}
# Send picture
unless($sm->send_picture(\$otadata,
'+31611112222',
{'FROM' => 'Joe',
'MSG' => 'Like my picture?'})) {
die "Failed to send SMS.\n" .
'Error code: ' . $sm->get_last_error_code() . "\n" .
'Error msg: ' . $sm->get_last_error_message() . "\n";
}
# Send logo
unless($sm->send_logo(\$otadata,$mccode,'+31611112222')) {
die "Failed to send SMS.\n" .
'Error code: ' . $sm->get_last_error_code() . "\n" .
'Error msg: ' . $sm->get_last_error_message() . "\n";
}
# Send CLI / group icon to 2 recipients
unless($sm->send_groupicon(\$otadata,'+31611112222,+31600001111')) {
die "Failed to send SMS.\n" .
'Error code: ' . $sm->get_last_error_code() . "\n" .
'Error msg: ' . $sm->get_last_error_message() . "\n";
}
# Send ringtone
my $rtttl = 'Flntstn:d=4,o=5,b=200:g#,c#,8p,c#6,8a#,g#,c#,' .
'8p,g#,8f#,8f,8f,8f#,8g#,c#,d#,2f,2p,g#,c#,8p,' .
'c#6,8a#,g#,c#,8p,g#,8f#,8f,8f,8f#,8g#,c#,d#,2c#';
unless($sm->send_ringtone($rtttl,'+31611112222)) {
die "Failed to send SMS.\n" .
'Error code: ' . $sm->get_last_error_code() . "\n" .
'Error msg: ' . $sm->get_last_error_message() . "\n";
}
DESCRIPTION
SMS::MT is a class that uses plugin modules to send mobile terminated SMS messages via a simple and standard interface. All plugins are accessed through the methods this class provides. This way, only one class and it's methods can be used for different SMS MT services without the user having to go into the details of how each of these services work.
CLASS METHODS
- new ('UID' => $userid, 'PWD' => $password, 'PLUGIN' => $plugin);
-
Returns a new SMS::MT object.
- get_plugin_names()
-
Returns a (reference to) an array of installed plugin names depending on the context in which this method is called.
Examples: my @plugins_array = SMS::MT->get_plugin_names(); my $plugins_ref = SMS::MT->get_plugin_names();
OBJECT METHODS
- get_last_error_code()
-
Returns the last plugin specific error code.
- get_last_error_message()
-
Returns the last plugin specific error message.
- get_max_text_length()
-
Returns the maximum text length supported by the current plugin. Normally this is 160.
- get_service_name()
-
Get's the current plugin module's descriptive service name.
- send_groupicon(\$data,$recipients,\%options)
-
Sends a SMS CLI / group icon.
The first parameter contains a contains a reference to $data, the binary image data in OTA bitmap format.
The second parameter $recipients contains a comma seperated string or a reference to an array of recipients in international phone number format.
The third parameter is optional and if present it then it must be a reference to a hash of options. %options may have any of the following keys: FROM, VALIDITY, FLASH, CALLBACK.
The result contains a boolean value.
- send_logo(\$data,$recipients,$mccode,\%options);
-
Sends a SMS operator logo.
The first parameter contains a contains a reference to $data, the binary image data in OTA bitmap format.
The second parameter $recipients contains a comma seperated string or a reference to an array of recipients in international phone number format.
The third parameter $mccode must contain the mc code / operator code used that all recipients belong to. It is up to the caller to ensure that all recipients in $recipients belong share the same mc code / operator code.
The fourth parameter is optional and if present it then it must be a reference to a hash of options. %options may have any of the following keys: FROM, VALIDITY, FLASH, CALLBACK.
The result contains a boolean value.
- send_picture($data,$recipients,\%options)
-
Sends a SMS picture message. See send_groupicon for parameters and result.
You may also send a text message along with the picture message by adding the pair 'MSG' => $textmessage to the %options hash.
- send_ringtone($rtttl,$recipients,\%options)
-
Sends a SMS ringtone.
The first parameter $rtttl contains (a reference to) a RTTTL string.
The second parameter $recipients contains a comma seperated string or a reference to an array of recipients in international phone number format.
The third parameter is optional and if present it then it must be a reference to a hash of options. %options may have any of the following keys:
FROM
,VALIDITY
,FLASH
,CALLBACK
,NAME
.The result contains a boolean value.
- send_text($text,$recipients,\%options)
-
Sends an SMS text message.
The first parameter $text contains the message text.
The second parameter $recipients contains a comma seperated string or a reference to an array of recipients in international phone number format.
The third parameter is optional and if present it then it must be a reference to a hash of options. %options may have any of the following keys: FROM, VALIDITY, FLASH, CALLBACK.
The result contains a boolean value.
OPTIONAL PARAMETERS TO send*() METHODS
All send*() methods support optional parameters that are passed as a reference to a hash.
Below is a list of all possible optional parameter keys and what kind of values are to be associated with them.
- FROM
-
The value must contain the sender of the message.
- VALIDITY
-
The value must contain the validity of the message in minutes.
- FLASH
-
The value must contain a boolean indicating if this is a flash SMS.
- CALLBACK
-
The value must contain the callback number.
- NAME
-
The value must contain the name of the ringtone. This name should override any name already specified in the RTTTL string.
- MSG
-
The value must contain the textual message of a picture message.
DEVELOPING PLUGINS
- Package name and install location
-
Plugin modules must be installed in the subdirectory "Service" directly below the module SMS::MT.pm. The plugin module's package name will therefore be something like SMS::MT::Service::Foo (the plugin filename being Foo.pm and the plugin service name being Foo).
- Required methods
-
All object methods published in this documentation must be implemented by the plugin module as all object method calls in the package SMS::MT are passed through to the plugin module.
The plugin must also have a new() constructor that accepts a hash of parameters containing keys: UID and PWD. UID is the user id and PWD is the password needed to login to the SMS service.
HISTORY
AUTHOR
Craig Manley c.manley@skybound.nl
COPYRIGHT
Copyright (C) 2001 Craig Manley <c.manley@skybound.nl>. All rights reserved. This program is free software; you can redistribute it and/or modify it under under the same terms as Perl itself. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.