Hi,
I have cleaner approach with MySql db.
All incoming messages are queued in mt_sms_queue where status is 0 (ready ).
GW process (bound in TR mode ) with SMSC polls mt_sms_queue based on status 0, on submit_sm , SMSC retruns submit_sms_resp decode message id update message id in mt_sms_queue and status =1 , same time make one entry in delivery_report_queue with all required details (msg id, SENDER, RECEIVER, SUB DATE) with dl_status =-1.
GW process (bound in RX mode) with SMSC polls on receiver connected socked on receiving deliver_sm smpp pdu it decides message id , DONE DATE, SUB DATE, ERR, STATUS form delivery report and update delivery_report_queue with received message id and dlr_status to 1 (ready) also same time mt_sms_queue status is changed to 3 (message is processed) and it will move to sms_queue table for reporting purpose. similary when dlr are forwarded to ESME or HTTP client dlr_status is changed to 3 so that dlr record will be moved to delivery_report.
With above approach SMPP session will be preserved and no need to connect everytime on arriving of messages on queue. In short TR and RX smpp process will be running independently in background for each SMPP connection.
And These TR and RX process will be monitored by cron jobs to make sure 24/7 uptime with SMSC.
If you are not willing to use MySql then I will look into your code to use Redis resource for queuing.
Let me know your opinion.
Thanks,
Sasdin
If you are not willing to use MySQL then I