Установка Net-SMPP в домашнюю директорию

Оф. сайт - http://search.cpan.org/~sampo/Net-SMPP/SMPP.pm

wget http://search.cpan.org/CPAN/authors/id/S/SA/SAMPO/Net-SMPP-1.19.tar.gz

tar -xzvf Net-SMPP-1.19.tar.gz;
cd Net-SMPP-1.19;

mkdir -p $HOME/scripts/smpp/;

perl Makefile.PL PREFIX=$HOME/scripts/smpp \
INSTALLPRIVLIB==$HOME/scripts/smpp/lib/perl5 \
INSTALLSCRIPT=$HOME/scripts/smpp/bin \
INSTALLSITELIB=$HOME/scripts/smpp/lib/perl5/site_perl \
INSTALLBIN=$HOME/scripts/smpp/bin \
INSTALLMAN1DIR=$HOME/scripts/smpp/lib/perl5/man \
INSTALLMAN3DIR=$HOME/scripts/smpp/lib/perl5/man3

make install;

 

перед запуском скрипта отправки объявляем либы:

export PERL5LIB=$HOME/scripts/smpp/lib/site_perl

 

Скрипт отправки:

#!/usr/bin/perl
#use strict;
#use warnings;
use Net::SMPP;
use Data::Dumper;

my $host = '192.168.1.1';
my $port = 2775;

my $mymsg = join (" ", @ARGV);
$msgtext = substr ($mymsg, 0, 128, "");

my $multimsg = 0;
if (length ($mymsg) > 128) {
$multimsg = 1;
}

my $smpp = Net::SMPP->new_transceiver(
$host,
port => $port,
system_id => 'smpp34',
system_type => 'smpp34',
password => 'smpp34',
# interface_version => 0x34,
) or die;

print Dumper($smpp);

$resp_pdu = $smpp->submit_sm(
source_addr_ton => 0x05,
source_addr_npi => 0x00,
source_addr => 'smsrouter',
dest_addr_ton => 0x01,
dest_addr_npi => 0x01,
registered_delivery => 0x00,
data_coding => 0x00,
destination_addr => '79031234567',
short_message=>$msgtext,
) or die;
die "Response indicated error: " . $resp_pdu->explain_status()
if $resp_pdu->status;

print Dumper($resp_pdu);

$msg_id = $resp_pdu->{message_id};

print Dumper($msg_id);