Hi all,

Here is my problem:

I need my PC to call my mobile phone when certain event occures, through a dial-up connection.
For that purpose I've created an internet connection (although i don't really need internet), with blank for username&password, and just my mobile phone number.

Than I wrote a batch file:

DIAL.bat
Code:
@ECHO OFF

:loop
Echo Trying to Dial up..................................
rasdial MyMobile

if NOT %ERRORLEVEL% ==0 goto failed

Exit
:failed
cls

Echo Failed to connect......will retry

goto loop
..but the problem with this script is, it can't stop calling (can't exit the loop).

So, if I answer the call (on my mobile) and subsequently close the connection (this is what I need, just to be noticed about certain event on my PC), this script starts to call again, and loops until I answer again, and so on, over and over.

Than I tried the following TEST.bat script, to establish a reason for this malfunction :

TEST.bat
Code:
@ECHO OFF

Echo Trying to Dial up..................................
rasdial MyMobile

Echo The error level is %ERRORLEVEL%

pause
..and i've got:

Code:
Trying to Dial up..................................
Connecting to MYMOBILE...

Remote Access error 676 - The phone line is busy.

For more help on this error:
        Type 'hh netcfg.chm'
        In help, click Troubleshooting, then Error Messages, then 676
The error level is 676
Press any key to continue . . .
..although the phone line apparently was not busy.

The reason for that (i think) is the script can't get %ERRORLEVEL% ==0 value, because %ERRORLEVEL% ==0 probably means a connection with an other modem is established, means handshake process is accomplished successfully.
In my case, i don't have any modem on the other side, but just my mobile, so %ERRORLEVEL% will be <>0 in any way, thus script will not leave the loop.

Is there some workaround to exit outside the loop when I answer my mobile phone?
Can modem notice that called phone doesn't ring anymore?


Many thanks in advance