youngj / EnvayaSMS

Simple SMS and MMS gateway running on Android
http://sms.envaya.org
Other
161 stars 177 forks source link

ignoring duplicated message ID in a period of time #15

Closed magixbox closed 12 years ago

magixbox commented 12 years ago

At the moment, EnvayaSMS will send ANY SMS grabbed from the server, even if it is duplicated (with the same ID seeded before). Might need a short term tracking on these IDs (say for 10 minutes) and ignore SMS with the same ID. This is to prevent the server reseeding the same ID due to network interruption or any transmission issue.

youngj commented 12 years ago

The current behavior is for EnvayaSMS to ignore duplicate IDs for outgoing messages that have not been sent yet. After a message is sent, EnvayaSMS notifies the server via a action=send_status request. When the server receives an action=send_status request with status=sent, the server should remove the outgoing SMS from its queue so that future calls to action=outgoing don't return that SMS message anymore. Is it possible to do that for your implementation?

magixbox commented 12 years ago

We do honor the "send_status" given by EnvayaSMS and update our status accordingly. Duplicated seeding from our server in this case isn't really an issue - as we have marked all the message once EnvayaSMS has polled them.

However, the server will reseed the same SMS when the "send_status" didn't reach the server for a period of time - to ensure the message has indeed relayed to EnvayaSMS.

That is why we would like to make sure EnvayaSMS to ignore these duplicate seeding if the SMS is already in the queue for whatever reason.

So it seems such handling is already in place.....

youngj commented 12 years ago

OK that makes sense. I think instead of having an arbitrary time limit, it should just ignore all duplicate message IDs until EnvayaSMS restarts or the server URL changes.

magixbox commented 12 years ago

You scare me... If you keep track of all the message IDs, aren't that going to occupied some resources?

But again, most Android phone has plenty of storage space anyway.

youngj commented 12 years ago

Yeah, I guess it would be better if they expire eventually to avoid filling up the phone memory in case the app stays running for several months.

youngj commented 12 years ago

Implemented in c18a28b1be72ddef4768cd24cb0939d4dd797ada (2.0.4); avoids sending message if server ID among last 100 SMS messages that were successfully sent.