Home
RECOMMENDED FOR YOU:
SMS Gateway software
Ozeki brings you outstanding
SMS Gateway technology. Use our SMS Server products on Windows,Linux, or Android

C# SMS API
Developers can use our C# SMS API to send SMS from C#.Net. The C# SMS API comes with full source code

PHP SMS API
The ozeki PHP SMS gateway software can be used to send SMS from PHP and to receive SMS usig PHP on your website

SMPP SMS Gateway
SMS service providers use our SMPP gateway solution, that offers a high performance SMPP server and SMPP client gateway with amazing routing capabilities
Ozeki NG SMS Gateway

C# SMS API - onMessageReceived

This event is invoked by the SMS Gateway when an incoming SMS arrives to the system. If you wish to process incoming SMS messages use this event to get notification about when they arrive.

To handle this event, the following delegate type is used:

    public delegate void ReceivedEventHandler(
         string sender,
         string receiver,
         string message,
         string messageType,
         DateTime sentTime,
         DateTime receivedTime,
         string serviceProvider
    );

And the following event is accessed:

public event ReceivedEventHandler onMessageReceived;

     Name Description


   public void onMessageReceived(
         string sender,
         string receiver,
         string message,
         string messageType,
         DateTime sentTime,
         DateTime receivedTime,
         string serviceProvider
    );
    

Create a function with this header and attach it to the onMessageReceived event to receive incoming messages in your application.

Parameters

sender - The sender phone number

receiver - The recipient phone number

message - The message text or if a binary message is received the XML representation of the binary message

messageType - The message type. A list of the SMS message types are available

in Appendix C.

sentTime - The timestamp that shows when the message was sent

receivedTime - The timestamp that shows when the message was received

serviceProvider - The name of the service provider connection that received the message

Example

Step 1. - Create the event handling function:

   void myMessageReceivedHandler(
         string sender,
         string receiver,
         string message,
         string messageType,
         DateTime sentTime,
         DateTime receivedTime,
         string serviceProvider
   )
   {
     console.writeln("A message is received from "+sender+
      " the message text is: "+message);
   };
   

Step 2. - Attach this event to the SMSClient object:

   mySMSClient.onMessageReceived += ServerEventSink.wrap(myMessageReceivedHandler);
   
Hint: Notice the ServerEventSink.wrap method, that is used to attach the event. This wrapper is used to work around an error that can happen when asynchronous callbacks are invoked in .NET remoting.

More information