Binary SMS
Binary SMS can be
- ringtone
- image
- WML/WBXML
Inetlab.SMPP supports MMS notifications and WAP push messages.
Sending binary SMS
You can create any binary data and send it with the library
byte[] data = ByteArray.FromHexString("FFFF002830006609EC592F55DCE9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005C67");
var resp = await _client.SubmitAsync(
SMS.ForSubmit()
.From("short_code")
.To("436641234567")
.Data(data)
);
Some binary messages you may need to send on specific application port
for SubmitSm instance
submitSm.UserData.Headers.Add(new ApplicationPortAddressingScheme16bit(0x1579, 0x0000));
using SubmitSm SMS builder
builder.Set(sm =>
{
sm.UserData.Headers.Add(new ApplicationPortAddressingScheme16bit(0x1579, 0x0000));
});
Receiving binary SMS
Receive single binary message
private void OnClientDeliverSm(object sender, DeliverSm data)
{
byte[] messageBytes = data.GetMessageBytes();
string hexString = messageBytes.ToHexString();
}
Receive concatenated binary message
private readonly MessageComposer _composer = new MessageComposer();
private void WireEvents()
{
_client.evDeliverSm += OnDeliverSm;
_composer.evFullMessageReceived += OnFullMessageReceived;
}
private void OnDeliverSm(object sender, DeliverSm data)
{
_composer.AddMessage(data);
}
private void OnFullMessageReceived(object sender, MessageEventHandlerArgs args)
{
byte[] fullMessage = args.Parts.SelectMany(x => x.GetMessageBytes()).ToArray();
}