Kannel队列类型

时间:2016-05-26 12:48:29

标签: kannel

我已经从rpm包kannel-sw-1.4.3.3-6.rh5u3安装了kannel。做了一个简单的测试,比如逐个发送五条消息(" 1"," 2"," 3"," 4"和& #34; 5")通过http获取smsbox来处理限制错误。从SMSC方面,吞吐量是每分钟2个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

因此,结果中的顺序为&#34; 1&#34;,&#34; 2&#34;,&#34; 5&#34;,&#34; 3&#34;,&#34; 4& #34;而不是&#34; 1&#34;,&#34; 2&#34;,&#34; 3&#34;,&#34; 4&#34;,&#34; 5&#34;。 是否可以更改订单类型以尝试发送最后一条失败消息而不是链中的下一条消息? 在文档中我找到了sms-incoming-queue-limit选项。但是我不知道&#34;值0意味着对外发消息给予严格的优先权&#34;很遗憾,我不能很快进行测试。什么是严格优先级,队列\订单类型怎么样?

非常感谢。

2 个答案:

答案 0 :(得分:0)

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;
}

答案 1 :(得分:0)

我之前的回答是错误的。 orrect错误答案:

  1. sms_priority_compare中更改功能sms.c

    if (msg1->sms.time > msg2->sms.time)
            ret = 1;
    else 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 < msg2->sms.id)
            ret = 1;
        else
            ret = 0;           
    }
    
  2. smpp_status_to_smscconn_failure_reason中更改功能smsc/smsc_smpp.c

    static long smpp_status_to_smscconn_failure_reason(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;
    
            default:
                return SMSCCONN_FAILED_REJECTED;
        }
    }
    
  3. handle_pdusmsc/smsc_smpp.c)中更改功能case submit_sm_resp:

    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)));
    

    if (pdu->u.submit_sm_resp.command_status == SMPP_ESME_RTHROTTLED)
            time(&(smpp->throttling_err_time));
    else
            smpp->throttling_err_time = 0;    
    
    if (pdu->u.submit_sm_resp.command_status == SMPP_ESME_RMSGQFUL)
            time(&msg->sms.time);    
    
    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)));
    
  4. bb_smscconn_send_failed中更改功能bb_smscconn.c

           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);
           break;
    
  5. handle_split中更改功能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: