sojib321 / jsmpp

Automatically exported from code.google.com/p/jsmpp
Apache License 2.0
0 stars 0 forks source link

How to send Delivery Receipt Notification #56

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi All,

We are using TX to send SMS and RX for getting delivery response. SMS 
sending is working fine but what is happening with RX is that we get 1 
delivery receipt and it stops. Then on help of Shantanu we checked for 
state.isBound() and again connected to TX hence few delivery notifications 
are missed.

When we talked to Service provider they said that since we are not sending 
them delivery acknowledgement back; the session for RX is getting closed. I 
googled to get any sample or hint for the same but was unable to get that. 
They want us to send "0x80000005". On research I found this in 
SMPPConstants.CID_DELIVER_SM_RESP.

Please help me out for the same

-- 
Thanks and Regards,
Vikash Anand.

Original issue reported on code.google.com by premab...@gmail.com on 18 Nov 2009 at 11:17

GoogleCodeExporter commented 9 years ago
You didn't send deliver_sm_resp manually. jsmpp already done that for you.
The possible problem is when you implementing 
MessageReceiverListener#onAcceptDeliverSm(DeliverSm) you hold the method 
invocation takes too long so 
the response/deliver_sm_resp wait for your method done and it already pass the 
transaction time, so SMSC 
discard your response.
You can check this by capture TCP packet, analyze using wireshark and look for 
the existence of 
deliver_sm_resp.

Is there any exception or log?

Original comment by uuda...@gmail.com on 18 Nov 2009 at 4:40

GoogleCodeExporter commented 9 years ago
Hi uud I am stuck at a problem I used jsmpp and i have  successfully sent the 
msgs to the Mgs Broker and recieved the messageid but i am not able to receive 
smsc response of the mobile no! 
  My code is bellow !!!!!! I used bind type TRX  

In this class there is a method which has been called from another class !

public class ReceiverFromMsgBroker {

    public static void  receiverOfResponce (SMPPSession session) {
        System.out.println("Session Object"+session.toString());
        System.out.println("Responce Reading Start here !!!!!!!");
        BasicConfigurator.configure();  
        // Set listener to receive deliver_sm
        session.setMessageReceiverListener(new MessageReceiverListener(){
        public void onAcceptDeliverSm(DeliverSm deliverSm) throws ProcessRequestException {

            System.out.println("Trying to read DeliverSm if MB is sending back !!!!!!");
        if (MessageType.SMSC_DEL_RECEIPT.containedIn(deliverSm.getEsmClass())) {

            System.out.println("If messageType is SMSC_DEL_RECEIPT  !!!!!!");
        // delivery receipt
        try {
        DeliveryReceipt delReceipt = deliverSm.getShortMessageAsDeliveryReceipt();
        long id = Long.parseLong(delReceipt.getId()) & 0x80000005;
        String messageId = Long.toString(id, 16).toUpperCase();
        System.out.println("received '" + messageId + "' : " + delReceipt);
        } catch (InvalidDeliveryReceiptException e) {
              System.err.println("receive failed");
        e.printStackTrace();
        }
        } else {
        // regular short message
        System.out.println("Receiving message : " + new String(deliverSm.getShortMessage()));
        }
        }
        public void onAcceptAlertNotification(AlertNotification alertNotification) {
        System.out.println("onAcceptAlertNotification");
        }
        public DataSmResult onAcceptDataSm(DataSm dataSm, Session source) throws ProcessRequestException {
        System.out.println("onAcceptDataSm");
        return null;
        }
        });

    }
}

Original comment by sha2nkpa...@gmail.com on 16 Dec 2014 at 12:22