1

Whenever I try to submit a short message outside method onAcceptDeliverSm(DeliverSm deliverSm), I'm getting an exception. here is my code which is working:

 public void onAcceptDeliverSm(DeliverSm deliverSm)
        throws ProcessRequestException {
    try {
            String messageId = session.submitShortMessage("USSD", TypeOfNumber.NETWORK_SPECIFIC, NumberingPlanIndicator.PRIVATE, "420", TypeOfNumber.INTERNATIONAL, NumberingPlanIndicator.ISDN, msisdn, new ESMClass(),
                    (byte) 0, (byte) 1, timeFormatter.format(new Date()), null, new RegisteredDelivery(SMSCDeliveryReceipt.DEFAULT), (byte) 0, new GeneralDataCoding((byte) 15), (byte) 0, "Welcome.".getBytes(), new OptionalParameter.Byte(OptionalParameter.Tag.USSD_SERVICE_OP, (byte) 2));
        } catch (PDUException ex) {
            Logger.getLogger(MessageReceiverListenerImpl.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ResponseTimeoutException ex) {
            Logger.getLogger(MessageReceiverListenerImpl.class.getName()).log(Level.SEVERE, null, ex);
        } catch (InvalidResponseException ex) {
            Logger.getLogger(MessageReceiverListenerImpl.class.getName()).log(Level.SEVERE, null, ex);
        } catch (NegativeResponseException ex) {
            Logger.getLogger(MessageReceiverListenerImpl.class.getName()).log(Level.SEVERE, null, ex);
        } catch(IOException e) {

        }
}

The above code is working fine. But when i try to pass the parameters to another class, the submitsm is not working. :(

public void onAcceptDeliverSm(DeliverSm deliverSm)
        throws ProcessRequestException {
 Processor processor = new Processor(session, msisdn);
}

Processor Class :

Class Processor {

  public Processor(SMPPSession session, String msisdn)  {
    this.msisdn = msisdn;
    this.sessionid = sessionid;
    this.input = input;
    this.circle_id = circle_id;
    this.session = session;

 String messageId = session.submitShortMessage("USSD", TypeOfNumber.NETWORK_SPECIFIC, NumberingPlanIndicator.PRIVATE, "420", TypeOfNumber.INTERNATIONAL, NumberingPlanIndicator.ISDN, msisdn, new ESMClass(),
                (byte) 0, (byte) 1, timeFormatter.format(new Date()), null, new RegisteredDelivery(SMSCDeliveryReceipt.DEFAULT), (byte) 0, new GeneralDataCoding((byte) 15), (byte) 0, input.getBytes(), new OptionalParameter.Byte(OptionalParameter.Tag.USSD_SERVICE_OP, (byte) 2));

}
}

Please tell me where the problem is? Thanks All

sree127
  • 421
  • 3
  • 9
  • 25
  • 1
    To send USSD data you have to use a TLV (Tag-Length-Value) parameter. TLV parameters were added to version 3.4 of the SMPP protocol to extend the protocol with enhanced features. – totali Jan 16 '13 at 09:07
  • 1
    Can you please share what was wrong in your code? – ImranRazaKhan Jun 24 '14 at 13:41

0 Answers0