Search code examples
c++smpp

SMPP client is adding an ¿ to the end of the message


I'm trying to make a Windows desktop smpp client, and it's connecting and sending well, aside from a bug where an extra character (¿) is added to the end of the message content that I'm receiving on my phone.

So I'm sending "test" but my phone receives "test¿". Here's the contents of the pdu object, just before it gets sent:

size      :58
sequence  :2
cmd id    :0x4
cmd status:0x0 : No Error
00000000  00 00 00 3a 00 00 00 04  00 00 00 00 00 00 00 02  |...:............|
00000010  00 05 00 74 65 73 74 66  72 6f 6d 00 01 01 34 34  |...testfrom...44|
00000020  37 37 37 37 37 37 37 37  37 37 00 00 00 00 00 00  |7777777777......|
00000030  00 00 00 00 05 74 65 73  74 00                    |.....test.|
0000003a

I'm using this c++ smpp library as a base:

https://github.com/onlinecity/cpp-smpp

I had to make some slight changes to get it working on windows, but I don't think anything was changed that could have affected this.

Someone else ran a test using a different account on the smpp server, and their test added an @ symbol instead.

Any ideas what could be causing this? Thanks!


Solution

  • Found the problem in the end, it was due to an option in the smpp library that defaults to true, called nullTerminateOctetStrings

    It was adding the 00 to the end of the message, sound slike this was required by the SMPP 3.4 standards, but our smsc didn't like it. I suppose ideally I would fix the smsc, but that's provided by a 3rd party, so I've just switched off the null terminate instead.

    Someone with a similar problem and more info here: https://www.mail-archive.com/[email protected]/msg06765.html