NetSDS::Message - common mobile message (SMS, MMS, IM)
use NetSDS::Message; ... $msg = NetSDS::Message->new( src_addr => '1234@mtsgw', dst_addr => '380441234567@mtsgw', body => $content, );
NetSDS::Message is a superclass for other modules implementing API to exact structure of some messaging data (i.e. CPA2, SMS, MMS, etc).
NetSDS::Message
This module implemented to avoid duplication of code providing common functionality for all message types like managing addresses, headers, preparing reply message and so on.
my $object = NetSDS::SomeClass->new(%options);
$msg_id = $msg->message_id();
$msg->src_addr('380121234567@operatorgw');
# Set address $msg->src_addr('380121234567@operatorgw'); # Get native form of address $phone = $msg->src_addr_native(); # return '380121234567'
$dst_addr = $msg->dst_addr();
if ($mo_msg->dst_addr_native() eq '1234') { print "Received SMS to 1234"; }
$msg->subject('Hello there');
Paramters: new media if set or none if get
Supported media types: 'sms', 'mms', 'ussd'. In fact media types processing is not responsibility of this module and implemented in other modules.
Paramters: header name, new header value
Returns: header value
Message headers implemented as hash reference and contains supplementary information about message. All header name characters are lowercased and all '-' replaced with '_'.
# Set header $msg->header('X-Beer', 'Guinness'); # Get this header $beer = $msg->header('x_beer');
Paramters: new format name
Returns: format name
Message format provides is related to transport layer code and describe data structure of message body.
Supported formats:
sms - generic SMS data for ETSI GSM 03.40 compliant implementations. See NetSDS::Message::SMS for details.
cpa2 - CPA2 compatible structure. See NetSDS::Message::CPA2 for details.
This message allows to make reply to current one. Source and destination message are exchanged, media left the same.
This method implements automatic generation of message id using make_uuid() routine. System name is set to 'netsds.generic' if not given in arguments.
See samples directory for examples.
samples
Unknown yet
None
Michael Bochkaryov <misha@rattler.kiev.ua>
Copyright (C) 2008 Michael Bochkaryov
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
To install NetSDS::Message, copy and paste the appropriate command in to your terminal.
cpanm
cpanm NetSDS::Message
CPAN shell
perl -MCPAN -e shell install NetSDS::Message
For more information on module installation, please visit the detailed CPAN module installation guide.