funbox/smppex

deliver_sm_resp sequence number

raulintosh opened this issue · 2 comments

I have this piece of code

def handle_pdu(pdu, st) do
sequence_number = Pdu.sequence_number(pdu)
case pdu |> SMPPEX.Pdu.command_id |> SMPPEX.Protocol.CommandNames.name_by_id do
{:ok, :deliver_sm} ->
Logger.info("PDU received: #{inspect pdu}")
Logger.info("Ingresa a deliver_sm")
Logger.info("SequenceNUmberReceived: #{inspect sequence_number}")
#{:ok, command_id} = CommandNames.id_by_name(:deliver_sm_resp)
deliver_sm_resp = Pdu.new({0x80000005,0,sequence_number})
#deliver_sm_resp = Pdu.Factory.deliver_sm_resp(0)
Logger.info("deliver_sm_resp #{inspect deliver_sm_resp}")
SMPPEX.ESME.send_pdu(self(), deliver_sm_resp)
responder(pdu, sequence_number+1)
st
_ ->
st
end
end

The deliver_sm_resp is not using the sequence_number assigned, and must be equal to deliver_sm sequence number. In the attached file PDU numbers are 133 and 134.

Your help will be apreciated.
Best regards

tcpdump201703221551.zip

Hello!

SMPPEX manages sequence ids itself. The intended way to send a reply is via SMPPEX.ESME.reply:

deliver_sm_resp = Pdu.Factory.deliver_sm_resp(0)
SMPPEX.ESME.reply(self(), pdu, deliver_sm_resp)

Thanks for your quick response. Works perfect.
Best regards.
Raul