Delivery notification not working

Aug 23, 2013 at 2:54 PM
I have following code:
SmppConnectionProperties properties = client.Properties;
properties.SystemID = Config.User;
properties.Password = Config.Password;
properties.Port = int.Parse(Config.Url.Split(':')[1]); //IP port to use
properties.Host = Config.Url.Split(':')[0]; //SMSC host name or IP Address
properties.InterfaceVersion = InterfaceVersion.v34;
properties.SystemType = "SMPP";
properties.DefaultServiceType = "SMPP";
properties.DefaultEncoding = DataCoding.SMSCDefault;

//Resume a lost connection after 30 seconds
client.AutoReconnectDelay = 3000;

//Send Enquire Link PDU every 15 seconds
client.KeepAliveInterval = 15000;


client.MessageDelivered += new EventHandler<MessageEventArgs>(client_MessageDelivered);
client.MessageSent += new EventHandler<MessageEventArgs>(client_MessageSent);
client.ConnectionStateChanged += client_ConnectionStateChanged;
client.MessageReceived += new EventHandler<MessageEventArgs>(client_MessageReceived);

client.Start();

TextMessage msg = new TextMessage();

msg.DestinationAddress = message.MSISDN;
msg.SourceAddress = Config.MessageSource;
msg.Text = message.Text;
msg.RegisterDeliveryNotification = true;


client.SendMessage(msg);
}
void client_MessageDelivered(object sender, MessageEventArgs e)
{
    Logger.GetLogger().Debug("Message delivered " + e.ShortMessage.SequenceNumber);
}
But the delivery notification is not working (client_MessageDelivered is never called). In fact, inspecting network traffic with wireshark showed me, that Deliver_sm is actually executed.
Short Message Peer to Peer, Command: Deliver_sm, Seq: 4, Len: 165
Length: 165
Operation: Deliver_sm (0x00000005)
Sequence #: 4
Service type: (Default)
Type of number (originator): International (0x01)
Numbering plan indicator (originator): ISDN (E163/E164) (0x01)
Originator address: <mynumber>
Type of number (recipient): International (0x01)
Numbering plan indicator (recipient): ISDN (E163/E164) (0x01)
Recipient address: 44444
.... ..00 = Messaging mode: Default SMSC mode (0x00)
..00 01.. = Message type: Short message contains SMSC Delivery Receipt (0x01)
00.. .... = GSM features: No specific features selected (0x00)
Protocol id.: 0x00
Priority level: GSM: None      ANSI-136: Bulk         IS-95: Normal (0x00)
Scheduled delivery time: Immediate delivery
Validity period: SMSC default validity period
.... ..00 = Delivery receipt: No SMSC delivery receipt requested (0x00)
.... 00.. = Message type: No recipient SME acknowledgement requested (0x00)
...0 .... = Intermediate notif: No intermediate notification requested (0x00)
.... ...0 = Replace: Don't replace (0x00)
Anyone can explain this?

m.
Mar 6, 2014 at 7:48 AM
Hello, i have the same problem. MessageDelivered event does't fire up!


Please leave a comment.
Apr 29, 2014 at 12:10 PM
Hi! I have the same problem. MessageDelivered and MessageReceived. Please HELP!!.
May 12, 2014 at 10:01 AM
Hi! Seems to be a bug. vote
Nov 27, 2014 at 7:49 AM
Hi! I have same problem with delivery notification (client_MessageDelivered is never called). The bug I fixed it (in EsmClass.cs I set DeliveryReceipt = (byte) 4), but still not working. Any idea?
I have following code:
            static SmppClient client = new SmppClient();            
            client.AutoReconnectDelay = 3000;
            client.KeepAliveInterval = 15000;

            SmppConnectionProperties properties = client.Properties;
            properties.SystemID = "systemId";
            properties.Password = "password";
            properties.Port = 8000;
            properties.Host = "hostIP"; 
            properties.SystemType = "";
            properties.DefaultServiceType = ServiceType.DEFAULT;
            properties.InterfaceVersion = InterfaceVersion.v34;
            properties.AddressTon = TypeOfNumber.Unknown;
            properties.AddressNpi = NumberingPlanIndicator.Unknown;
            properties.DefaultEncoding = DataCoding.SMSCDefault;

            client.ConnectionStateChanged += client_ConnectionStateChanged;
            client.MessageSent += client_MessageSent;
            client.MessageReceived += client_MessageReceived;
            client.MessageDelivered += client_MessageDelivered;

            try
            {
                client.Start();
            }
            catch (SmppBindException ex)
            {
                Console.WriteLine(ex.ErrorCode + " " + ex.Message);
            }
            catch (InvalidOperationException ex)
            {
                Console.WriteLine(ex.Message);
            }
            catch (TcpIpException ex)
            {
                Console.WriteLine(ex.Message);
            }

            static TextMessage msg = new TextMessage();
            msg.DestinationAddress = destinationAddress;
            msg.SourceAddress = "sourceAddress"; 
            msg.Text = "Hello";
            msg.RegisterDeliveryNotification = true;
            
            client.SendMessage(msg);


        private static void client_ConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e)
        {
            switch (e.CurrentState)
            {
                case SmppConnectionState.Closed:
                    Console.WriteLine("Closed");
                    e.ReconnectInteval = 60000;
                    break;
                case SmppConnectionState.Connected:
                    Console.WriteLine("Connected");
                    break;
                case SmppConnectionState.Connecting:
                    Console.WriteLine("Connecting");
                    break;
            }
        }

        private static void client_MessageSent(object sender, MessageEventArgs e)
        {
            Console.WriteLine("Sent");
        }

        private static void client_MessageReceived(object sender, MessageEventArgs e)
        {
            Console.WriteLine("Received");
        }

        static void client_MessageDelivered(object sender, MessageEventArgs e)
        {
            Console.WriteLine("Delivered");
        }
Apr 3, 2015 at 5:47 AM
Edited Apr 3, 2015 at 6:12 AM
Hello guys!

Maybe I found solution. At least, it works for me.

The root of problem is in function BuildTable() in file JamaaTech.SMPP.Net.Lib\Util\SmscDefaultEncoding.cs

When it tries to fill the table vDefaultReverseTable, in some cases it tries to set incorrect records. So I just replace
            for (index = 0; index < vDefaultForwardTable.Length; &#43&#43index)
            {
                    vDefaultReverseTable[vDefaultForwardTable[index]] = (byte)index;
            }
with
            for (index = 0; index < vDefaultForwardTable.Length; &#43&#43index)
            {
                try
                {
                    vDefaultReverseTable[vDefaultForwardTable[index]] = (byte)index;
                }
                catch { }
            }
And of course don`t forget to correct the value of DeliveryReceipt in file JamaaTech.SMPP.Net.Lib\Protocol\EsmClass.cs
DeliveryReceipt = 0x04.
But maybe it differs in different operators. Check what you get with Wireshark.