Hi,
toto2717, I am not sure what exactly you are doing, but here are a few pointers -
1) Inorder to get "RING", you might have to enable Autoanswer and Answer call options in the modem. For example, the 1X modem that I am using has these settings off by default, so when my application starts, its enables Autoanswer by sending "ATS0=1" and Answer Data call by sending AT$QCVAD=4 to the modem. After enabling these settings, select the COM port on which the modem is connected (Linux select() call), call/ping the modem, select will return, read the RX queue, if you get "RING" in the RX queue means you received a RING.
2) I have configured my chat script to abort if it receives a "RING". But I haven't seen chat abort when I ping the modem. Not sure whats happening. Will have to debug more to find out.
Would anyone know how to get the exit code of chat? I have 2 scripts, a ppp-on script that starts pppd and a ppp-on-dialer that starts chat. The ppp-on script starts ppp-on-dialer script. I run ppp-on script from my C function using system call. Using the following two lines, I can know the exit code of ppp-on.
int ret = system("./ppp-on"
printf("%d", WEXITSTATUS(ret));
But how can I know the return code of chat? This is how my chat script looks.
exec chat -v -s
ABORT 'RING'
ABORT 'NO CARRIER'
'' AT
TIMEOUT 3
OK 'ATS0=1'
OK 'AT$QCVAD=4'
OK ATD$TELEPHONE
TIMEOUT 45
CONNECT ''
In the /var/run/ folder, I see a pppd.tdb file which doesn't go away irrespective of whether pppd is running or not. Would you know what this file is? And should cleanup script remove this file as well? Is there a way of specifying the number of times chat/pppd should try to establish connection before returning failure?
Karoline, the reason I am closing the COM port and then running the script is - The responses to AT commands sent by the PPP script were being picked up by another application that is waiting for a RING to happen on the COM port. Hence, the PPP script keeps looping. As soon as I kill the application that is waiting/listening for an event to happen on the COM port, the PPP script gets the response and establishes the connection.
All responses are highly appreciated.
Thanks.