komuw / naz

naz is an async SMPP client.
https://komuw.github.io/naz/
MIT License
39 stars 12 forks source link

Receiving incoming messages #219

Closed niksabaldun closed 2 years ago

niksabaldun commented 2 years ago

Hello,

as far as I can see, documentation is all about sending outgoing messages to SMSC. I can't see how to receive incoming messages from SMSC. I suppose it could be done using hooks, but isn't there a high-level API for this?

komuw commented 2 years ago

Hi,

The smsc can send responses to the client at any point(asynchronously). Thus the client cannot synchronously ask to receive messages from smsc. The client has to run in a loop, try and read from smsc, sleep, retry and so on.

All this means that you have to use hooks: https://github.com/komuw/naz#22-hooks

komuw commented 2 years ago

I'll close this issue; you can re-open it if you deem it necessary.

niksabaldun commented 2 years ago

Just to make sure, there is no existing function to extract message text and other info from deliver_sm PDU? I have to implement it myself?

komuw commented 2 years ago

@niksabaldun

When naz receives a deliver_sm pdu from SMSC;

Note that in the call to the hook, we also pass in the full pdu. So if you want, you could parse that pdu again in your hook. But naz has already parsed it and done the neccesary. But nothing stops someone from parsing the pdu again in their hook and doing anything they want with it.

I hope that answers your question.

niksabaldun commented 2 years ago

OK, but as far as I can see, the PDU is only partially parsed. Naz does not extract and decode short_message/message_payload parts of the PDU. That was my question.

komuw commented 2 years ago

Yeah, naz does not parse those.

On Fri, Oct 21, 2022, 2:53 PM niksabaldun @.***> wrote:

OK, but as far as I can see, the PDU is only partially parsed. Naz does not extract and decode short_message/message_payload parts of the PDU. That was my question.

— Reply to this email directly, view it on GitHub https://github.com/komuw/naz/issues/219#issuecomment-1286857116, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHMWUOUBTEK47WGYJIYQZLWEJ72ZANCNFSM6AAAAAARDAPYEQ . You are receiving this because you modified the open/close state.Message ID: @.***>

niksabaldun commented 2 years ago

OK, so the library is mostly oriented on sending, with receiving part largely neglected. If I implement full parsing of deliver_sm PDU, would you consider accepting a pull request?

niksabaldun commented 2 years ago

I just wanted to add deliver_sm parsing, but while doing so, I've encountered other problems so I ended up rewriting half of the library. There is no point in making a pull request, especially since development of naz seems to be stalled. I'll just maintain my own fork under a different name.

komuw commented 2 years ago

Hi.

development of naz seems to be stalled.

Yeah, I started naz years back when I used to work with SMSC/smpp on a daily basis. I no longer do so. But there are other people who do use it daily and it serves them well.

I'll just maintain my own fork

You have my blessings. And I'm glad naz has given you a foundation on which to start with.

On Sun, Oct 30, 2022, 6:59 PM niksabaldun @.***> wrote:

I just wanted to add deliver_sm parsing, but while doing so, I've encountered other problems so I ended up rewriting half of the library. There is no point in making a pull request, especially since development of naz seems to be stalled. I'll just maintain my own fork under a different name.

— Reply to this email directly, view it on GitHub https://github.com/komuw/naz/issues/219#issuecomment-1296290571, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHMWUIE2JMOFGMVBL6PKEDWF2EOHANCNFSM6AAAAAARDAPYEQ . You are receiving this because you modified the open/close state.Message ID: @.***>

niksabaldun commented 2 years ago

It works well as long as certain conditions are met. For example, in many countries, it is the norm to include receipted message ID in deliver_sm text (stupid, but it is what it is). So you have to fully parse deliver_sm for correlation, which naz doesn't do. Nevertheless, it's a good piece of software, and you have my thanks for it.