Subject: | in SMSC mode, the additional parameters are not properly obtained from decode_optional_params() |
I am testing the following scenario:
1 - I am running the smsc.pl that comes with the module
2 - I have a kannel installation that is connected to the smsc.pl
3 - I attempt to send a long (concatenated) message from the kannel to
the the smsc
4 - From the kannel log, I can see the "more_messages_to_send = 1" is
send as well with the first of the two messages (the second message does
not have "more_messages_to_send" since it is the last one)
5 - here is how the smsc.pl debug looks like for the first message (the
one that has more_messages_to_send):
$VAR1 = bless( {
'source_addr_ton' => 5,
'known_pdu' => 1,
'schedule_delivery_time' => '',
'protocol_id' => 0,
'status' => 0,
'short_message' => 'message 1 message 1 message 1
message 1 message 1 message 1 message 1 message 1 message 1 message 1
message 1 message 1 message 1 message 1 message 1 mes',
'dest_addr_npi' => 1,
'source_addr' => 'kamen',
'validity_period' => '',
'registered_delivery' => 1,
'dest_addr_ton' => 2,
'seq' => 91,
'data_coding' => 0,
'service_type' => '',
'replace_if_present_flag' => 0,
'cmd' => 4,
'priority_flag' => 0,
'data' => 'kamen359883409291Câ–’message 1 message 1
message 1 message 1 message 1 message 1 message 1 message 1 message 1
message 1 message 1 message 1 message 1 message 1 message 1 mes&',
'destination_addr' => '359883409291',
'esm_class' => 67,
'more_messages_to_send' => '',
'1062' => '',
'sm_default_msg_id' => 0,
'source_addr_npi' => 0,
'reserved' => undef
}, 'Net::SMPP::PDU' );
As you can see 'more_messages_to_send' and '1062' are empty.
Looking on my perl/5.10.0/Net/SMPP.pm I see the following:
sub decode_optional_params {
...
...
my ($val) = unpack "a$len", substr($pdu->{data}, $offset+4);
This is where the $val is not properly obtained.
The way I got that fixed is:
my ($val) = ($tag == 1062) ? unpack 'CCZ*', substr($pdu->{data},
$offset+4) : unpack "a$len", substr($pdu->{data}, $offset+4);
However, I am not sure if that is the best possible fix here, but at
least, it works :)