Dialback Feature

Remember this is a 1.44Mb floppy disk router, space is limited.

Postby fr2654 » Sun Mar 25, 2007 11:41 pm

I would like to replace an old Multitech Proxyserver 100 dialup router with a PC running Freesco, but there is one feature that it has that doesn't seem to be in Freesco. It has a setting where an incoming call to the modem telephone line will cause the router to initiate a dialup connection. This is not a remote access (aka dialin) router; the incoming call only acts as a trigger to initiate the dialout to the default ISP.

This feature is really handy for a remotely located server using a dialup ISP with connect time restrictions. The call to the remote location is free since you can hang up after you hear one ring, and the call to the ISP is free because it uses the local access number programmed in the router. Once the IP connection is established (and the dynDNS update has been completed) it is possible to connect to the remote server using its known hostname. Otherwise the connection can be idle; except for an occasional NTP request.

This seems like a handy feature, and one that should be simple to add to Freesco. The modem presents the RI (ringing indicator) to the PC on one of the 9 serial port pins. The serial port driver could trigger the connection initiation on receipt of a change on that signal as well as demand from the LAN port(s). It seems to me this would be the same bit of code that monitors the DCD (carrier detect) to see when the ISP has disconnected to signal a connection loss. This suggestion should just be a few more lines of code.

BTW, if anyone is curious, that Multitech router has been in service for over 10 years (it has a 25MHz 80186 inside!). It is about the size of a pack of playing cards and has a 25pin D connector on one side to talk to a modem, and an RG45 LAN port on the other. It has all the essential services (NAT+DHCP). I would keep using it except that it has no web based administration page (only a hokey Windows UDP app), and I need to change the ISP account if I go over 200 hours in a month. With Freesco I could change the default ISP by connecting remotely to it.

Of course, if I could get DSL in my little mountain paradise this would be moot.
User avatar
fr2654
Newbie
 
Posts: 8
Joined: Sun Mar 25, 2007 8:57 pm

Postby CDFiXER » Mon Mar 26, 2007 12:52 am

Actually it is available as an add-on package. It is on Freescosoft and is called 'callback'.

Plus Freesco is fairly easy to modify and has a great forum!
Catapultam habeo.
Nisi pecuniam omnem mihi dabis, ad caput tuum saxum
immane mittam.
User avatar
CDFiXER
Advanced Member
 
Posts: 380
Joined: Tue Jan 07, 2003 1:45 am

Postby fr2654 » Mon Mar 26, 2007 12:00 pm

Have you actually used that package? I saw it in the past, but at the time it did not look like it would do what I want. Also, there does not seem to be any documentation short of installing the package and looking at files that are created. Since my Freesco router is in a remote location I am hesitant to do an install that may break the basic connection function of the router. There must be something more than the single line in the description from freescosoft. The other two links are not very helpful. How can I see what is in /pkg/man/callback.txt without doing a package install. I would prefer something already in English, but I may still be able to find a Russian speaker to translate.

Specifically, I think what the callback package provides is this service: User calls router to establish a dialin session. For security the router calls back a 'known' number for the user and the user authenticates (2-way action). What I am looking for is a 3-way action: User calls router and hangs up (typically before modem picks up) triggering router to dialout to a different number which is the local ISP. The 2-way method will not work for me since the freesco router is expecting to do the authentication, where in the 3-way method the authentication is at the ISP's RAS server.

Maybe someone that has used (or written) ;-) the callback package can post a comment.
User avatar
fr2654
Newbie
 
Posts: 8
Joined: Sun Mar 25, 2007 8:57 pm

Postby fr2654 » Mon Mar 26, 2007 3:44 pm

BTW, I did try modifying Freesco. I downloaded the sources and found a routine named serial.c IIRC. I made some simple hacks to it and recompiled and rebuilt freesco, but the result was badly behaved. That code looked like it is rarely touched, so mucking with it may be like touching the 3rd rail of a subway.

The ideal solution to my problem would be to associate a command with the toggle of the signal on the modem (serial) interface. That would allow me to make my own poor man's dynDNS, since I could have the command 'telnet my_home_server.somedomain.foo' mapped to the change in RI signal, and then detect the port 23 request and capture the IP address on that server. The next step is a simple ssh to that IP address and voila I have a remote connection up without any toll call expense and without needing any external HW support. FYI, I chose telnet because it is a well-known port that shouldn't be blocked by the ISP and that I know is filtered at my server.
User avatar
fr2654
Newbie
 
Posts: 8
Joined: Sun Mar 25, 2007 8:57 pm

Postby Lightning » Mon Mar 26, 2007 7:09 pm

That would allow me to make my own poor man's dynDNS

There is already a poor mans dynDNS built in that emails the new IP address to you any time it makes a connection. Also with regards to cost the dyndns.org service is actually free for a basic account as well as quite a few other services of this type around that are also free.
As for your request to just make a ring and not actually connect to make the box dialout. I suspect what you really need is a second modem in this machine configured for RAS to initalize the trigger. Which at present with the modem just being rang once with no answer I am at a loss to say what would be required.
If you are afraid that you might make a mistake. The chances are high that you will never learn anything.
User avatar
Lightning
FREESCO GOD !!
 
Posts: 12079
Joined: Wed Nov 14, 2001 6:50 am
Location: Oregon, USA

Postby fr2654 » Mon Mar 26, 2007 11:51 pm

