This project is read-only.

How do I get SMS id using SmppClient

Oct 6, 2011 at 2:42 PM

it is my understanding that every time that an SMS is sent to the SMPP gateway, it assigns a unique ID to that message.

is there a way to get this ID using the SmppClient or any of its components?


Oct 7, 2011 at 5:01 AM


I am not sure I understood your question. Perhaps, could you elaborate what exactly you are trying to achieve?


Oct 7, 2011 at 1:46 PM

hi, sorry for my poor details.

The SMSC to which I'm connected, has a method for retrieving the status of a given message; I mean, once the client have successfully submitted n SMS to the SMSC, my understanding is that in the response the SMSC assigns a unique ID to that message; and this ID can be used later on for asking the status of the message (if it has expired, if it has beeen delivered, etc)

This behaviour is pretty much the same as implementing the callback method as provided by SMsClient.

SmppClient client = GetSmppClient();
client.MessageDelivered += client_MessageDelivered;


void client_MessageDelivered(object sender, MessageEventArgs

e) {
TextMessage msg = e.ShortMessage as TextMessage ; }


 My problem is that when i get the response, I can not identify univocally the message by any combination of the textMessage parameters (eg: text and destination #) because in my case, I may send two identical messages to the same destination from the same source.

so I wander if I can get somehow this ID from any of the PDUs of the response.

Checking the Jamaa code I noticed that SmsClient is just a wrapper for the underline Jamaa Lib, which is the one that does the real implementation, so I made the following changes.

1. I override the method SmsClient.SendMessage to return de ResponsePDU


ResponsePDU SendMessage(ShortMessage message, int timeOut,bool p2) {....} 

2. when I call the method and actually get a response from the SMSC,

ResponsePDU resp = _smppClient.SendMessage(msg, false



I do the following check in order to get that message ID.

if (resp !=null)

Smsid = ((SubmitSmResp)resp).MessageID;
}catch (InvalidCastException ) {}

So, in this way I get the ID of the message and can use it for further reference.

I would like to know if this is the right way of doing this or is there another way to get this messageID

thaks a lot for your prompt response.

Oct 7, 2011 at 3:33 PM


That's definitely what you are supposed to do!

Just let me know if you experience any problem or need additional support.

As we are closing on releasing a stable version, it would be very helpful to learn about your experience with Jamaa SMPP Client. Please share with us your views on areas that you

think need improvements.

Thank you for showing interest in Jamaa SMPP Client.


Oct 10, 2011 at 8:31 AM

HI Ben,

"... As we are closing on releasing a stable version..."

Just to mention my "burning desire":  If it is possible in  the stable version to include the change:

public ResponsePDU CustomSendPDU(RequestPDU pdu)
            return vTrans.SendPdu(pdu);

It was mentioned & solved ( and was /is working) in the first Discussion "How to send SubmitSm? (solved)". Thank you... :-)

Concerning the other issue "malformed packet" generating from our server, our engineering is still investigating in order to find the roor cause for this... ... will let you know, Ben...




Oct 19, 2011 at 11:12 PM

Hi guys, so far it seems to work, in 15 more days I will have it fully tested with 3 or 4 different SMSC and I will put and update with the results then.


Oct 24, 2011 at 5:57 PM


I would be happy to know the results and your experience with the library.

Please keep us posted.


Dec 3, 2011 at 6:51 PM


I am using your lib for receiving messages from SMSC, and I wonder is it posible to get SMS id and SMS timestamp?

On SMSC website I see that received messages have unique id's and time received, but cannot find the way to extract that info in PduReceivedEventHander


private void PduReceivedEventHander(object sender, PduReceivedEventArgs e)


. . .

Dec 3, 2011 at 7:25 PM


I think one part of your question has already been answered in this thread/discussion.

Regarding timestamp info, perhaps you should consider asking your gateway provider how they encode timestamp information in the PDU.

They might be using Tlv to encode that - it is what I can guess. There is no other way you could encode timestamp info in a deliversm PDU other than using Tlv (as far as I know).


Dec 3, 2011 at 8:26 PM


Thank you very much for the quick reply.

I am checking with my provider for timestamp encoding info...I'm getting Tlv.Count = 0.

Regarding the ID matter, is SmDefaultMessageId property I should be looking for? Because I get 0 (zero) always...


Dec 3, 2011 at 10:30 PM


You can get the ID of the SMS for outgoing PDU's. I am not aware of ID's for incoming PDU's.

For outgoing messages, you can see below (or see the third post in this thread).

Ask your gateway provider for more details as the only way to encode non standard info would be through Tlvs.

Smsid = ((SubmitSmResp)resp).MessageID;
}catch(InvalidCastException) {}

Jan 31, 2012 at 8:38 PM

Hi everyone, I've tested this way against 3 different smpp servers, and it works, this is the way of getting the SMSID issued by the smpp server.

Feb 1, 2012 at 4:24 AM


Thanks for the feedback.


Sep 4, 2012 at 12:54 PM


I see that in the latest released version of Jamaa SMPP Client (1.4.4 Beta 1 Release) SendMessage() method of SmppClient does not return ResponsePDU back to caller. So it is impossible to get MessageID using this method. Is it planned for future release? This would be pretty simple change, I guess...


Sep 4, 2012 at 6:52 PM

Thank you for your suggestion.

I agree that providing a way to retrieve message ID when sending message would be a good idea, and I will consider your suggestion in a future release.


On Tue, Sep 4, 2012 at 2:54 PM, oderibas <> wrote:

From: oderibas


I see that in the latest released version of Jamaa SMPP Client (1.4.4 Beta 1 Release) SendMessage() method of SmppClient does not return ResponsePDU back to caller. So it is impossible to get MessageID using this method. Is it planned for future release? This would be pretty simple change, I guess...


Read the full discussion online.

To add a post to this discussion, reply to this email (

To start a new discussion for this project, email

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at

Sep 5, 2012 at 4:04 PM

Hi Ben,


I actually tried to implement this and created pull request. Could you have a look?



Sep 5, 2012 at 6:17 PM
Sure, I will
May 26, 2013 at 3:11 PM
did you fix this thread subject?
I could not find any code as
Smsid = ((SubmitSmResp)resp).MessageID;
I've to know which sms delivered.

Jul 23, 2013 at 1:09 PM
Edited Jul 25, 2013 at 3:51 PM

I have downloaded and compiled oderibas modified source and it works great with full delivery report, however i'd like to know if the is a way to tie this with the message that was sent? For example can you retrieve the message ID when the message is sent to compare it with the delivery report? If i send 3 messages one after the other how can i know which delivery report goes with which message?


Great work by all.


Ok, worked it out so i thought i'd share:

Add handle:

client.MessageSent += client_MessageSent;

void client_MessageSent(object sender, MessageEventArgs e)
        TextMessage msg = e.ShortMessage as TextMessage;
        string SegID = msg.SegmentID.ToString(); //Gives the message ID from the SMPP on Send 
        string Seg = msg.SequenceNumber.ToString(); //Give the status of the message - Enroute

        MessageBox.Show(msg.Text); //Display message