TextMarshal looks for a message provider in a .NET DLL called TextMarshal Message Interface.dll. The version that comes with TextMarshal is designed for ClickSend. To use a different SMS gateway, replace this file. The assembly must have a reference to SOS TextMarshal.exe. It must contain a class that implements IMessageProvider and has a public constructor that can be called with no arguments. The required methods are:
- Initialize(Dictionary<string, string>, MessageReceiver) is called immediately after TextMarshal loads your message provider. The dictionary provides all configuration entries. Store the MessageReceiver object so your provider can continue to interact with TextMarshal. Start any background threads in this method implementation.
- SendMessage(string, string) is called when TextMarshal needs to send out a text message. The first parameter is the recipient number in full international format (e.g. +15552483579). The second parameter is the message text. Return a Boolean value indicating whether the message was sent successfully. If the send is unsuccessful, TextMarshal may call this method again later to retry. Exceptions should be thrown only in very unusual situations in which it would be inappropriate to retry the send.
- ShutDown() is called when TextMarshal is stopping. Clean up any external resources used by your message provider.
- Name is a read-only property accessed when logging the successful initialization of a message provider. Return the human-readable name of your provider.
- MessageReceived(string, string) is used to signal TextMarshal that an incoming message has been received. The first parameter is the source number in full international format. The second number is the message's text.
- EndProgramNow() immediately exits the TextMarshal process. This is useful for stopping in critical conditions when required configuration entries are missing.