2016-05-26 78 views
0

我已經從rpm包kannel-sw-1.4.3.3-6.rh5u3中安裝了kannel。做了一個簡單的測試,例如發送一個接一個五個消息(「1」,「2」,「3」,「4」和「5」)到http上的smsbox以獲取處理調節錯誤。從SMSC方面來看,吞吐量是每分鐘2個SMS。我有望獲得短信順序如下: 「1」 「2」 「3」 「4」 「5」 但在日誌Kannel的SMPP和轉儲我有流量,如:Kannel隊列類型

> "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意味着嚴格優先於傳出消息」是什麼意思,不幸的是我不能很快運行測試。什麼是嚴格的優先級和隊列\訂單類型?

非常感謝。

回答

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

我以前的答案是錯誤的。 Сorrect答案:

  1. 更改功能sms_priority_comparesms.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_reasonsmsc/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.ccase 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_failedbb_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_splitbb_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: