QNX 6 dialout and dialin from modem

I have an external modem that I have setup using pppd and chat scripts to dialout and connect to a remote server. But, i also need a way for the same QNX box to also sit idle waiting for a call to come in on the same modem. Does anyone know of a way to do this? I basically just need a way to have my QNX box wait for incoming connections on the modem but at the same time be able to use my remote connection pppd script. Any help/info would be appreciated.

Just to follow up on my problem. I’ve got the dialout and answer scripts working, but the big issue now is that the answer chat script is interfereing with the dialout script. So I’ve made the dialout script terminate any pppd’s running first, and then start dialing. Right now I just want to find a cool way of getting the answer script to restart.

Right now I’m considering adding a line to start the answer script when the ip-down script is called. Has anyone else found an interesting solution to this?

For reference this is how I solved this problem.

On bootup (rc.local) I start an answer script that waits for any incoming calls on the modem. Since the script will exit when an answer is received I also added an entry into the cron server to test to see if pppd is running. If it isn’t then it will be restarted.

When an outgoing call is initiated any currently running pppd applications are killed first and then the outgoing script is executed. Then when the outgoing connection is closed the cron server will restart the answer script at a periodic interval.

If anyone is interested in the cron script to restart the answer script or any of the dialout/dialin scripts I’ll be happy to post them.

Thanks

Here is the ppp-answer script, the idea is that it will timeout every 500 seconds, and then the cron will restart it on the next minute. None of this is really very original, the answer script I found here on openqnx, the auto restart script I wrote is my own work but it isn’t any thing special. I’m just hoping to help some people should they encounter the same problems.

#!/bin/sh

ppp-answer

#set -x

/usr/sbin/pppd connect ‘/usr/bin/chat -v -t 500
ABORT “NO CARRIER” ABORT BUSY
RING ATA
CONNECT “”’

exit 0

Here is the crontab entry…

minute hour day/month month day/week command

0-59 0-23 1-31 1-12 0-6 0=Sunday

* * * * * launch_apps

The launch_apps script looks like this…
#!/bin/sh
test_if_run_and_launch pppd ppp-answer

The test_if_run… script… this will restart an COMMAND if a PROCESS is not running…
#!/bin/sh
#set -x

PROCESS=$1
COMMAND=$2

if [ -z $COMMAND ]
then
exit
fi

if [ -z $PROCESS ]
then
exit
fi

FILENAME="/tmp/"$PROCESS"_process"

/bin/pidin -P $PROCESS -f N>$FILENAME
/usr/bin/grep $PROCESS $FILENAME

RET_VAL=$?

if [ $RET_VAL -ne 0 ]
then
$COMMAND
fi
rm $FILENAME