2014-02-21 26 views
1

不來我使用節點SMPP,我能夠發送短信到我的電話號碼,但我無法得到送達回執它交付與否。請參考我下面的代碼SMPP送達回執響應在節點SMPP

可以請你指導,如果出了什麼差錯

var smpp = require('smpp'); 
var session = smpp.connect('103.250.30.x', 51612); 

session.bind_transceiver({ 
    system_id: 'makesms1', 
    password: '[email protected]' 
}, function(pdu) { 
    if (pdu.command_status == 0) { 
    // Successfully bound 
    console.log('bound bind_transceiver') 
    session.submit_sm({ 
     destination_addr: '90000541x0', 
     short_message: new Buffer("Hi, Froxtel interview SMS/email has been sent by company only. Its not any related to freshersworld. U can contact directly company or call 08688805062/3.Please ignore the word freshersworld in sms/mail.regards Froxtel team.","utf8"), 
     source_addr:'FROXTL', 
     registered_delivery:1, 
     data_coding:0, 

    }, function(pdu) { 

     if (pdu.command_status == 0) { 
      // Message successfully sent 
      console.log(JSON.stringify(pdu)); 



     } 
    }); 
} 
}); 

當我使用矮個子的NodeJS模塊它的工作很好,我能夠獲得送達回執。但我無法發送長信息。

我應該使用data_sm長消息或其他?

回答

2

您的代碼看起來不錯發送和處理您的傳出請求的響應。

送貨單從SMPP服務器使用DELIVER_SM pakets發送到客戶端,因此,你需要註冊一個事件處理程序:

session.on('deliver_sm', function(pdu) { 
    console.log(pdu.short_message); 
    session.send(pdu.response()); 
}); 
+0

感謝這個解決方案! :d – mzalazar