1

I want send USSD messages via jsmpp. When I send message I get this error

org.jsmpp.extra.NegativeResponseException: Negative response 00000008 found
        at org.jsmpp.session.AbstractSession.validateResponse(AbstractSession.java:215)
        at org.jsmpp.session.AbstractSession.executeSendCommand(AbstractSession.java:271)
        at org.jsmpp.session.SMPPSession.submitShortMessage(SMPPSession.java:320)

Here is my code:

            int i = 2;
            short j = 2;
            OptionalParameter op1 = new OptionalParameter.Byte(Tag.USSD_SERVICE_OP, (byte) i);
            OptionalParameter op2 = new OptionalParameter.Byte(Tag.ITS_SESSION_INFO, (byte) j);
            OptionalParameter[] op = new OptionalParameter[2];

            op[0] = op2;
            op[1] = op1;

            messageId = session.submitShortMessage("USSD", TypeOfNumber.UNKNOWN,
                    NumberingPlanIndicator.UNKNOWN, sourceNumber, TypeOfNumber.UNKNOWN,
                    NumberingPlanIndicator.UNKNOWN, recipient, new ESMClass(142),
                    (byte) 0, (byte) 1, timeFormatter.format(new Date()), null,
                    new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS_FAILURE), (byte) 0,
                    DataCoding.newInstance(0),
                    (byte) 0, text.getBytes(), op);
totali
  • 260
  • 6
  • 22
  • Do you know NumberingPlanIndicator and TypeOfNumber for source and target phones? – szhem Feb 10 '12 at 20:02
  • I don't know TypeOfNumber, but NumberingPlanIndicator is ISDN – totali Feb 10 '12 at 20:06
  • Did you try to specify these params? TypeOfNumber should be INTERNATIONAL if your number is specified in international format, ABBREVIATED - if you have a short number, etc. – szhem Feb 10 '12 at 20:14
  • @mijer, when I am try with params ABBREVIATED, I get negative response 00000000a – totali Feb 10 '12 at 20:18
  • Could you show a sample for the source number, as 00000000a indicates that source number is invalid. – szhem Feb 10 '12 at 20:30
  • Source Number is 3 digit, sample 101. Destination number is 12 digit, sample 902121112233 – totali Feb 10 '12 at 20:32
  • [Here is](http://groups.google.com/group/jsmpp/msg/cc011357084d0ba3?dmode=source) the sample of ussd client. Could you try it with your original code (without modifications to TypeOfNumber) – szhem Feb 10 '12 at 20:48
  • I tried this code & response is negative response 00000008 – totali Feb 10 '12 at 20:54
  • 00000008 indicates a system error. Could you ask your smsc provider whether there errors on its side. – szhem Feb 11 '12 at 16:12

1 Answers1

3

The parameter ITS_SESSION_INFO in general is used to maintain a session, use

OptionalParameter op2 = null;
for (OptionalParameter optionalParameter : deliverSm.getOptionalParametes()) {
    if (optionalParameter.tag == Tag.ITS_SESSION_INFO.code()) {
       op2 = optionalParameter;
    }
}
int i = 2;
OptionalParameter op[] = new OptionalParameter[2];
OptionalParameter op1 = new OptionalParameter.Byte(Tag.USSD_SERVICE_OP, (byte) i);
op[0] = op1;
if (op2 != null) {
    op[1] = op2;
}
raulintosh
  • 31
  • 4