deepakjeena / jsmpp

JAVA based SMPP protocol
Apache License 2.0
0 stars 0 forks source link

Sending Arabic SMS failed. (submit_sm failed) #158

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I have an application which is intended to send both English and Arabic SMS. I 
am able to send English SMS both Arabic SMS is rejected by SMSC with error code 
 0x0000045. (submit_sm failed). I fetch the Arabic and English SMSs from 
database. 

String message = new String(resultSet.getString("text").getBytes("UTF-8")) and 
then send it to the following function to differentiate between Arabic and 
English SMS and set the parameters accordingly. 

  if (isEncodeableInGsm0338(message)) {
            byteSingleMessage = messageBody.getBytes();
            alphabet = Alphabet.ALPHA_DEFAULT;
        } else {
            byteSingleMessage = messageBody.getBytes("UTF-16BE");
            alphabet = Alphabet.ALPHA_UCS2;
        }

and submit_sm is somethig like this...

submitShortMessage("", TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN,
                    sourceMsisdn, TypeOfNumber.UNKNOWN, NumberingPlanIndicator.ISDN, destinationMsisdn,
                    esmClass, (byte) 0, (byte) 1, null, null, new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS_FAILURE),
                    (byte) 0, new GeneralDataCoding(false, false, MessageClass.CLASS1, alphabet), (byte) 0,  byteSingleMessage);

This function throws NegativeResponseException with error code 45 if it is 
Arabic SMS. Where am I wrong ? Any help would be appreciated. Its really urgent.

Original issue reported on code.google.com by sikander...@expertflow.com on 12 May 2014 at 7:56

GoogleCodeExporter commented 9 years ago
I am using SQL Server and the type of "text" field is "nvarchar" as SQL Server 
does not support "UTF-8". I read the message from database using "UTF-8" and 
than get its bytes using "UTF-16BE". Is this the issue and I am doing wrong 
something else ?

Original comment by sikander...@expertflow.com on 12 May 2014 at 7:59