Easy Guardian provides alarms by texting system administrators
If you would like to monitor you server 24h/24h this is the right tool for you! It brings together NMAP and Net-SNMP in a small silent Linux embedded box.  Visit: http://www.easyguardian.com
FoxBox arrow How-to arrow ASP.net integration
English
Integration with ASP.net PDF Print E-mail
Learn how to perform changes in the XML export script for ASP .NET and other applications

 

As explained in the tutorial "How to perform custom actions on incoming or outgoing SMS messages"
the XML transformation script is an action activated by uncommenting the following lines from Event Handler.

#Save messages in XML format
#if [ "$1" = "RECEIVED" ]; then
#/etc/sms/scripts/sms2xml $1 $2 $3
#fi

To activate de-activate the module you have always to remember to remove/add the # sharp character.

This code represent the call on action "RECEIVED" to the sms2xml script.
The code inside the script is reported below:

#run this script only when a message was received.
if [ "$1" != "RECEIVED" ]; then exit; fi;
#Extract data from the SMS file
FROM=`/etc/procmail/formail -zx From: < $2`
TEXT=`/etc/procmail/formail -I "" <$2 | sed -e"1d"`
#Save as XML
#for some reason the mktemp-command creates two instances of the file if
#I add the .xml-extension to the FILENAME-variable.

FILENAME=`mktemp /mnt/flash/root/xml/smsXXXXXX`
BACKENDSWF="/mnt/flash/root/xml/sms.xml"
echo "" >$FILENAME.xml
echo "" >>$FILENAME.xml
echo "" >>$FILENAME.xml
echo " $FROM" >>$FILENAME.xml
echo " $TEXT" >>$FILENAME.xml
echo "" >>$FILENAME.xml
#Delete the original file without the .xml-extension
rm $FILENAME

As you can see this script perform an "export" of data from the original SMS format file and save it in a simple XML document.
In some cases you need to change the XML format to accomplish to rules of other software and for an easier integration in software environments.

XML custom script for ASP .NET integration

In the example we are going to create a simple web page that takes data from the XML file sms.xml and show it in a
DataList element. We used Microsoft™ Visual Web Developer a really interesting tool that provide a simple way for
ASP .NET development. You are free to download it and use it to try the example in the ZIP archive containing the source example.

The VWD environment provide a really good support to XML but as many other program it take informations from node attributes
instead of content of nodes.
To override to this issue we provide you a simple script that exports informations in the correct XML format:

	Run this script only when a message was received.
if [ "$1" != "RECEIVED" ]; then exit; fi;
#Extract data from the SMS file
FROM=`/etc/procmail/formail -zx From: < $2`
TEXT=`/etc/procmail/formail -I "" <$2 | sed -e"1d"`
#Save as XML
#for some reason the mktemp-command creates two instances of the file if I
#add the .xml-extension to the FILENAME-variable.
FILENAME=`mktemp /mnt/flash/root/xml/smsXXXXXX`
BACKENDSWF="/mnt/flash/root/xml/sms.xml"
echo "" >$FILENAME.xml
echo "" >>$FILENAME.xml
echo " " >>$FILENAME.xml
echo "" >>$FILENAME.xml
#Delete the original file without the .xml-extension
rm $FILENAME

As you can see all informations are now assigned to the realtive attribute in the tag
so that you can simply assign to the file a datasource inside your ASP .NET project.
#
#Enable this to activate custom events
#
if [ "$1" = "RECEIVED" ]; then
/mnt/flash/root/source/custom/custom_rx "$2"
fi
#
As you can see, in this if clause the RECEIVED event is selected. The events you can select are: SENT, RECEIVED, FAILED or REPORT

The SMS FoxBox Software is developed by KDEV (http://www.kdev.it), a Davide Cantaluppi company on Acme Systems FOX GM Hardware

 
 
< Prev   Next >
Product description Price Code Qt.y
SMS FoxBox

SMS FoxBox

The new FoxBox G20 is a Linux microserver that provides innovative functionalities for MMS and SMS management and integrates easy guardian for monitoring network devices.

830 EUR FOXBOXG20

KDEV di Davide Cantaluppi, P.IVA 02984320131

http://www.kdev.it