SMPP Throttling error processing

Anton Virchenko <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hi all,

I've noticed that after receiving SMPP throttling error 0x58 the message
that hit the limit is moved to the end of the outgoing_sms queue
via bb_smscconn_send_failed() in bb_smscconn.c.
I suggest to keep it in the msgs_to_send queue with the same parameters as
before the error occurred to have it processed first after the throttling
condition is over.

I did the following patch to smsc/smsc_smpp.c in "case submit_sm_resp:"
section from line 1609:
change
***
if (pdu->u.submit_sm_resp.command_status == SMPP_ESME_RTHROTTLED)
    time(&(smpp->throttling_err_time));
else
    smpp->throttling_err_time = 0;

bb_smscconn_send_failed(smpp->conn, msg, reason, octstr_format("0x%08lx/%s",
pdu->u.submit_sm_resp.command_status,

 smpp_error_to_string(pdu->u.submit_sm_resp.command_status)));
***
to
***
if (pdu->u.submit_sm_resp.command_status == SMPP_ESME_RTHROTTLED) {
    time(&(smpp->throttling_err_time));
    /* Put the message back into the SMPP queue */
    gw_prioqueue_produce(smpp->msgs_to_send, msg);
} else {
    smpp->throttling_err_time = 0;
    bb_smscconn_send_failed(smpp->conn, msg, reason,
octstr_format("0x%08lx/%s", pdu->u.submit_sm_resp.command_status,
        smpp_error_to_string(pdu->u.submit_sm_resp.command_status)));
}
***

and in sms.c I have changed the function sms_priority_compare() to reverse
time sorting order (for some reason it was LIFO):
if (msg1->sms.time > msg2->sms.time)
    ret = -1;
else if (msg1->sms.time < msg2->sms.time)
    ret = 1;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.