' ***********************************************************************
' * Script name:   GSm registration                                     *
' * Description:   The unit sends a message to the serial port when the *
' *                the GPRS network status change                       *
' *                In addition we verify what happend with the IP       *
' *                assigned to the unit when we lost the GSM register   *
' * Responsible:   Ramiro Sanchez                                       *
' * Date:          02/22/2011                                           *
' ***********************************************************************
' --------------------------------------------------------------------
' General configuration
' --------------------------------------------------------------------
at&f
at+cgsn
at$pkg
at+cgmr
at+cgatt=0
at+cgdcont=1,"IP","internet3.voicestream.com"
at$UDpAPI=,1720
at$Friend=1,1,"209.42.60.137"

AT$EVENT=10,0,10,0,0
AT$EVENT=10,3,60,10,3674318

AT$EVENT=11,0,10,1,1
AT$EVENT=11,3,60,11,3674318

AT$EVENT=12,0,10,2,2
AT$EVENT=12,3,60,12,3674318

AT$EVENT=13,0,10,3,3
AT$EVENT=13,3,60,13,3674318

AT$EVENT=14,0,10,4,4
AT$EVENT=14,3,60,14,3674318

AT$EVENT=15,0,10,5,5
AT$EVENT=15,3,60,15,3674318

' Use the command at$areg=0 or at+cfun=0 to desregister from the network

at+cgreg=2

at+cgatt=1

at$areg=2

at&w
