Monday, March 10, 2008

Talking with your dial up modem

Written by
Xtreme Great
(for k0r0pt)


Have you EVER wondered about controlling your dial up modem with your own two hands and ten fingers? If not, then it is the right time to plug in your telephone wire in your modem port, and get started in an adventure, that you’ll never forget.

Well, that was the starting lines of some dumb TV serial. This one is way more than a sucking adventure.

::=::The modem::=::

The modem, as we all must know, is a device that is used to connect to the Internet. You connect your telephone line in the modem port, start up some dialer, and dial right to your ISP, and hurray, you’re connected to the Internet, and you start wondering what to do next.

In this article, it is good to start thinking how all this dialing and stuff takes place, because that is what this entire article is about.

The modem, like any other thing connected as your peripherals is a piece of circuitry and nothing more. Well, it’s a bit more than that, if taken into consideration, its uses. The connecting to the Internet is the most obvious use today, but in olden days, it was used in other purposes as well. One would be, well, to chat. You dial to your friend’s telephone number, and that is connected to his computer. He accepts the call, and you two start chatting with your keyboards.

::=::The working::=::

The modem accepts what we call commands. I have been dying to know about the details of this thing. After a lot of research, I could figure out a lot about this piece of shit I checked out the device manager on a windows machine, where querying the modem was supported. I built logs from the queries, (whose option was available there. So, don't get heralded over how I did it) and got into the details of the commands there. I tried to interpret all the details from the conversation between my OS and my hardware and figured out the following:

Every command started with the alphabets AT, except for the abort command, which is a simple character return <cr> (ASCII character 15).

The modem responds as follows:


And best of all, the modem can be directly controlled from your programs, if you know which port it resides in. Also, you’ve got to know a bit of programming (How do you think you are going to program, if you don't know it?), and most importantly, the commands relating to the modem. At the end of this document, I have appended a small basic program, which demonstrates how you can use the modem directly from your programs.

AT Initialize the modem. I have also seen ATZ here.

ATM1 Turns on the modem speaker

ATH# Hang up the modem. The # is a number. Don't know its purpose. Seen a 0 there, while reading about the ATH0 DoS.

at#ud Enable diagnostic info

ATDT###### Dial a number. #es being the phone number. A blocking signal can be given to the modem, if a *67 is refixed to the phone number. Don't know what it does. The T in the end specifies that dialling is to be done in tone mode. If the T is replaced by a P, then the modem will dial in pulse mode.

ATL# Set the loudness of the modem speaker. Hash being a number. 5, prrobably, the loudest.

<cr> Abort some given command. Typically useful in hanging up, when already dialing.

-----Unresolved commands-----

Well, the following are the commands, which I was unable to figure out:

AT&FE0V1S0=0&C1&D2+MR=2;+DR=1;+ER=1;W2 ATS7=60S30=0L2M1+ES=3,0,2;+DS=3;+DS44=3;+IFC=2,2;X4



::=::The program::=::

The key to control the device is to treat is like a port. In my machine, it is on the COM3 port. In your machine it would be something else. To know which port it is on, just check out your device manager in windows. In case of Linux, it would be in the /dev folder. I don’t know much about it in Linux. My modem is not supported in any distro, and I had Ethernet connectivity, so I didn’t think much about it.

I give a simple basic program here. You can make the same program in any language, if you understand how I am doing it here. Just use the device port as a file.

To compile and run it, just get quick basic(windows) and Free Basic(windows and *nix) from somewhere, and get started. This one here is to dial in to a computer only. To make a full fledged chat program, you need to spend about half of an hour. I leave that on to you. The following program is for Windows. You can infer that because I am using a COM port.

PRINT "Opening a path to your modem..."
OPEN "COM1:9600,N,8,1,RB7048,TB7048" FOR RANDOM AS #1
PRINT "Please enter the phone number you wish to call"
INPUT PhoneNumber$
PRINT "Talking to your modem..."
PRINT #1, "ATDP"; PhoneNumber$
PRINT "There you go, pick up the phone and talk! Or type something out"
PRINT "Press the ESC key to hang up!"

I have used Pulse Dialing, as my telephone line didn’t support Tone dialing. If your line supports Tone dialing, do that. It’s faster.


This concludes the end of the article. If you have any doubts, I’d be more than happy to help you. Just leave a comment. If you like that, leave a comment, and that will help me write more interesting articles like this. If you don’t like this, leave a comment, and that will help me correct my mistakes.

No comments: