Hi All,
I'm trying to use the sample script of sendmessage.pl to send a multipart message to multiple recipients by replacing "submit_sm" with "submit_multi". I could only see one part i.e the first part being delivered and then the server gives an error "error_status_code must be supplied at smsc.pl line 96". And it fails after that. Following is the code I'm using please go through and guide me through.
____________________________________________________________________
use Net::SMPP;
use Data::Dumper;
$trace = 1;
$Net::SMPP::trace = 1;
$sysid = "";
$pw = "";
$host = $host;
$port = 2775;
$facil = 0x00010003; # NF_PDC | GF_PVCY
my $mymsg = join (" ", @ARGV);
my $multimsg = 0;
if (length ($mymsg) > 128) {
$multimsg = 1;
}
$vers = 0x40; #4
$if_vers = 0x00;
### Connect and bind
($smpp, $resp) = Net::SMPP->new_transmitter($host,
smpp_version => $vers,
interface_version => $if_vers,
system_id => $sysid,
password => $pw,
addr_ton => 0x09,
addr_npi => 0x00,
source_addr_ton => 0x09,
source_addr_npi => 0x00,
dest_addr_ton => 0x09,
dest_addr_npi => 0x00,
system_type => '_001',
facilities_mask => $facil,
port => $port,
)
or die "Can't contact server: $!";
###
### Typical session in synchronous mode
###
warn "Sending submit_sm";
$sent_no = 0;
$origref = $ref = 160;
$textptr = 0;
$finished = 0;
#print "FELIX: Now checking length of string: ".length ($mymsg)."\n";
if (length ($mymsg) > 128) {
$multimsg_maxparts = int (length ($mymsg) / 128);
if (length ($mymsg) % 128) {
$multimsg_maxparts++;
}
$multimsg_curpart = 1;
print "multimsgsparts: $multimsg_maxparts\n";
}
$msgtext = substr ($mymsg, 0, 128, "");
while (length ($msgtext)) {
### See V4, p. 77
if ($multimsg_curpart) {
$multimsg = pack ("nCC", $origref, $multimsg_curpart, $multimsg_maxparts);
printf STDERR "\nI AM SETTING MULTIPART: len=%d\n", multimsg;
} else {
$multimsg = undef;
}
printf "Now sending: (multimsg = %.8x) (len: %d) %s\n", $multimsg, length ($msgtext), $msgtext;
$msgref = sprintf "%.8d", $ref;
print "MESSAGE REFERENCE: $msgref REF= $ref\n";
$resp = $smpp->submit_sm(message_class=>0,
# source_addr => '0077719011234777'
destination_addr => ['077714107777','+919652222415'],
msg_reference => $msgref,
priority_level => 3,
short_message=>$msgtext,
PDC_MultiPartMessage => $multimsg,
);
$multimsg_curpart++;
$msgtext = substr ($mymsg, 0, 120, "");
$ref++;
}
# warn Dumper $resp;
$resp = $smpp->unbind();
# warn Dumper $resp;
warn "Done.";
#EOF
____________________________________________________________________
Thank You
Manoj