.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "NetSDS::Kannel 3pm" .TH NetSDS::Kannel 3pm "2021-12-26" "perl v5.32.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" NetSDS::Kannel \- Kannel SMS gateway API .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& #!/usr/bin/env perl \& \& use 5.8.0; \& use warnings; \& use strict; \& \& use NetSDS::Kannel; \& \& my $kannel = NetSDS::Kannel\->new( \& sendsms_url => \*(Aqhttp://localhost:1234/sendsms\*(Aq, \& sendsms_user => \*(Aqsender\*(Aq, \& sendsms_passwd => \*(Aqsecret\*(Aq, \& default_smsc => \*(Aqesme\-megafon\*(Aq, \& ); \& \& $res = $kannel\->send( \& from => \*(Aq1234\*(Aq, \& to => \*(Aq380672222111\*(Aq, \& text => \*(AqHallo there!\*(Aq, \& smsc => \*(Aqemse\-mts\*(Aq, \& priority => 3, \& ); \& \& 1; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\f(CW\*(C`NetSDS::Kannel\*(C'\fR module provides \s-1API\s0 to Kannel \s-1SMS\s0 gateway. .PP To decrease innecessary problems we use a lot of predefined parameters while sending and receiving messages via Kannel \s-1HTTP API.\s0 It's not so flexible as direct \s-1HTTP\s0 processing but less expensive in development time ;\-) .PP This modules uses \s-1LWP\s0 to send messages and \s-1CGI\s0.pm to process messages from Kannel. .SH "CLASS API" .IX Header "CLASS API" .IP "\fBnew(%params)\fR \- class constructor" 4 .IX Item "new(%params) - class constructor" Constructor creates Kannel \s-1API\s0 handler and set it's configuration. Most of these parameters may be overriden while object method calls. .Sp \&\fBAdmin \s-1API\s0 parameters:\fR .Sp * admin_url \- Kannel admin \s-1API URL\s0 .Sp * admin_passwd \- password to admin \s-1API\s0 .Sp \&\fBSending \s-1SMS API\s0 parameters:\fR .Sp * sendsms_url \- \s-1URL\s0 of Kannel sendsms \s-1HTTP API\s0 .Sp * sendsms_user \- user name for sending \s-1SMS\s0 .Sp * sendsms_passwd \- password for sending \s-1SMS\s0 .Sp * dlr_url \- base \s-1URL\s0 for \s-1DLR\s0 retrieving .Sp * default_smsc \- default \s-1SMSC\s0 identifier for sending \s-1SMS\s0 .Sp * default_timeout \- default sending \s-1TCP\s0 timeout .SH "OBJECT METHODS" .IX Header "OBJECT METHODS" .IP "\fBsend(%parameters)\fR \- send \s-1MT SM\s0 message to Kannel" 4 .IX Item "send(%parameters) - send MT SM message to Kannel" This method allows to send \s-1SMS\s0 message via Kannel \s-1SMS\s0 gateway. .Sp Parameters (mostly the same as in Kannel sendsms \s-1API\s0): .Sp * from \- source address (overrides message) .Sp * to \- destination address (overrides message) .Sp * text \- message text (byte string) .Sp * udh \- user data header (byte string) .Sp * charset \- charset of text .Sp * coding \- 0 for \s-1GSM 03.38, 1\s0 for binary, 2 for \s-1UCS2\s0 .Sp * smsc \- target \s-1SMSC\s0 (overrides default one) .Sp * mclass \- message class if necessary (0 for flash sms) .Sp * validity \- \s-1TTL\s0 for \s-1MO SM\s0 in minutes .Sp * deferred \- timeout for delayed delivery .Sp Example: .Sp .Vb 2 \& use NetSDS::Kannel; \& use NetSDS::Util::Misc; \& \& my $kannel = NetSDS::Kannel\->new(...); \& $kannel\->send_sms( \& from => \*(Aq1234\*(Aq, \& to => \*(Aq380672206770\*(Aq, \& text => \*(AqWake up!!!\*(Aq, \& smsc => \*(Aqnokia_modem\*(Aq, \& msgid => make_uuid, \& ); .Ve .IP "\fBreceive($cgi)\fR \- receive \s-1MO\s0 or \s-1DLR\s0 from \s-1CGI\s0 object" 4 .IX Item "receive($cgi) - receive MO or DLR from CGI object" This method provides import message structure from \s-1CGI\s0 request . This method is just wrapper around \f(CW\*(C`receive_mo()\*(C'\fR and \f(CW\*(C`receive_dlr()\*(C'\fR methods. .Sp Message type (\s-1MO\s0 or \s-1DLR\s0) recognized by \f(CW\*(C`type\*(C'\fR \s-1CGI\s0 parameter that may be \f(CW\*(C`mo\*(C'\fR or \f(CW\*(C`dlr\*(C'\fR. .Sp .Vb 2 \& my $cgi = CGI::Fast\->new(); \& my %ret = $kannel\->receive($cgi); .Ve .IP "\fBreceive_mo($cgi)\fR \- import \s-1MO\s0 message from \s-1CGI\s0 object" 4 .IX Item "receive_mo($cgi) - import MO message from CGI object" This method provides import message structure from \s-1CGI\s0 request . .Sp Imported \s-1MO\s0 message parameters returned as hash with the following keys: .Sp * smsc \- Kannel's \s-1SMSC\s0 Id .Sp * smsid \- \s-1SMSC\s0 message \s-1ID\s0 .Sp * from \- subscriber's \s-1MSISDN\s0 .Sp * to \- service address (short code) .Sp * time \- \s-1SMS\s0 receive time .Sp * unixtime \s-1SMS\s0 receive time as \s-1UNIX\s0 timestamp .Sp * text \- \s-1MO SM\s0 text .Sp * bin \- \s-1MO SM\s0 as binary string .Sp * udh \- \s-1SMS UDH\s0 (User Data Headers) .Sp * coding \- \s-1SMS\s0 encoding (0 \- 7 bit \s-1GSM 03.38\s0; 2 \- \s-1UCS2\-BE\s0) .Sp * charset \- charset of \s-1MO SM\s0 text while receiving from Kannel .Sp * binfo \- \s-1SMPP\s0 \f(CW\*(C`service_type\*(C'\fR parameter for billing puroses .IP "\fBreceive_dlr($cgi)\fR \- import message from \s-1CGI\s0 object" 4 .IX Item "receive_dlr($cgi) - import message from CGI object" This method provides import message structure from \s-1CGI\s0 request . .Sp \&\f(CW\*(C`receive_dlr\*(C'\fR method returns hash with the following keys: .Sp * smsc \- kannel \s-1SMSC\s0 id .Sp * msgid \- original \s-1MT SM\s0 message id for \s-1DLR\s0 identification .Sp * smsid \- \s-1SMSC\s0 message \s-1ID\s0 .Sp * from \- subscriber's \s-1MSISDN\s0 (phone number) .Sp * to \- service address (short code) .Sp * time \- delivery time .Sp * unixtime \- delivery time as \s-1UNIX\s0 timestamp .Sp * dlr \- \s-1DLR\s0 state .Sp * dlrmsg \- \s-1DLR\s0 message from \s-1SMSC\s0 .Sp Example: .Sp .Vb 1 \& my $cgi = CGI\->new(); \& \& my %dlr = $kannel\->receive_dlr($cgi); \& \& print "DLR received for MSISDN: " . $dlr{from}; .Ve .IP "\fBmake_dlr_url(%params)\fR \- prepare \s-1DLR URL\s0" 4 .IX Item "make_dlr_url(%params) - prepare DLR URL" This method creates \s-1URI\s0 escaped string with \s-1URL\s0 template for \s-1DLR\s0 notification. .Sp Paramters: hash (dlr_url, msgid) .Sp Returns: \s-1URI\s0 escaped \s-1DLR URL\s0 .IP "\fBmake_meta(%params)\fR \- prepare \s-1SMPP\s0 optional \s-1TLV\s0" 4 .IX Item "make_meta(%params) - prepare SMPP optional TLV" This method creates \s-1URI\s0 escaped string with optional \s-1SMPP\s0 tag-lenght-value (\s-1TLV\s0) parameters to send them in \f(CW\*(C`meta\-data\*(C'\fR \s-1CGI\s0 paramter of Kannel's \f(CW\*(C`sendsms\*(C'\fR \s-1HTTP API.\s0 .Sp Format of \f(CW\*(C`meta\-data\*(C'\fR parameter value: .Sp .Vb 1 \& ?smpp?tag1=value1&tag2=value2&...tagN=valueN .Ve .Sp Paramters: hash of \s-1TLV\s0 pairs .Sp Returns: \s-1URI\s0 escaped string .Sp Example: .Sp .Vb 3 \& my $meta = $self\->make_meta( \& charging_id => \*(Aq0\*(Aq, \& ); .Ve .Sp This will return: \f(CW%3Fsmpp\fR%3Fcharging_id%3D0 .IP "\fB\fBstatus()\fB\fR \- retrieve Kannel status" 4 .IX Item "status() - retrieve Kannel status" .PD 0 .IP "\fB\fBstore_status()\fB\fR \- retrieve message queue status" 4 .IX Item "store_status() - retrieve message queue status" .PD Not implemented yet. .IP "\fB\fBshutdown()\fB\fR \- bring down Kannel" 4 .IX Item "shutdown() - bring down Kannel" .PD 0 .IP "\fB\fBsuspend()\fB\fR \- switch Kannel to 'suspended' state" 4 .IX Item "suspend() - switch Kannel to 'suspended' state" .IP "\fB\fBisolate()\fB\fR \- switch Kannel to 'isolated' state" 4 .IX Item "isolate() - switch Kannel to 'isolated' state" .IP "\fB\fBresume()\fB\fR \- resume Kannel to 'online' state" 4 .IX Item "resume() - resume Kannel to 'online' state" .IP "\fB\fBrestart()\fB\fR \- whole bearerbox restart" 4 .IX Item "restart() - whole bearerbox restart" .IP "\fB\fBflush_dlr()\fB\fR \- flush queued \s-1DLR\s0 if Kannel in 'suspended' state" 4 .IX Item "flush_dlr() - flush queued DLR if Kannel in 'suspended' state" .IP "\fB\fBreload_lists()\fB\fR \- reload black/white lists" 4 .IX Item "reload_lists() - reload black/white lists" .IP "\fBlog_level($level)\fR \- change Kannel log-level" 4 .IX Item "log_level($level) - change Kannel log-level" .IP "\fBstart_smsc($smsc)\fR \- switch on \s-1SMSC\s0 connection" 4 .IX Item "start_smsc($smsc) - switch on SMSC connection" .IP "\fBstop_smsc($smsc)\fR \- switch off \s-1SMSC\s0 connection" 4 .IX Item "stop_smsc($smsc) - switch off SMSC connection" .IP "\fBadd_smsc($smsc)\fR \- add new \s-1SMSC\s0 connection" 4 .IX Item "add_smsc($smsc) - add new SMSC connection" .IP "\fBremove_smsc($smsc)\fR \- remove \s-1SMSC\s0 connection" 4 .IX Item "remove_smsc($smsc) - remove SMSC connection" .PD .SH "EXAMPLES" .IX Header "EXAMPLES" See Nibelite kannel \s-1API\s0 .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "\(bu" 4 NetSDS::Class::Abstract \- base NetSDS class .IP "\(bu" 4 \- Kannel User Guide .SH "TODO" .IX Header "TODO" 1. Add \s-1PPG\s0 support. .PP 2. Add \s-1OTA\s0 support. .SH "AUTHOR" .IX Header "AUTHOR" Michael Bochkaryov .SH "LICENSE" .IX Header "LICENSE" Copyright (C) 2008\-2009 Net Style Ltd. .PP This program is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but \s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of \&\s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE.\s0 See the \&\s-1GNU\s0 General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, \s-1MA\s0 02111\-1307 \s-1USA\s0