Skip Menu |

This queue is for tickets about the Net-SMPP CPAN distribution.

Report information
The Basics
Id: 88268
Status: new
Priority: 0/
Queue: Net-SMPP

People
Owner: Nobody in particular
Requestors: jpeacock [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.19
Fixed in: (no value)



Subject: Improve short message handling and other improvements
These are some improvements we have made internally to facilitate unit testing our SMPP code.
Subject: Net-SMPP-1.19.diff
--- SMPP.pm.orig 2011-06-01 16:29:44.000000000 -0400 +++ SMPP.pm 2012-07-11 17:55:20.353422815 -0400 @@ -882,6 +882,7 @@ sub decode_submit_v34 { $len += 1 + 1 + 1 + 1 + 1; ($pdu->{short_message} # 18 ) = unpack "a$sm_length", substr($pdu->{data}, $len); + $pdu->{sm_length} = $sm_length; return $len + $sm_length; } @@ -1000,6 +1001,7 @@ sub decode_submit_v4 { $len += 2 + 1 + 1 + 1 + 2; ($pdu->{short_message} # 17 a ) = unpack "a$sm_length", substr($pdu->{data}, $len); + $pdu->{sm_length} = $sm_length; $len += $sm_length; warn "e decode_submit ($pdu->{short_message}) $len: ".hexdump(substr($pdu->{data}, $len)) if $trace; @@ -1314,7 +1316,7 @@ sub decode_submit_multi { = unpack 'Z*', substr($pdu->{data}, $len); $len += length($pdu->{destination_addr}[$i]) + 1; } else { - warn "Unknown multidest flag: $pdu->{dest_flag} (4.5.1.1, p. 75)"; + warn "Unknown multidest flag: $pdu->{dest_flag}[$i] (4.5.1.1, p. 75)"; } } @@ -1342,7 +1344,7 @@ sub decode_submit_multi { $len += 1 + 1 + 1 + 1 + 1; ($pdu->{short_message} # 18 ) = unpack "a$sm_length", substr($pdu->{data}, $len); - + $pdu->{sm_length} = $sm_length; return $len + $sm_length; } @@ -1484,12 +1486,13 @@ sub decode_submit_multi_resp { sub encode_submit_multi_resp { my $me = $_[0]; - my ($message_id, @dest_addr_ton, @dest_addr_npi, @destination_addr, + my ($message_id, $num_unsuccess, @dest_addr_ton, @dest_addr_npi, @destination_addr, @error_status_code, $addr_data); - + for (my $i=1; $i <= $#_; $i+=2) { next if !defined $_[$i]; if ($_[$i] eq 'message_id') { $message_id = splice @_,$i,2,undef,undef; } + elsif ($_[$i] eq 'no_unsuccess') { $num_unsuccess = splice @_,$i,2,undef,undef; } elsif ($_[$i] eq 'dest_addr_ton') { @dest_addr_ton = ref($_[$i+1]) ? @{scalar(splice @_,$i,2,undef,undef)} : (scalar(splice @_,$i,2,undef,undef)); @@ -1509,16 +1512,19 @@ sub encode_submit_multi_resp { } croak "message_id must be supplied" if !defined $message_id; - #croak "destination_addr must be supplied" if !@destination_addr; - croak "error_status_code must be supplied" if !@error_status_code; + + if ($num_unsuccess != 0) { + croak "destination_addr must be supplied" if !@destination_addr; + croak "error_status_code must be supplied" if !@error_status_code; - for (my $i = 0; $i <= $#destination_addr; $i++) { - my $ton = !defined($dest_addr_ton[$i]) ? ${*$me}{dest_addr_ton} : $dest_addr_ton[$i]; - my $npi = !defined($dest_addr_npi[$i]) ? ${*$me}{dest_addr_npi} : $dest_addr_npi[$i]; - $addr_data .= pack 'CCZ*N', $ton, $npi, $destination_addr[$i], $error_status_code[$i]; + for (my $i = 0; $i <= $#destination_addr; $i++) { + my $ton = !defined($dest_addr_ton[$i]) ? ${*$me}{dest_addr_ton} : $dest_addr_ton[$i]; + my $npi = !defined($dest_addr_npi[$i]) ? ${*$me}{dest_addr_npi} : $dest_addr_npi[$i]; + $addr_data .= pack 'CCZ*N', $ton, $npi, $destination_addr[$i], $error_status_code[$i]; + } } - - return pack('Z*C', $message_id, scalar(@destination_addr)) . $addr_data; + my $final = pack 'Z*CZ*', $message_id, $num_unsuccess, $addr_data; + return pack 'Z*CZ*', $message_id, $num_unsuccess, $addr_data; } #4#cut @@ -2414,6 +2420,11 @@ sub read_hard { $me->enquire_link(); # Send a periodic ping } else { if (!defined($n)) { + if ($! == 0) { + # getting a signal interrupts sysread, but we somehow get 0 + # and not EINTR, probably because perl is mucking with signals + next; + } warn "error reading header from socket: $!"; ${*$me}{smpperror} = "read_hard I/O error: $!"; ${*$me}{smpperrorcode} = 1; @@ -3220,7 +3231,8 @@ Response PDUs do not have separate async =item submit_multi_resp() (4.5.2, p.76) - $smpp->submit_multi_resp(message_id => $msg_id + $smpp->submit_multi_resp(message_id => $msg_id, # mandatory + no_unsuccess => 0x00, # default ok dest_addr_ton => [], # default ok dest_addr_npi => [], # default ok destination_addr => [], # mandatory