Manual:Modules/SMS Gateway

From MSure

Jump to: navigation, search

Together with a compatible mobile phone, the SMS Gateway module brings the possibilities of Short Message Services, or SMS for short, to MSure. In addition to that, additional phone events are available.

Remember that sending SMS messages costs money, so be carefull of how you use this module.
Improper use may result in lots of SMS beeing sent, with subsequent charge.

Contents

Features

  • Send & receive SMS messages
  • Receive events from the mobile phone
    • Regular ring events
    • Call mode (Voice, Fax etc.)
    • Caller ID

Requirements

  • A compatible mobile phone (or other device conforming to the GMS 07.05 standard)
  • A connection to the phone/device through a COM-port (actual or virtual through Bluetooh or other medium)
  • A valid subscription with your local GSM network provider.

Configuration

As all other MSure modules, SMS Gateway is configured using a configuration file. Below is the configuration template.

<?xml version="1.0" encoding="utf-8"?>
<ModuleConfig xmlns:xi="http://www.w3.org/2001/XInclude" xml:base=".">
	<CoreConfig>
		<Alias>SMSGateway</Alias>
		<ClassName>SMSGateway</ClassName>
	</CoreConfig>
	<SMSGateway>
		<MobilePhone	ID="{unique user defined id}"
				CallerId="[false|true]" CallerMode="[false|true]"
				NewMessageBuffer="[BUFFER_FLUSH|BUFFER|DISCARD]"
				NewMessageDeliverNotification="[DISABLED|ENABLED_MEM_INDEX|ENABLED_DIRECT_ROUTE_EXCEPT_CLASS_2|ENABLED_CLASS_3]"
				ComTimeout="[10000]">
			<COMPort 
				Number="{1-256}"
				BaudRate="{75|110|134|150|300|600|1200|1800|2400|4800|7200|9600|14400|19200|38400|57600|115200|128000}"
				Parity="{None|Odd|Even|Mark|Space}" DataBits="{4|5|6|7|8}" StopBits="{None|One|Two|OnePointFive}"/>
		</MobilePhone>
	</SMSGateway>
</ModuleConfig>

Element description

  • MobilePhone - create one for each phone you wish to connect to MSure
    • ID - is used to identify the phone when processing events in, for example, a User Module
    • CallerId - set to true to enable Caller Id events -->
    • NewMessageBuffer - Usually you can ommit this attribute to use the default value
    • NewMessageDeliverNotification - Do receive notification of new messages, a value other than DISABLED must be selected. ENABLED_MEM_INDEX is recommended and works on most phones.
    • ComTimeout - If you get timout errors, increasing this may help. Default is 10 seconds (10000ms)
    • COMPort - All mobile phones must be connected to a COM-port, this is where you specify the parameters
      • Number - The COM port number
      • BaudRate - communication speed. 115200 is a good starting value.
      • Parity - the parity to use, usually "None".
      • DataBits - the number of databits to use, usually "8"
      • StopBits - the number of stop bits to use, usually "One"

Example configuration

<?xml version="1.0" encoding="utf-8"?>
<ModuleConfig xmlns:xi="http://www.w3.org/2001/XInclude" xml:base=".">
	<CoreConfig>
		<Alias>SMSGateway</Alias>
		<ClassName>SMSGateway</ClassName>
	</CoreConfig>
	<SMSGateway>
		<MobilePhone ID="Sony Ericsson K700i" CallerId="true" CallerMode="true">
			<COMPort Number="10" BaudRate="115200" Parity="None" DataBits="8" StopBits="One"/>
		</MobilePhone>
	</SMSGateway>
</ModuleConfig>

Usage

Receiving messages and distributing them withing MSure requires nothing more than enabling he module. However, to send SMS and perform operations based on the received events, a User Module must be written.

The SMS Gateway publishes the following events:

  • IncomingSMS
  • PhoneRing
  • PhoneRingWithCallMode
  • PhoneRingWithCLIP

The SMS Gateway accepts the following commands:

  • OutgoingSMS

All of the above events and the single command are available for use in a User Module.

All SMS Gateway related events and commands have a common property, PhoneId which, in the case of events,
contains the ID specified for the mobile phone in the configuration. This is the property used to differentiate
between multiple connected mobile phones. When dealing with OutgoingSMS, the PhoneId shall contain the ID of the
phone that should be used to send the SMS.
When specifying a phone number to send an SMS to, the phone number must be entered using international format: +<counter code><number without leading zero>,
for example, the Swedish number 070-1234567 becomes: +46701234567

For additional information on these event & command classes, refer to the Intellisense provided by the Visual Studio IDE. See Visual C# 2008 Solution.

Personal tools