The problem was solved as follows:
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; -------------- next part --------------
SMPP Throttling error processing
But this change does not affect the order in which parts of the composite message are sent. To fix this, you need to add a comparison by sms.id in the sms_priority_compare file in sms.id . When dividing a message into parts in sms_split this ID is generated using uuid_generate(part->sms.id) . The final sms_priority_compare function looks like this:
int sms_priority_compare(const void *a, const void *b) { int ret; Msg *msg1 = (Msg*)a, *msg2 = (Msg*)b; gw_assert(msg_type(msg1) == sms); gw_assert(msg_type(msg2) == sms); if (msg1->sms.priority > msg2->sms.priority) ret = 1; else if (msg1->sms.priority < msg2->sms.priority) ret = -1; else { if (msg1->sms.time > msg2->sms.time) ret = -1; else if (msg1->sms.time < msg2->sms.time) ret = 1; else { if (msg1->sms.id > msg2->sms.id) ret = -1; else if (msg1->sms.id < msg2->sms.id) ret = 1; else ret = 0; } } return ret; }