linxGnu / gosmpp

Smpp (3.4) Client Library for Go
Apache License 2.0
152 stars 59 forks source link

Pdu Event handler does not fire for non OK PDUs #117

Closed foxthedream closed 10 months ago

foxthedream commented 10 months ago

I have been testing with this library and purposefully sending to an SMSC using an unsupported encoding. The SMSC is sending back submit_sm_resp with submit_sm fail status. At no point is an event handler invoked. I have tried both OnAllPdu and OnPdu. Instead I see the connection being closed and a rebind happen.

I need to intercept that exception so that I can log it. Am I missing something?

laduchesneau commented 10 months ago

You should get a call on the OnClosed func when the bind is closed, if unbind is sent from the SMSC.

The submit_sm_resp should be sent to OnPdu or OnAllPdu.

foxthedream commented 10 months ago

Hi

I am getting a call on the OnClosed func. That's fine. But I am not getting a call on either OnPdu or OnAllPdu when the submit_sm_resp from the SMSC contains a non ESME_ROK command_status.

Also, I would argue that closing the bind on submit_sm_resp with a non ESME_ROK is the incorrect behaviour. If you submit with an invalid dest address or source address or some other issue then when the submit_sm_resp comes back in the bind gets closed. This is terrible for performance of the bind, the bind can be closed by the implementor.

foxthedream commented 10 months ago

The SMPP v3.4 spec does mention in the notes. _The submit_sm_resp PDU Body is not returned if the commandstatus field contains a non-zero value. The change you are referencing to not expect a message_id field I believe is correct.

linxGnu commented 10 months ago

Hi, could you please check if your issue still remains with latest v0.1.9.

Big kudos to @laduchesneau for great investigation and patch

foxthedream commented 10 months ago

Hi

I have pulled the latest and confirm it is working as expected.

Regards,

On Wed, 8 Nov 2023 at 11:14, Linh Tran Tuan @.***> wrote:

Hi, could you please check if your issue still remains with latest v0.1.9.

Big kudos to @laduchesneau https://github.com/laduchesneau for great investigation and patch

— Reply to this email directly, view it on GitHub https://github.com/linxGnu/gosmpp/issues/117#issuecomment-1801382652, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHYQWFJFH7SQSO23W2NRSYTYDNEPTAVCNFSM6AAAAAA67M6QHWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBRGM4DENRVGI . You are receiving this because you authored the thread.Message ID: @.***>