Can an SMPP Optional Parameter be sent from an SMPP Client bind?

Can an SMPP Optional Parameter be sent from an SMPP Client bind? SearchSearch
Author Message
marcia piccione
New member
Username: Mpiccione

Post Number: 9
Registered: 01-2012
Posted on Tuesday, July 24, 2012 - 10:48 am:   

I'm trying to send an optional parameter using an SMPP bind to the gateway (as opposed to an http request). Can I do this?

I'm getting the below error:

- [18f44a72-1d1c-43cb-900a-139b5a95c4be][SmsMtServiceImpl ] com.un.common.alarm.Message@1fb14e[messageId=2.1,type=APPLICATION,severity=CRITICAL,message=Error communicating with SMSC server]
ie.omk.smpp.message.tlv.BadValueTypeException: Tag 2150 expects a value of type class [B
at ie.omk.smpp.message.tlv.TLVTable.set(Unknown Source)
at ie.omk.smpp.message.SMPPPacket.setOptionalParameter(Unknown Source)
at com.un.messaging.impl.sms.service.mt.SmsMtServiceImpl._sendAsciiMessage(SmsMtSer viceImpl.java:229)
at com.un.messaging.impl.sms.service.mt.SmsMtServiceImpl.sendAsciiMessage(SmsMtServ iceImpl.java:171)


Using the following client code:

submitSM.setOptionalParameter(Tag.getTag(0x2150), getOperatorId(destination));

Using the following config:

[SMPPOptions]
SMPPOption_carrier_id=0x2150,Integer,2
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 4043
Registered: 08-2008
Posted on Tuesday, July 24, 2012 - 03:47 pm:   

Hi Marcia,

It is not possible to set a TLV parameter value in the actual SMPP bind operation.

But it is possible to set a default value for one or more TLV parameters in every message submit operation that occurs during a bind. (The HTTP request can override the default value.)

For your SMPPOptions config, do not use the "0x" prefix in the setting as NowSMS will not interpret that correctly.

For the correct setting, please refer back to our earlier discussion:

http://support.nowsms.com/discus/messages/1/71061.html

[SMPPOptions]
carrier_id=2150,Integer,2


If you wish to set a default value to be used for this parameter in SMPP message submit operations, that is also mentioned in that other link:


quote:

If you wanted to set a default value for this parameter when NowSMS submits a message, then you would add this setting to the [SMPP - server:port] section:

DefaultSMPPOptions=carrier_id=0




If that doesn't clarify things, then I need to see a packet from the SMPPDEBUG.LOG (or Wireshark) that shows the SMPP request that is generating the error. That will show us whether or not the TLV parameter referenced is present, and how it is encoded.

--
Des
NowSMS Support
marcia piccione
New member
Username: Mpiccione

Post Number: 10
Registered: 01-2012
Posted on Tuesday, July 24, 2012 - 04:14 pm:   

Thanks for the response. So, to confirm, if I want to send carrier id (dynamic for each request) from our application server to NowSms, I have to switch from using an smpp bind to http? There is a provision in the smpp client api to set an optional parameter, but it is not implemented in NowSms. Is that correct?
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 4045
Registered: 08-2008
Posted on Tuesday, July 24, 2012 - 05:09 pm:   

No, that is not correct.

The only information I have about your overall NowSMS configuration is what you tell me, so I often fill in the blanks based upon assumptions.

Based upon our previous discussions, all I know is that you are using an SMPP connection out from NowSMS.

I don't know how you submit messages to NowSMS. I assumed HTTP, but based upon your reply, I am now assuming SMPP.

To answer your most recent questions:


quote:

So, to confirm, if I want to send carrier id (dynamic for each request) from our application server to NowSms, I have to switch from using an smpp bind to http?




No, that is not correct. If submitting messages to NowSMS, you can include TLV when submitting HTTP or SMPP.

(TLV parameters are, of course, only relevant if NowSMS is sending out using an SMPP SMSC connection.)


quote:

There is a provision in the smpp client api to set an optional parameter, but it is not implemented in NowSms. Is that correct?




No, that is not correct.

So with this new information, let's go back to your original post on this thread:


quote:

I'm getting the below error:

- [18f44a72-1d1c-43cb-900a-139b5a95c4be][SmsMtServiceImpl ] com.un.common.alarm.Message@1fb14e[messageId=2.1,type=APPLICATION,severity=CRITICAL,message=Error communicating with SMSC server]
ie.omk.smpp.message.tlv.BadValueTypeException: Tag 2150 expects a value of type class [B
at ie.omk.smpp.message.tlv.TLVTable.set(Unknown Source)
at ie.omk.smpp.message.SMPPPacket.setOptionalParameter(Unknown Source)
at com.un.messaging.impl.sms.service.mt.SmsMtServiceImpl._sendAsciiMessage(SmsMtSer viceImpl.java:229)
at com.un.messaging.impl.sms.service.mt.SmsMtServiceImpl.sendAsciiMessage(SmsMtServ iceImpl.java:171)


Using the following client code:

submitSM.setOptionalParameter(Tag.getTag(0x2150), getOperatorId(destination));




I originally assumed that this error log was from an SMPP server to which NowSMS was submitting a message.

I now understand that this error log is from an SMPP client that is submitting a message to NowSMS.


My correction for the SMPPOptions setting still applies:


[SMPPOptions]
carrier_id=2150,Integer,2


However, the underlying error that you are experiencing has nothing to do with NowSMS.

It is an error from the Java library that you are using. This error would occur regardless of what SMPP server you are connecting to.

I have never used this Java library, but based upon what I have Googled, I believe that you need to call Tag.defineTag first to tell the Java library what the data type is for this parameter.

This is similar in concept to how you need to use the SMPPOptions setting in NowSMS to tell us about the parameter type being a 2-byte integer. The Java library also needs to be told that information.

How exactly you tell the Java library that, I don't know. I did find an example that might be helpful here:

http://sourceforge.net/projects/smppapi/forums/forum/84651/topic/5392199

You'd have to check with Wireshark to confirm the Java library is actually including the TLV parameter.

I *think* (but an not sure, as this outside the scope of our product support), that you would do something like this:

SubmitSM sm=new SubmitSM();
Tag tag=null;
if(!Tag.isTagDefined(0x2150))
{
tag=Tag.defineTag(0x2150, Short.class, null, 2);
}
else
{
tag=Tag.getTag(0x2150);
}
Short val=getOperatorId(destination);
sm.setOptionalParameter(tag, val);


I basically changed the other example to reference your TLV parameter tag (0x2150) and changed the type from Byte to Short (a 2-byte integer, which is what your provider expects).

You should refer to docs for the SMPP library that you are using for more specifics.

--
Des
NowSMS Support
marcia piccione
New member
Username: Mpiccione

Post Number: 11
Registered: 01-2012
Posted on Tuesday, July 24, 2012 - 09:23 pm:   

Thanks for going above and beyond. Just FYI, yes the lib was complaining about the data type. Turns out [B means byte array, so:

sms.setOptionalParameters(tag, String.valueOf(val).getBytes())

got past that particular error.

Either way, thanks for clearing up the misunderstanding in my second post.