The poor man's dynDNS is just the final step in the process. Once you know the remote IP address then you can connect with an SSH connection to the IP address rather than waiting for the DNS change to propagate. It is slightly faster, which is important when you have the connection setup to drop after 3 minutes of inactivity!

What is important is that the dialout needs to be triggered by a call to the number that the remote Freesco box has its modem connected to. The Freesco Callback package is for Microsoft CBCP where the ISP wants to call back a known number to have a level of authentication. I don't need remote access in the RAS sense because that will cost me a toll call also. I just want to trigger a Freesco router to initiate a diaout connection.

There is a similar featureto the one I want on answering machines called 'toll saver'. If the answering machine has messages it answers on the first ring; if it has no messages it waits for the 3rd ring. That lets you hang up after two rings knowing that there are no messages.

Currently, my Freesco router is really just a server that runs sshd and crond with the dialout done by the Multitech serial router. This is so that I can use the triggered dialout feature of the Multitech. Once the IP dialout is established I just need to figure out the IP address that the ISP has assigned to that connection (it is not static IP). Luckily they have small IP address pool so I can usually figure it out by looking for an open SSH port. If I could get the Freesco router to do the triggered dialout I could drop the Multitech and get true dynDNS update via the Freesco router. I would also be able to change the default ISP setting if my monthly usage approaches the 200 hour monthly limit since the Freesco config can be remotely managed.

I am sure that the serial.c routine is the key to adding this feature and that it would not add significantly to the FD image size. Does the serial.c routine and whatever it is called by get changed as part of the Freesco build from the kernel source? There must be some interaction between the serial.c routine and the higher level driver for the DataCarrierDetect (DCD) signal. That lets the PC know that the modem has lost signal. In RAS (dial-in) mode that signals the PC to tear down the connection when the call is dropped. Do you think that adding RI change support would be hard to do? The RI signalling could use a similar method as the DCD signal. I really don't want to add any HW to the Freesco router since it seems that an all SW solution can be built.
User avatar
fr2654
Newbie
 
Posts: 8
Joined: Sun Mar 25, 2007 8:57 pm

Postby CDFiXER » Tue Mar 27, 2007 1:40 am

Have you actually used that package?


Yes, but not in its intended usage.

I misunderstood your intital want and got nailed for it...

<_<

As Lightning indicated, my test comprised two modems and two lines. I used Freesco as a RAS. Once the connection was made to the dial-in router and any TCP/IP data was sensed, the second modem dialed out and established the connection. I then used the control panel to dump the connection when done.

So sorry I did not meet your criteria, I had to make one completed call.
Catapultam habeo.
Nisi pecuniam omnem mihi dabis, ad caput tuum saxum
immane mittam.
User avatar
CDFiXER
Advanced Member
 
Posts: 380
Joined: Tue Jan 07, 2003 1:45 am

Postby Slowpoke » Tue Mar 27, 2007 9:11 am

fr2654,

This is just a "quick&dirty" little script that I have written for you on my Freesco v0.3.7 box, and tested without having it in dialup mode. I can not say if it will work correctly (wait for offline state) once it connects - you will have to test that on your own, as I do not have dialup to test it with...

(Make sure you remove the 5 '+' characters from the 1st line of the script - the forum will not allow it to be written the way it's supposed to be...)
Code: Select all
#+!+/+bin+/+sh

checkstatus(){

#check the current status of the Dialup Connection
#return true if offline, false if connected

L=FALSE
if [ -f /tmp/state -a -f /tmp/connect ]
then    M=`cat /tmp/state`
set -- `cat /tmp/connect`
shift
O="$*"
else    . /etc/live.cfg
if [ "$SPPP" = y -a "$PPPLINK" ]
then    set --`ifconfig $PPPLINK | grep inet | sed -e 's/i[^:]*://' -e 's/P.*//'`
O="$1"
else    L=TRUE
fi
fi


}

mainloop(){

checkstatus
if [ $L = TRUE ];
then

#change the following line to what your modem is: /dev/cua?
read ring < /dev/cua0

#got the signal, now wait for phone line to reset
sleep 5

#signal a dialup connection
control up

#wait for the dialup connection to get established - adjust as nessicary
sleep 5

fi

checkstatus
while [ $L = FALSE ];
do

#wait 5 seconds between each check to see if we have gone offline
sleep 5
checkstatus
done
}

while [ 0 ];
do

mainloop

#pause to allow modem to reset & to prevent script from running wild
sleep 10

done

Copy this into a file (called whatever you want - I used the name 'dialback'...) and run the following command: 'chmod +x dialback' to make it executable.

The checkstatus() code was ripped from the ControlPanel CGI (I didn't know of any other simpler way to check). This should flow like this:

Check the status of the dialup. If we are offline, then we wait for a response from the modem (RING echo). When we get it, tell Freesco to dial the connection. Now we wait for Freesco to go offline again, checking every 5 seconds. Once it does go offline, wait for 10 seconds so the modem can reset, and loop back to the beginning of this description.

I hope this helps you - if nothing else, this should be able to be used until a more permanant (secure?) solution can be found/created by you.


-Slowpoke
User avatar
Slowpoke
Advanced Member
 
Posts: 233
Joined: Fri Aug 12, 2005 4:08 pm
Location: Upstate New York, USA


Return to FREESCO wish list

Who is online

Users browsing this forum: No registered users and 5 guests

cron