linxGnu / gosmpp

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

Not receiving optional Parameters even after assigning them in submit_sm. #146

Closed bluewithanas closed 4 months ago

bluewithanas commented 7 months ago

I want to assign some additional info text field and get the same while recieving submit_sm_resp and Deliver_SM. I am experimenting the possiblity of it but i have no idea how to unmarshal the response and get the optional parameters field.

reference:="any-xyz-string"
optionalData := pdu.Field{
        Tag:  pdu.TagAdditionalStatusInfoText,
        Data: []byte(reference),
    }

    submitSM.RegisterOptionalParam(optionalData)

I am doing this after submitSm.Message.SetMessageWithEncoding step.

P.S: I am not getting optionalParameter data in submit_SM_RESP & Deliver_SM. It's null/ blank inside the field.

Any example how to propely assign it and parse the response?

bluewithanas commented 7 months ago

Any help is much appreciated @tahseenjamal @linhduonggnu @linxGnu

bluewithanas commented 7 months ago

the thing I want to achieve by doing this is to get a refernece string in my messages callbacks so that i can submit the statistics accordingly. Now the providers can have multiple submit_SM_RESPs in case of long messages which is getting tricky to handle on application end.

If we can get some sort of reference string attached on submit_SM and could recieve it along submit_SM_RESPs and Deliver_SM, i would be saved :p

linxGnu commented 7 months ago

@bluewithanas I don't remember correctly about SMPP 3.4 Specs indicates that submit_sm_resp will retain submit_sm optional parameters.

No matter what, I highly recommend you to track everything by message_id. Before submitting submit_sm, you save (message_id, metadata) in any cache / key-value storage. Once receiving submit_sm_resp, you get those metadata from cache throughout the message_id key.

laduchesneau commented 5 months ago

@bluewithanas The code submitted in the PR #134 does exactly what you want. Look at this example transeiver_with_request_window_and_custom_submitSm.

You can technically add any type you want in the CustomPdu, like a messageId or even a channel, as long as the customPDU has a pdu.PDU type.

If you want to test the PR before it gets merged, you can add this line to your go.mod:

replace github.com/linxGnu/gosmpp v0.2.1 => github.com/laduchesneau/gosmpp add_window_setting
laduchesneau commented 4 months ago

This issue is resolved in the latest release.

tahseenjamal commented 4 months ago

@bluewithanas When you submit a message you have sequence number. Delivery response comes back with sequence number and message id

Later DLR has message id. So now you can the them with this approach