This project is read-only.

Busy Signal

Jul 22, 2009 at 6:36 PM

I have created a dialer to connect to a terminal through a dialup connection.  When dialing I have encountered a busy signal that will keep my connection established and will not hang up.  I have tried using the HangUp() method and still there is nothing.  I end up having to remove the wire from the plug.  Is there a way to capture a busy signal, hangup the connection, and then redial?

Thank you for your help!!!

Jul 23, 2009 at 12:45 AM

I would probably use the Timeout method on the RasDialer to deal with that scenario. However you will also need to: dial the connection asynchronously using the DialAsync method, set the SynchronizingObject property if you're using Windows Forms (or needing to deal with thread synchronization), and wire up the DialCompleted event. There is a property on the EventArgs class passed into it indicating whether the connection attempt timed out. Also, if the connection does in fact time out, the RasDialer component will handle disconnecting for you automatically.

One last thing you need to be aware of when dialing connections asynchronously: YOU MUST DISPOSE OF THE COMPONENT BY CALLING THE DISPOSE() METHOD!

I have that written on the component in the help documentation but no one ever bothers to read it. If you're dialing a connection asynchronously and the application terminates while the connection attempt is in progress Windows will not be able to release the connection and the machine will need to be rebooted.

Jul 23, 2009 at 12:56 PM

Thank you Jeff for your reply.

I am using the DialAsync method to connect.  I have added a call to the Dispose() method when the application is exited and after it has tried redialing the set number of times.  I have also set the timeout property lower to try to catch a busy signal.  The problem seems to still be there.  After the first attempt, if it is busy (which it is the majority of the time unfortunatly), it attempts to redial.  However, it can not find a dial tone anymore because the previous connection is not being closed.  Is there something that I am still missing?  Or, could it be a problem with the modem itself.  I've queried the modem and it says that it is working properly.  Any help you can give is appreciated.

Thank you!!

Jul 23, 2009 at 2:52 PM

If you're setting the Timeout property on the component it should be handling all of that for you. The CancelDialAsync method will hang up any pending connection attempt as well.

private RasDialer dialer;

private void dialer_DialCompleted(object sender, DialCompletedEventArgs e)
{
    if (e.TimedOut)
    {
        // You'll need to restart the connection attempt here.
    }
}

public void DialConnection()
{
    dialer = new RasDialer();
    dialer.EntryName = "My Connection";
    dialer.Timeout = 60000;

    dialer.DialAsync();
}

public void AbortConnection()
{
    dialer.CancelDialAsync();
}

There's a very basic example of what should be done to handle the timeout. You can always try getting the latest source code and stepping through it to see if there are any problems you're seeing with the timeout mechanism. I just glanced over the code and it all looks fine.