How do I receive SMS from mobile this smpp?

Aug 26, 2013 at 10:29 AM
Edited Aug 26, 2013 at 10:30 AM
Hi !
I am trying to use this as an esme account. I was able to send SMS successfully to the subscriber but i was not able to get the acknowlege message.

And more important i was not able to receive the SMS from particular subscriber. i have done coding as mentioned while receiving SMS but i don't see any esme client connected to Gateway. this may be the reason my sms sent via mobile fails.
i need to see esme client because subscriber can send SMS to esme anytime.

please help me.
thanks
Aug 27, 2013 at 8:34 AM
hei akash123

here are the following things you can do to receive delivery report and sms from mobile.
  1. for receiving messages from mobile. use can use wrapper smppclient
               SmppClient   clientObj = new SmppClient();
            
  

                clientObj.MessageReceived += new EventHandler<MessageEventArgs>(MessageReceived); // this is the event handler that would recieve any message from mobile.
                clientObj.Start();


             
          
public void MessageReceived()
{
   // to do 
}
2: whenever you send a message you receive a unique id from smsc for each sms which shows that the message has been sent successfully
publicl bool SendMessage(Message msg)
        {
            bool isSend = false;
            try
            {
           
                TextMessage message = new TextMessage();
             
                message.DestinationAddress =DestinationAddress;
                message.SourceAddress = SourceAddress;
                message.Text =Body;
              
                ResponsePDU resp = clientObj.SendMessage(message, 1000, true);
                Log.Info("OUT : " + msg.DestinationAddress + " : " + msg.Body);
                if (resp != null)
                {
                  SubmittedmessageID = ((SubmitSmResp)resp).MessageID);
                }
              

                isSend = true;

            }
  • you have to override the sendmessage method in smppclient as well
  public ResponsePDU SendMessage(ShortMessage message, int timeOut, bool bMessage)
        {
            if (message == null) { throw new ArgumentNullException("message"); }

            //Check if connection is open
            ResponsePDU resp = null;
            if (vState != SmppConnectionState.Connected)
            { throw new SmppClientException("Sending message operation failed because the SmppClient is not connected"); }
            vProperties.DefaultEncoding = message.DataCoding == DataCoding.UCS2 ? DataCoding.UCS2 : vProperties.DefaultEncoding;
            foreach (SendSmPDU pdu in message.GetMessagePDUs(vProperties.DefaultEncoding))
            {

                resp = vTrans.SendPdu(pdu, timeOut);
                // message.MessageId = ((SubmitSmResp)resp).MessageID;
                if (resp.Header.ErrorCode != SmppErrorCode.ESME_ROK)
                { throw new SmppException(resp.Header.ErrorCode); }
                RaiseMessageSentEvent(message);

            }
            return resp;

        }
you are done now :)
Aug 29, 2013 at 12:20 PM
Thank you shaji,
1.But my problem is i don't see any esme client on the gate way? so that sms could be forwarded by smsc to that esme. i had done as u mentioned but didn't work.
2.Earlier i have tried this code in console but when i tried to use in windows form in c# i get 'Could not load file or assembly 'JamaaTech.Smpp.Net.Client.v1.4, Version=1.4.3.23397, Culture=neutral, PublicKeyToken=b4d987d2a0589433' or one of its dependencies. The system cannot find the file specified.' although i am using as reference as well as in bin. how can it execute.
please help