我已经从rpm包kannel-sw-1.4.3.3-6.rh5u3安装了kannel。我做了一个简单的测试,比如通过http get将5条消息(“1”、"2“、"3”、"4“和"5")逐个发送到smsbox,以处理节流错误。SMSC侧的吞吐量为每分钟2个SMS。我期望以以下顺序得到sms:"1“"2”"3“"4”"5“,但在kannel日志和SMPP转储中,我得到的流程如下:
> "1"
< ok
> "2"
< ok
> "3"
< throttling error
#first timeout less than 1 minute according config
> "4"
< throttling error
#second timeout less than 1 minute according config, but in sum with first more than 1 minute
> "5"
< ok
> "3"
< ok
> "4"
< throttling error
and so on因此,结果中的顺序是"1“、"2”、"5“、"3”、"4",而不是"1“、"2”、"3“、"4”、"5“。是否可以更改订单类型以尝试发送最后一个失败消息,而不是链中的下一个失败消息?在文档中,我找到了sms-incoming queue-limit选项。但我不知道“值为0意味着对传出消息给予严格的优先级”是什么意思,不幸的是,我不能很快运行测试。什么是严格优先级,队列\顺序类型是什么?
非常感谢。
发布于 2016-11-11 16:40:50
SMPP Throttling error processing
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 --------------复合SMS部件的排序基于它们的sms.id的附加比较。
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;
}发布于 2017-01-19 16:22:20
我之前的回答是错误的。С或正确答案:
sms_priority_compare in sms.c:if (msg1->sms.time > msg2->sms.time) ret = 1;否则if (msg1->sms.time < msg2->sms.time) ret = -1;
至
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 ->sms.id) ret = 1;else ret = 0;}
smpp_status_to_smscconn_failure_reason in smsc/smsc_smpp.c:静态长状态( long status) { switch(status) { case SMPP_ESME_RMSGQFUL: case SMPP_ESME_RTHROTTLED: case SMPP_ESME_RX_T_APPN: case SMPP_ESME_RSYSERR: return SMSCCONN_FAILED_TEMPORARILY;break;default: return SMSCCONN_FAILED_REJECTED;}}
至
static long smpp_status_to_smscconn_failure_reason(long status) { switch(status) { case SMPP_ESME_RMSGQFUL: case SMPP_ESME_RX_T_APPN: case SMPP_ESME_RSYSERR: return SMSCCONN_FAILED_TEMPORARILY;break;case SMPP_ESME_RTHROTTLED: return SMPP_ESME_RTHROTTLED;break;默认值: return SMSCCONN_FAILED_REJECTED;} }
handle_pdu in smsc/smsc_smpp.c (case submit_sm_resp:):if (pdu->u.Submit_sm_res.command_status == SMPP_ESME_RTHROTTLED) time(&( smpp->throttling_err_time ));否则smpp->throttling_err_time= 0;提交( smpp_error_to_string(pdu->u.submit_sm_resp.command_status)));->conn,msg,bb_smscconn_send_failed,octstr_format("0x%08lx/%s",pdu->u.Submit_sm_res.command_status,smpp
至
if (pdu->u.Submit_sm_res.command_status == SMPP_ESME_RTHROTTLED) time(&( smpp->throttling_err_time ));else smpp->throttling_err_time= 0;if (pdu->u.Submit_sm_res.command_status == SMPP_ESME_RMSGQFUL) time(&msg->sms.time);提交(smpp->conn,msg,bb_smscconn_send_failed,octstr_format("0x%08lx/%s",pdu->u.Submit_sm_res.command_ bb_smscconn_send_failed,bb_smscconn.c中的smpp函数状态:
case SMSCCONN_FAILED_TEMPORARILY:...gwlist_produce(outgoing_sms,sms);break;case SMSCCONN_FAILED_SHUTDOWN: gwlist_produce(outgoing_sms,sms);break;
至
case SMSCCONN_FAILED_TEMPORARILY:...gwlist_produce(outgoing_sms,sms);break;case SMPP_ESME_RTHROTTLED: gwlist_insert(outgoing_sms,0,sms);break;case SMSCCONN_FAILED_SHUTDOWN: gwlist_produce(outgoing_sms,sms);case function handle_split in bb_smscconn.c:
case SMSCCONN_FAILED_TEMPORARILY:...gwlist_produce(outgoing_sms,msg);break;case SMSCCONN_FAILED_DISCARDED:
至
case SMSCCONN_FAILED_TEMPORARILY:...gwlist_produce(outgoing_sms,msg);break;case SMPP_ESME_RTHROTTLED: gwlist_insert(outgoing_sms,0,msg);break;case SMSCCONN_FAILED_DISCARDED:
https://stackoverflow.com/questions/37461349
复制相似问题